aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore15
-rw-r--r--.travis.yml15
-rw-r--r--CMakeLists.txt2
-rw-r--r--CONTRIBUTING.md229
-rw-r--r--ISSUE_TEMPLATE.md4
-rw-r--r--Makefile6
-rw-r--r--README.md8
-rw-r--r--neovim.rb9
-rw-r--r--runtime/CMakeLists.txt14
-rw-r--r--runtime/autoload/csscomplete.vim1155
-rw-r--r--runtime/autoload/netrw.vim1372
-rw-r--r--runtime/autoload/provider/clipboard.vim1
-rw-r--r--runtime/autoload/sqlcomplete.vim35
-rw-r--r--runtime/doc/Makefile22
-rw-r--r--runtime/doc/change.txt15
-rw-r--r--runtime/doc/develop.txt2
-rw-r--r--runtime/doc/doctags.c83
-rw-r--r--runtime/doc/editing.txt28
-rw-r--r--runtime/doc/eval.txt71
-rw-r--r--runtime/doc/index.txt8
-rw-r--r--runtime/doc/insert.txt2
-rw-r--r--runtime/doc/mlang.txt10
-rw-r--r--runtime/doc/options.txt15
-rw-r--r--runtime/doc/pi_netrw.txt142
-rw-r--r--runtime/doc/quickfix.txt2
-rw-r--r--runtime/doc/repeat.txt2
-rw-r--r--runtime/doc/starting.txt28
-rw-r--r--runtime/doc/syntax.txt29
-rw-r--r--runtime/doc/usr_02.txt72
-rw-r--r--runtime/doc/usr_41.txt7
-rw-r--r--runtime/doc/various.txt7
-rw-r--r--runtime/doc/vi_diff.txt2
-rw-r--r--runtime/doc/windows.txt6
-rw-r--r--runtime/indent/fortran.vim30
-rw-r--r--runtime/indent/php.vim60
-rw-r--r--runtime/indent/sh.vim4
-rw-r--r--runtime/indent/vim.vim14
-rw-r--r--runtime/indent/zimbu.vim12
-rw-r--r--runtime/plugin/matchparen.vim2
-rw-r--r--runtime/plugin/netrwPlugin.vim10
-rw-r--r--runtime/syntax/c.vim4
-rw-r--r--runtime/syntax/d.vim42
-rw-r--r--runtime/syntax/dcl.vim10
-rw-r--r--runtime/syntax/lisp.vim8
-rw-r--r--runtime/syntax/maple.vim10
-rw-r--r--runtime/syntax/messages.vim3
-rw-r--r--runtime/syntax/sh.vim9
-rw-r--r--runtime/syntax/tex.vim8
-rw-r--r--runtime/syntax/zsh.vim15
-rw-r--r--scripts/msgpack-gen.lua34
-rwxr-xr-xscripts/vim-patch.sh2
-rw-r--r--src/.asan-blacklist (renamed from .asan-blacklist)0
-rw-r--r--src/.valgrind.supp (renamed from .valgrind.supp)0
-rw-r--r--src/Doxyfile (renamed from Doxyfile)0
-rwxr-xr-xsrc/clint.py (renamed from clint.py)24
-rw-r--r--src/nvim/CMakeLists.txt5
-rw-r--r--src/nvim/api/private/defs.h4
-rw-r--r--src/nvim/api/private/handle.c36
-rw-r--r--src/nvim/api/private/handle.h6
-rw-r--r--src/nvim/api/private/helpers.h94
-rw-r--r--src/nvim/api/vim.c24
-rw-r--r--src/nvim/buffer.c3
-rw-r--r--src/nvim/buffer.h16
-rw-r--r--src/nvim/buffer_defs.h20
-rw-r--r--src/nvim/charset.c4
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/eval.c347
-rw-r--r--src/nvim/eval/decode.c18
-rw-r--r--src/nvim/eval/encode.c622
-rw-r--r--src/nvim/eval/typval_encode.h563
-rw-r--r--src/nvim/event/defs.h26
-rw-r--r--src/nvim/event/libuv_process.c2
-rw-r--r--src/nvim/event/loop.h64
-rw-r--r--src/nvim/event/process.c12
-rw-r--r--src/nvim/event/process.h2
-rw-r--r--src/nvim/ex_docmd.c28
-rw-r--r--src/nvim/ex_docmd.h1
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/file_search.c2
-rw-r--r--src/nvim/func_attr.h251
-rw-r--r--src/nvim/garray.h28
-rw-r--r--src/nvim/getchar.c7
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/lib/klist.h154
-rw-r--r--src/nvim/lib/kvec.h257
-rw-r--r--src/nvim/lib/queue.h158
-rw-r--r--src/nvim/lib/ringbuf.h388
-rw-r--r--src/nvim/log.c63
-rw-r--r--src/nvim/main.c13
-rw-r--r--src/nvim/main.h3
-rw-r--r--src/nvim/map.c160
-rw-r--r--src/nvim/map.h28
-rw-r--r--src/nvim/mbyte.c2
-rw-r--r--src/nvim/msgpack_rpc/channel.c30
-rw-r--r--src/nvim/msgpack_rpc/helpers.c66
-rw-r--r--src/nvim/msgpack_rpc/server.c3
-rw-r--r--src/nvim/normal.c4
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/os/fs.c1
-rw-r--r--src/nvim/os/input.c12
-rw-r--r--src/nvim/os/pty_process.h9
-rw-r--r--src/nvim/os/pty_process_unix.c (renamed from src/nvim/event/pty_process.c)18
-rw-r--r--src/nvim/os/pty_process_unix.h (renamed from src/nvim/event/pty_process.h)9
-rw-r--r--src/nvim/os/pty_process_win.h28
-rw-r--r--src/nvim/os/shell.c7
-rw-r--r--src/nvim/os/signal.c11
-rw-r--r--src/nvim/os/time.c3
-rw-r--r--src/nvim/po/eo.po62
-rw-r--r--src/nvim/po/it.po106
-rw-r--r--src/nvim/po/ja.euc-jp.po180
-rw-r--r--src/nvim/po/ja.po179
-rw-r--r--src/nvim/po/ja.sjis.po186
-rw-r--r--src/nvim/rbuffer.h42
-rw-r--r--src/nvim/regexp_nfa.c34
-rw-r--r--src/nvim/spell.c111
-rw-r--r--src/nvim/state.c5
-rw-r--r--src/nvim/syntax.c130
-rw-r--r--src/nvim/terminal.c25
-rw-r--r--src/nvim/testdir/Makefile9
-rw-r--r--src/nvim/testdir/runtest.vim3
-rw-r--r--src/nvim/testdir/test10.in110
-rw-r--r--src/nvim/testdir/test10.ok23
-rw-r--r--src/nvim/testdir/test10a.in72
-rw-r--r--src/nvim/testdir/test10a.ok23
-rw-r--r--src/nvim/testdir/test34.in86
-rw-r--r--src/nvim/testdir/test34.ok10
-rw-r--r--src/nvim/testdir/test55.in600
-rw-r--r--src/nvim/testdir/test55.ok199
-rw-r--r--src/nvim/testdir/test_hardcopy.vim58
-rw-r--r--src/nvim/testdir/test_langmap.vim24
-rw-r--r--src/nvim/testdir/test_syntax.vim63
-rw-r--r--src/nvim/testdir/test_unlet.vim26
-rw-r--r--src/nvim/tui/input.c13
-rw-r--r--src/nvim/tui/tui.c5
-rw-r--r--src/nvim/ugrid.h20
-rw-r--r--src/nvim/ui.c28
-rw-r--r--src/nvim/ui_bridge.c9
-rw-r--r--src/nvim/ui_bridge.h14
-rw-r--r--src/nvim/version.c36
-rw-r--r--test/functional/api/buffer_spec.lua2
-rw-r--r--test/functional/api/menu_spec.lua2
-rw-r--r--test/functional/api/server_notifications_spec.lua2
-rw-r--r--test/functional/api/server_requests_spec.lua2
-rw-r--r--test/functional/api/tabpage_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua2
-rw-r--r--test/functional/api/window_spec.lua2
-rw-r--r--test/functional/autocmd/autocmd_spec.lua2
-rw-r--r--test/functional/autocmd/tabclose_spec.lua2
-rw-r--r--test/functional/autocmd/tabnew_spec.lua2
-rw-r--r--test/functional/autocmd/tabnewentered_spec.lua2
-rw-r--r--test/functional/autocmd/termclose_spec.lua2
-rw-r--r--test/functional/autocmd/textyankpost_spec.lua2
-rw-r--r--test/functional/clipboard/clipboard_provider_spec.lua2
-rw-r--r--test/functional/dict_notifications_spec.lua2
-rw-r--r--test/functional/eval/glob_spec.lua2
-rw-r--r--test/functional/eval/json_functions_spec.lua2
-rw-r--r--test/functional/eval/msgpack_functions_spec.lua2
-rw-r--r--test/functional/eval/operators_spec.lua2
-rw-r--r--test/functional/eval/printf_spec.lua2
-rw-r--r--test/functional/eval/reltime_spec.lua2
-rw-r--r--test/functional/eval/server_spec.lua2
-rw-r--r--test/functional/eval/special_vars_spec.lua2
-rw-r--r--test/functional/eval/string_spec.lua2
-rw-r--r--test/functional/eval/timer_spec.lua2
-rw-r--r--test/functional/eval/vvar_event_spec.lua2
-rw-r--r--test/functional/ex_cmds/append_spec.lua2
-rw-r--r--test/functional/ex_cmds/cd_spec.lua162
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua2
-rw-r--r--test/functional/ex_cmds/grep_spec.lua2
-rw-r--r--test/functional/ex_cmds/menu_spec.lua2
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua2
-rw-r--r--test/functional/ex_cmds/profile_spec.lua2
-rw-r--r--test/functional/ex_cmds/quit_spec.lua2
-rw-r--r--test/functional/ex_cmds/recover_spec.lua2
-rw-r--r--test/functional/ex_cmds/sign_spec.lua2
-rw-r--r--test/functional/ex_cmds/write_spec.lua2
-rw-r--r--test/functional/ex_cmds/wundo_spec.lua2
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua3
-rw-r--r--test/functional/ex_getln/history_spec.lua2
-rw-r--r--test/functional/helpers.lua144
-rw-r--r--test/functional/job/job_spec.lua32
-rw-r--r--test/functional/legacy/002_filename_recognition_spec.lua2
-rw-r--r--test/functional/legacy/003_cindent_spec.lua2
-rw-r--r--test/functional/legacy/004_bufenter_with_modelines_spec.lua2
-rw-r--r--test/functional/legacy/005_bufleave_delete_buffer_spec.lua2
-rw-r--r--test/functional/legacy/006_argument_list_spec.lua2
-rw-r--r--test/functional/legacy/007_ball_buffer_list_spec.lua2
-rw-r--r--test/functional/legacy/009_bufleave_autocommand_spec.lua2
-rw-r--r--test/functional/legacy/010_errorformat_spec.lua156
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua3
-rw-r--r--test/functional/legacy/015_alignment_spec.lua2
-rw-r--r--test/functional/legacy/018_unset_smart_indenting_spec.lua2
-rw-r--r--test/functional/legacy/019_smarttab_expandtab_spec.lua2
-rw-r--r--test/functional/legacy/020_blockwise_visual_spec.lua2
-rw-r--r--test/functional/legacy/021_control_wi_spec.lua2
-rw-r--r--test/functional/legacy/022_line_ending_spec.lua2
-rw-r--r--test/functional/legacy/023_edit_arguments_spec.lua2
-rw-r--r--test/functional/legacy/025_jump_tag_hidden_spec.lua2
-rw-r--r--test/functional/legacy/026_execute_while_if_spec.lua2
-rw-r--r--test/functional/legacy/027_expand_file_names_spec.lua37
-rw-r--r--test/functional/legacy/028_source_ctrl_v_spec.lua2
-rw-r--r--test/functional/legacy/029_join_spec.lua2
-rw-r--r--test/functional/legacy/031_close_commands_spec.lua11
-rw-r--r--test/functional/legacy/033_lisp_indent_spec.lua2
-rw-r--r--test/functional/legacy/034_user_function_spec.lua102
-rw-r--r--test/functional/legacy/035_increment_and_decrement_spec.lua2
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua2
-rw-r--r--test/functional/legacy/038_virtual_replace_spec.lua2
-rw-r--r--test/functional/legacy/039_visual_block_mode_commands_spec.lua2
-rw-r--r--test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua2
-rw-r--r--test/functional/legacy/043_magic_settings_spec.lua2
-rw-r--r--test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua2
-rw-r--r--test/functional/legacy/045_folding_spec.lua2
-rw-r--r--test/functional/legacy/046_multi_line_regexps_spec.lua2
-rw-r--r--test/functional/legacy/051_highlight_spec.lua2
-rw-r--r--test/functional/legacy/054_buffer_local_autocommands_spec.lua2
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua949
-rw-r--r--test/functional/legacy/056_script_local_function_spec.lua2
-rw-r--r--test/functional/legacy/057_sort_spec.lua2
-rw-r--r--test/functional/legacy/059_utf8_spell_checking_spec.lua2
-rw-r--r--test/functional/legacy/060_exists_and_has_functions_spec.lua2
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua14
-rw-r--r--test/functional/legacy/062_tab_pages_spec.lua2
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua2
-rw-r--r--test/functional/legacy/065_float_and_logic_operators_spec.lua2
-rw-r--r--test/functional/legacy/066_visual_block_tab_spec.lua2
-rw-r--r--test/functional/legacy/067_augroup_exists_spec.lua2
-rw-r--r--test/functional/legacy/068_text_formatting_spec.lua10
-rw-r--r--test/functional/legacy/072_undo_file_spec.lua2
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua3
-rw-r--r--test/functional/legacy/075_maparg_spec.lua2
-rw-r--r--test/functional/legacy/076_completefunc_spec.lua2
-rw-r--r--test/functional/legacy/077_mf_hash_grow_spec.lua2
-rw-r--r--test/functional/legacy/078_swapfile_recover_spec.lua2
-rw-r--r--test/functional/legacy/080_substitute_spec.lua2
-rw-r--r--test/functional/legacy/081_coptions_movement_spec.lua2
-rw-r--r--test/functional/legacy/082_string_comparison_spec.lua2
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua2
-rw-r--r--test/functional/legacy/084_curswant_spec.lua2
-rw-r--r--test/functional/legacy/088_conceal_tabs_spec.lua2
-rw-r--r--test/functional/legacy/089_number_relnumber_findfile_spec.lua2
-rw-r--r--test/functional/legacy/090_sha256_spec.lua2
-rw-r--r--test/functional/legacy/091_context_variables_spec.lua2
-rw-r--r--test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua2
-rw-r--r--test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua2
-rw-r--r--test/functional/legacy/094_visual_mode_operators_spec.lua2
-rw-r--r--test/functional/legacy/095_regexp_multibyte_spec.lua2
-rw-r--r--test/functional/legacy/096_location_list_spec.lua2
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua2
-rw-r--r--test/functional/legacy/098_scrollbind_spec.lua2
-rw-r--r--test/functional/legacy/101_hlsearch_spec.lua2
-rw-r--r--test/functional/legacy/102_fnameescape_spec.lua2
-rw-r--r--test/functional/legacy/103_visual_mode_reset_spec.lua2
-rw-r--r--test/functional/legacy/104_let_assignment_spec.lua2
-rw-r--r--test/functional/legacy/106_errorformat_spec.lua2
-rw-r--r--test/functional/legacy/107_adjust_window_and_contents_spec.lua2
-rw-r--r--test/functional/legacy/108_backtrace_debug_commands_spec.lua2
-rw-r--r--test/functional/legacy/arglist_spec.lua2
-rw-r--r--test/functional/legacy/assert_spec.lua14
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua2
-rw-r--r--test/functional/legacy/autoformat_join_spec.lua2
-rw-r--r--test/functional/legacy/backspace_opt_spec.lua2
-rw-r--r--test/functional/legacy/breakindent_spec.lua2
-rw-r--r--test/functional/legacy/cdo_spec.lua2
-rw-r--r--test/functional/legacy/changelist_spec.lua2
-rw-r--r--test/functional/legacy/charsearch_spec.lua2
-rw-r--r--test/functional/legacy/close_count_spec.lua2
-rw-r--r--test/functional/legacy/command_count_spec.lua2
-rw-r--r--test/functional/legacy/comparators_spec.lua2
-rw-r--r--test/functional/legacy/delete_spec.lua2
-rw-r--r--test/functional/legacy/erasebackword_spec.lua2
-rw-r--r--test/functional/legacy/eval_spec.lua20
-rw-r--r--test/functional/legacy/expand_spec.lua72
-rw-r--r--test/functional/legacy/file_perm_spec.lua2
-rw-r--r--test/functional/legacy/fixeol_spec.lua2
-rw-r--r--test/functional/legacy/fnamemodify_spec.lua2
-rw-r--r--test/functional/legacy/function_sort_spec.lua26
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua2
-rw-r--r--test/functional/legacy/increment_spec.lua2
-rw-r--r--test/functional/legacy/insertcount_spec.lua2
-rw-r--r--test/functional/legacy/join_spec.lua2
-rw-r--r--test/functional/legacy/lispwords_spec.lua2
-rw-r--r--test/functional/legacy/listchars_spec.lua2
-rw-r--r--test/functional/legacy/listlbr_spec.lua2
-rw-r--r--test/functional/legacy/listlbr_utf8_spec.lua2
-rw-r--r--test/functional/legacy/mapping_spec.lua2
-rw-r--r--test/functional/legacy/marks_spec.lua2
-rw-r--r--test/functional/legacy/match_conceal_spec.lua2
-rw-r--r--test/functional/legacy/nested_function_spec.lua2
-rw-r--r--test/functional/legacy/options_spec.lua2
-rw-r--r--test/functional/legacy/qf_title_spec.lua2
-rw-r--r--test/functional/legacy/quickfix_spec.lua11
-rw-r--r--test/functional/legacy/search_mbyte_spec.lua2
-rw-r--r--test/functional/legacy/searchpos_spec.lua2
-rw-r--r--test/functional/legacy/set_spec.lua2
-rw-r--r--test/functional/legacy/signs_spec.lua2
-rw-r--r--test/functional/legacy/tagcase_spec.lua2
-rw-r--r--test/functional/legacy/textobjects_spec.lua2
-rw-r--r--test/functional/legacy/undolevels_spec.lua2
-rw-r--r--test/functional/legacy/utf8_spec.lua2
-rw-r--r--test/functional/legacy/wordcount_spec.lua2
-rw-r--r--test/functional/legacy/writefile_spec.lua2
-rw-r--r--test/functional/normal/K_spec.lua2
-rw-r--r--test/functional/options/defaults_spec.lua2
-rw-r--r--test/functional/options/shortmess_spec.lua2
-rw-r--r--test/functional/plugin/helpers.lua2
-rw-r--r--test/functional/plugin/matchparen_spec.lua2
-rw-r--r--test/functional/plugin/msgpack_spec.lua2
-rw-r--r--test/functional/plugin/shada_spec.lua2
-rw-r--r--test/functional/preload.lua2
-rw-r--r--test/functional/provider/define_spec.lua2
-rw-r--r--test/functional/provider/python3_spec.lua2
-rw-r--r--test/functional/provider/python_spec.lua2
-rw-r--r--test/functional/shada/buffers_spec.lua2
-rw-r--r--test/functional/shada/compatibility_spec.lua2
-rw-r--r--test/functional/shada/errors_spec.lua2
-rw-r--r--test/functional/shada/helpers.lua2
-rw-r--r--test/functional/shada/history_spec.lua2
-rw-r--r--test/functional/shada/marks_spec.lua2
-rw-r--r--test/functional/shada/merging_spec.lua2
-rw-r--r--test/functional/shada/registers_spec.lua2
-rw-r--r--test/functional/shada/shada_spec.lua2
-rw-r--r--test/functional/shada/variables_spec.lua2
-rw-r--r--test/functional/shell/bang_filter_spec.lua2
-rw-r--r--test/functional/shell/viml_system_spec.lua10
-rw-r--r--test/functional/terminal/altscreen_spec.lua2
-rw-r--r--test/functional/terminal/buffer_spec.lua2
-rw-r--r--test/functional/terminal/cursor_spec.lua2
-rw-r--r--test/functional/terminal/edit_spec.lua2
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua2
-rw-r--r--test/functional/terminal/helpers.lua2
-rw-r--r--test/functional/terminal/highlight_spec.lua2
-rw-r--r--test/functional/terminal/mouse_spec.lua2
-rw-r--r--test/functional/terminal/scrollback_spec.lua2
-rw-r--r--test/functional/terminal/tui_spec.lua2
-rw-r--r--test/functional/terminal/window_spec.lua2
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua2
-rw-r--r--test/functional/ui/bufhl_spec.lua2
-rw-r--r--test/functional/ui/highlight_spec.lua2
-rw-r--r--test/functional/ui/input_spec.lua2
-rw-r--r--test/functional/ui/mouse_spec.lua2
-rw-r--r--test/functional/ui/screen.lua2
-rw-r--r--test/functional/ui/screen_basic_spec.lua2
-rw-r--r--test/functional/ui/searchhl_spec.lua2
-rw-r--r--test/functional/ui/sign_spec.lua2
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua2
-rw-r--r--test/functional/ui/wildmode_spec.lua2
-rw-r--r--test/functional/viml/completion_spec.lua2
-rw-r--r--test/functional/viml/errorlist_spec.lua2
-rw-r--r--test/functional/viml/function_spec.lua2
-rw-r--r--test/helpers.lua60
-rw-r--r--test/unit/helpers.lua13
-rw-r--r--test/unit/os/shell_spec.lua4
353 files changed, 7073 insertions, 4996 deletions
diff --git a/.gitignore b/.gitignore
index ccb2299582..766c323c34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,27 +42,12 @@ tags
# luarocks, not added as a subtree because of the large number of blobs
/third-party/luarocks
-# luajit files
-/third-party/luajit/src/host/buildvm
-/third-party/luajit/src/host/buildvm_arch.h
-/third-party/luajit/src/host/minilua
-/third-party/luajit/src/jit/vmdef.lua
-/third-party/luajit/src/libluajit.a
-/third-party/luajit/src/lj_bcdef.h
-/third-party/luajit/src/lj_ffdef.h
-/third-party/luajit/src/lj_folddef.h
-/third-party/luajit/src/lj_libdef.h
-/third-party/luajit/src/lj_recdef.h
-/third-party/luajit/src/lj_vm.s
-/third-party/luajit/src/luajit
-
# local make targets
local.mk
# runtime/doc
/runtime/doc/*.html
/runtime/doc/tags.ref
-/runtime/doc/doctags
/runtime/doc/errors.log
# clint errors, generated by `make lint`
diff --git a/.travis.yml b/.travis.yml
index 985a5c5381..1158acf076 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,7 @@ env:
# Update PATH for pip and MinGW.
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$HOME/.local/mingw32/bin:$PATH"
# LLVM symbolizer path.
- - LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.6)"
+ - LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.4)"
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
@@ -72,13 +72,13 @@ matrix:
compiler: gcc-5 -m32
env: BUILD_32BIT=ON
- os: linux
- compiler: clang-3.6
- env: GCOV=llvm-cov-3.6 CLANG_SANITIZER=ASAN_UBSAN CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
+ compiler: clang
+ env: GCOV=llvm-cov CLANG_SANITIZER=ASAN_UBSAN CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- os: linux
- compiler: clang-3.6
+ compiler: clang
env: CLANG_SANITIZER=MSAN
- os: linux
- compiler: clang-3.6
+ compiler: clang
env: CLANG_SANITIZER=TSAN
- os: osx
compiler: clang
@@ -103,13 +103,12 @@ addons:
sources:
# TODO: Remove PPA when Travis gets Python >=3.3.
- deadsnakes
- - llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
packages:
- autoconf
- automake
- build-essential
- - clang-3.6
+ - clang-3.4
- cmake
- g++-5-multilib
- g++-multilib
@@ -118,7 +117,7 @@ addons:
- gdb
- libc6-dev-i386
- libtool
- - llvm-3.6-dev
+ - llvm-3.4-dev
- pkg-config
- python3.3-dev
- unzip
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 953e210397..f736508641 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -374,7 +374,7 @@ endforeach()
include(LuaHelpers)
set(LUA_DEPENDENCIES lpeg mpack bit)
if(NOT LUA_PRG)
- foreach(CURRENT_LUA_PRG luajit lua)
+ foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
# If LUA_PRG is set find_program() will not search
unset(LUA_PRG CACHE)
unset(LUA_PRG_WORKS)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1787a4322b..dbc048d939 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,160 +3,96 @@
## Getting started
- Help us review [open pull requests](https://github.com/neovim/neovim/pulls)!
-- Look for [entry-level issues][entry-level] to work on.
- - [Documentation](https://github.com/neovim/neovim/labels/documentation)
- improvements are also much appreciated.
-- Look at [Waffle][waffle] to see who is working on what issues.
-- If needed, refer to [the wiki][wiki-contributing] for guidance.
+ See [Reviewing](#reviewing) for guidelines.
+- Try an [entry-level issue][entry-level] if you are wondering where to start.
+- Or [merge a Vim patch].
## Reporting problems
-Before reporting an issue, see the following wiki articles:
+- Check the [**FAQ**][wiki-faq].
+- Search [existing issues][github-issues] (including closed!)
+- Update Neovim to the latest version to see if your problem persists.
+- If you're using a plugin manager, comment out your plugins, then add them back
+ in one by one, to narrow down the cause of the issue.
+- Crash reports which include a stacktrace are 10x more valuable.
+- [Bisecting][git-bisect] to the cause of a regression often leads to an
+ immediate fix.
+
+## Pull requests ("PRs")
+
+- To avoid duplicate work, you may want to create a `[WIP]` pull request so that
+ others know what you are working on.
+- Avoid cosmetic changes to unrelated files in the same commit: extra noise
+ makes reviews more difficult.
+- Use a [feature branch][git-feature-branch] instead of the master branch.
+- [Rebase your feature branch][git-rebasing] onto (upstream) master before
+ opening the PR.
+- After addressing the review comments, it's fine to rebase and force-push to
+ your review.
+- Try to [tidy your history][git-history-rewriting]: combine related commits
+ with interactive rebasing, separate monolithic commits, etc.
-- [Troubleshooting][wiki-troubleshooting]
-- [Frequently asked questions][wiki-faq]
+### Stages: WIP, RFC
-If your issue isn't mentioned there:
+Pull requests are processed in two stages: _WIP_ (Work In Progress) and _RFC_
+(Request For Comment).
-- Verify that it hasn't already been reported.
-- If not already running the latest version of Neovim, update to it to see if
- your problem persists.
-- If you're experiencing compile or runtime warnings/failures, try searching for
- the error message(s) you received (if any) on [Neovim's issue tracker][github-issues].
-- For runtime issues, try reproducing it using `nvim` with the smallest
- possible `vimrc` (or none at all via `nvim -u NONE`), to rule out bugs in
- plugins you're using. If you're using a plugin manager, comment out your
- plugins, then add them back in one by one.
+- Untagged PRs are assumed to be RFC, meaning the work is ready for review and
+ you would like feedback.
+- Preprend `[WIP]` to the PR title if you are _not_ ready for feedback and the
+ work is still in flux. This saves time and confusion.
-Include as much detail as possible; we generally need to know:
+### Commit messages
-- What operating system you're using.
-- Which version of Neovim you're using. To get this, run `nvim --version` from
- a shell, or run `:version` from inside `nvim`.
-- Whether the bug is present in Vim (not Neovim), and if so which version of
- Vim. It's fine to report Vim bugs on the Neovim bug tracker, but it saves
- everyone time if we know from the start that the bug is not a regression
- caused by Neovim.
-- This isn't required, but what commit introduced the issue for you. You can
- use [`git bisect`][git-bisect] for this.
+Follow [commit message hygiene][hygiene] to *make reviews easier* and to make
+the VCS/git logs more valuable.
-## Submitting contributions
+- Try to keep the first line under 72 characters.
+- **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`,
+ `runtime:`, ...
+ - For commits that contain only style/lint changes, a single-word subject
+ line is preferred: `style` or `lint`.
+- A blank line must separate the subject from the description.
+- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
-- Make it clear in the issue tracker what you are working on.
-- Be descriptive in your pull request description: what is it for, why is it
- needed, etc.
-- Do ***not*** make cosmetic changes to unrelated files in the same pull
- request. This creates noise, making reviews harder to do. If your text
- editor strips all trailing whitespace in a file when you edit it, disable
- it.
+### Automated builds (CI)
-### Tagging in the issue tracker
+Each pull request must pass the automated builds ([travis CI] and [quickbuild]).
-When submitting pull requests (commonly referred to as "PRs"), include one of
-the following tags prepended to the title:
+- CI builds are compiled with [`-Werror`][gcc-warnings], so if your PR
+ introduces any compiler warnings, the build will fail.
+- If any tests fail, the build will fail.
+ See [Building Neovim#running-tests][wiki-run-tests] to run tests locally.
+ Passing locally doesn't guarantee passing the CI build, because of the
+ different compilers and platforms tested against.
+- CI runs [ASan] and other analyzers. To run valgrind locally:
+ `VALGRIND=1 make test`
+- The `lint` build ([#3174][3174]) checks modified lines _and their immediate
+ neighbors_. This is to encourage incrementally updating the legacy style to
+ meet our style guidelines.
+ - A single word (`lint` or `style`) is sufficient as the subject line of
+ a commit that contains only style changes.
+- [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350)
-- `[WIP]` - Work In Progress: the PR will change, so while there is no
- immediate need for review, the submitter still might appreciate it.
-- `[RFC]` - Request For Comment: the PR needs reviewing and/or comments.
-- `[RDY]` - Ready: the PR has been reviewed by at least one other person and
- has no outstanding issues.
+### Coverity
-Assuming the above criteria has been met, feel free to change your PR's tag
-yourself, as opposed to waiting for a contributor to do it for you.
+[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the
+master build. If you want to view the defects, just request access at the
+_Contributor_ level. An Admin will grant you permission.
-### Branching & history
+Use this commit-message format for coverity fixes:
-- Do ***not*** work on your PR on the master branch, [use a feature branch
- instead][git-feature-branch].
-- [Rebase your feature branch onto][git-rebasing] (upstream) master before
- opening the PR.
-- Keep up to date with changes in (upstream) master so your PR is easy to
- merge.
-- [Try to actively tidy your history][git-history-rewriting]: combine related
- commits with interactive rebasing, separate monolithic commits, etc. If your
- PR is still `[WIP]`, feel free to force-push to your feature branch to tidy
- your history.
-
-### For code pull requests
-
-#### Testing
-
-We are unlikely to merge your PR if the Travis build fails:
-
-- Travis builds are compiled with the [`-Werror`][gcc-warnings] flag, so if
- your PR introduces any compiler warnings then the Travis build will fail.
-- If any tests fail, the Travis build will fail.
- See [Building Neovim#running-tests][wiki-building-running-tests] for
- information on running tests locally.
- Tests passing locally doesn't guarantee they'll pass in the Travis
- build, as different compilers and platforms will be used.
-- Travis runs [Valgrind][valgrind] for the GCC/Linux build, but you may also
- do so locally by running the following from a shell: `VALGRIND=1 make test`
-
-#### Coding style
-
-We have a [style guide][style-guide] that all new code should follow.
-However, large portions of the existing Vim codebase violate it to some
-degree, and fixing them would increase merge conflicts and add noise to `git
-blame`.
-
-Weigh those costs when making cosmetic changes. In general, avoid pull
-requests dominated by style changes, but feel free to fix up lines that you
-happen to be modifying anyway. Fix anything that looks outright
-[barbarous](http://www.orwell.ru/library/essays/politics/english/e_polit), but
-otherwise prefer to leave things as they are.
-
-For new code, run `make lint` (which runs [clint.py][clint]) to detect style
-errors. It's not perfect, so some warnings may be false positives/negatives.
-To have `clint.py` ignore certain cases, put `// NOLINT` at the end of the
-line.
-
-We also provide a configuration file for [`clang-format`][clang-format], which
-can be used to format code according to the style guidelines. Be aware that
-this formatting method might need user supervision. To have `clang-format`
-ignore certain line ranges, use the following special comments:
-
-```c
-int formatted_code;
-// clang-format off
- void unformatted_code ;
-// clang-format on
- void formatted_code_again;
-```
-
-### Commit guidelines
-
-The purpose of these guidelines is to *make reviews easier* and make the
-[VCS][vcs] logs more valuable.
+ coverity/<id>: <description of what fixed the defect>
-- Try to keep the first line under 72 characters.
-- If necessary, include further description after a blank line.
- - Don't make the description too verbose by including obvious things, but
- don't spare clarifications for anything that may be not so obvious.
- Some commit messages are pages long, and that's fine if there's no
- better place for those comments to live.
- - **Recommended:** Prefix logically-related commits with a consistent
- identifier in each commit message. For already used identifiers, see the
- commit history for the respective file(s) you're editing.
- [For example](https://github.com/neovim/neovim/commits?author=elmart),
- the following commits are related by task (*Introduce nvim namespace*) and
- sub-task (*Contrib YCM*).
- <br/> `Introduce nvim namespace: Contrib YCM: Fix style issues`
- <br/> `Introduce nvim namespace: Contrib YCM: Fix build dir calculation`
- - Sub-tasks can be *activity-oriented* (doing different things on the same area)
- or *scope-oriented* (doing the same thing in different areas).
- - Granularity helps, but it's conceptual size that matters, not extent size.
-- Use the [imperative voice][imperative]: "Fix bug" rather than "Fixed bug" or "Fixes bug."
-
-### Reviewing pull requests
-
-Using a checklist during reviews is highly recommended, so we [provide one at
-the wiki][wiki-review-checklist]. If you think it could be improved, feel free
-to edit it.
+where `<id>` is the Coverity ID (CID). For example see [#804](https://github.com/neovim/neovim/pull/804).
+
+## Reviewing
+
+To help review pull requests, start with [this checklist][review-checklist].
Reviewing can be done on GitHub, but you may find it easier to do locally.
-Using [`hub`][hub], you can do the following to create a new branch with the
-contents of a pull request, such as [#1820][github-pr-1820]:
+Using [`hub`][hub], you can create a new branch with the contents of a pull
+request, e.g. [#1820][1820]:
hub checkout https://github.com/neovim/neovim/pull/1820
@@ -165,11 +101,7 @@ commits in the feature branch which aren't in the `master` branch; `-p`
shows each commit's diff. To show the whole surrounding function of a change
as context, use the `-W` argument as well.
-You may find it easier to instead use an interactive program for code reviews,
-such as [`tig`][tig].
-[clang-format]: http://clang.llvm.org/docs/ClangFormat.html
-[clint]: clint.py
[entry-level]: https://github.com/neovim/neovim/issues?labels=entry-level&state=open
[gcc-warnings]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
[git-bisect]: http://git-scm.com/book/tr/v2/Git-Tools-Debugging-with-Git
@@ -178,16 +110,15 @@ such as [`tig`][tig].
[git-history-rewriting]: http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
[git-rebasing]: http://git-scm.com/book/en/v2/Git-Branching-Rebasing
[github-issues]: https://github.com/neovim/neovim/issues
-[github-pr-1820]: https://github.com/neovim/neovim/pull/1820
+[1820]: https://github.com/neovim/neovim/pull/1820
[hub]: https://hub.github.com/
-[imperative]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
+[hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style-guide]: http://neovim.io/develop/style-guide.xml
-[tig]: https://github.com/jonas/tig
-[valgrind]: http://valgrind.org/
-[vcs]: https://en.wikipedia.org/wiki/Revision_control
-[waffle]: https://waffle.io/neovim/neovim
-[wiki-building-running-tests]: https://github.com/neovim/neovim/wiki/Building-Neovim#running-tests
-[wiki-contributing]: https://github.com/neovim/neovim/wiki/Contributing
+[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
+[wiki-run-tests]: https://github.com/neovim/neovim/wiki/Building-Neovim#running-tests
[wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ
-[wiki-review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
-[wiki-troubleshooting]: https://github.com/neovim/neovim/wiki/Troubleshooting
+[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
+[3174]: https://github.com/neovim/neovim/issues/3174
+[travis CI]: https://travis-ci.org/neovim/neovim
+[quickbuild]: http://neovim-qb.szakmeister.net/dashboard
+[merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
index d9fd758177..011739396d 100644
--- a/ISSUE_TEMPLATE.md
+++ b/ISSUE_TEMPLATE.md
@@ -1,5 +1,5 @@
-- Neovim version:
-- [ ] Vim behaves differently? Vim version:
+- `nvim --version`:
+- Vim (version: ) behaves differently?
- Operating system/version:
- Terminal name/version:
- `$TERM`:
diff --git a/Makefile b/Makefile
index 9d01347989..552a79466b 100644
--- a/Makefile
+++ b/Makefile
@@ -85,10 +85,10 @@ endif
mkdir -p build
touch $@
-oldtest: | nvim tags
+oldtest: | nvim helptags
+$(SINGLE_MAKE) -C src/nvim/testdir $(MAKEOVERRIDES)
-tags: | nvim
+helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags
functionaltest: | nvim
@@ -119,7 +119,7 @@ install: | nvim
+$(BUILD_CMD) -C build install
clint:
- cmake -DLINT_PRG=./clint.py \
+ cmake -DLINT_PRG=./src/clint.py \
-DLINT_DIR=src \
-DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \
-P cmake/RunLint.cmake
diff --git a/README.md b/README.md
index c6f668c425..63c7dd95d7 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
Neovim is a project that seeks to aggressively refactor Vim in order to:
-- Simplify maintenance and encourage [contributions](https://github.com/neovim/neovim/wiki/Contributing)
+- Simplify maintenance and encourage [contributions](CONTRIBUTING.md)
- Split the work between multiple developers
- Enable the implementation of new/modern user interfaces without any
modifications to the core source
@@ -42,7 +42,7 @@ See the [progress page](https://github.com/neovim/neovim/wiki/Progress) for a co
### What's being worked on now
-- Port all IO to [libuv](https://github.com/libuv/libuv/blob/master/README.md)
+- Port all IO to [libuv](https://github.com/libuv/libuv/)
- Convert legacy tests to Lua tests
- VimL => Lua translator
@@ -51,10 +51,6 @@ See the [progress page](https://github.com/neovim/neovim/wiki/Progress) for a co
There is a formula for OSX/homebrew, a PKGBUILD for Arch Linux, RPM, deb, and
more. See [the wiki](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
-### Contributing
-
-...would be awesome! See [the wiki](https://github.com/neovim/neovim/wiki/Contributing) for more details.
-
### License
Neovim is licensed under the terms of the Apache 2.0 license, except for
diff --git a/neovim.rb b/neovim.rb
deleted file mode 100644
index 859ebdf39d..0000000000
--- a/neovim.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-odie <<-EOS.undent
-
- Whoops, the neovim Homebrew Formula has moved! Please instead run:
-
- brew tap neovim/homebrew-neovim
- brew install --HEAD neovim
-
- Thanks!
-EOS
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index cad8da6ffb..4dbd193dab 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -31,7 +31,7 @@ add_custom_command(OUTPUT copy_docfiles
${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc
)
-add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
+add_custom_target(helptags
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
-u NONE
-i NONE
@@ -45,6 +45,18 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
)
+add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
+ DEPENDS
+ helptags
+)
+
+add_custom_target(doc_html
+ COMMAND make html
+ DEPENDS
+ ${GENERATED_HELP_TAGS}
+ WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
+)
+
add_custom_target(
runtime ALL
DEPENDS
diff --git a/runtime/autoload/csscomplete.vim b/runtime/autoload/csscomplete.vim
index 9eebb87d5b..50048a37fd 100644
--- a/runtime/autoload/csscomplete.vim
+++ b/runtime/autoload/csscomplete.vim
@@ -1,429 +1,740 @@
" Vim completion script
-" Language: CSS 2.1
-" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2007 May 5
+" Language: CSS
+" Based on MDN CSS Reference at 2016 Jan <https://developer.mozilla.org/en-US/docs/Web/CSS/Reference>
+" plus CSS Speech Module <http://www.w3.org/TR/css3-speech/>
+" Maintainer: Kao, Wei-Ko(othree) ( othree AT gmail DOT com )
+" Original Author: Mikolaj Machowski ( mikmach AT wp DOT pl )
+" Last Change: 2016 Jan 11
- let s:values = split("azimuth background background-attachment background-color background-image background-position background-repeat border bottom border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor display direction elevation empty-cells float font font-family font-size font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-right margin-left margin-top margin-bottom max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-top padding-right padding-bottom padding-left page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes right richness speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-indent text-transform top unicode-bidi vertical-align visibility voice-family volume white-space width widows word-spacing z-index")
+let s:values = split("all additive-symbols align-content align-items align-self animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size block-size border border-block-end border-block-end-color border-block-end-style border-block-end-width border-block-start border-block-start-color border-block-start-style border-block-start-width border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-inline-end border-inline-end-color border-inline-end-style border-inline-end-width border-inline-start border-inline-start-color border-inline-start-style border-inline-start-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip clip-path color columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width content counter-increment counter-reset cue cue-before cue-after cursor direction display empty-cells fallback filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position grid-auto-rows grid-column grid-column-start grid-column-end grid-row grid-row-start grid-row-end grid-template grid-template-areas grid-template-rows grid-template-columns height hyphens image-rendering image-resolution image-orientation ime-mode inline-size isolation justify-content left letter-spacing line-break line-height list-style list-style-image list-style-position list-style-type margin margin-block-end margin-block-start margin-bottom margin-inline-end margin-inline-start margin-left margin-right margin-top marks mask mask-type max-block-size max-height max-inline-size max-width max-zoom min-block-size min-height min-inline-size min-width min-zoom mix-blend-mode negative object-fit object-position offset-block-end offset-block-start offset-inline-end offset-inline-start opacity order orientation orphans outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y pad padding padding-block-end padding-block-start padding-bottom padding-inline-end padding-inline-start padding-left padding-right padding-top page-break-after page-break-before page-break-inside pause-before pause-after pause perspective perspective-origin pointer-events position prefix quotes range resize rest rest-before rest-after right ruby-align ruby-merge ruby-position scroll-behavior scroll-snap-coordinate scroll-snap-destination scroll-snap-points-x scroll-snap-points-y scroll-snap-type scroll-snap-type-x scroll-snap-type-y shape-image-threshold shape-margin shape-outside speak speak-as suffix symbols system table-layout tab-size text-align text-align-last text-combine-upright text-decoration text-decoration-color text-decoration-line text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-orientation text-overflow text-rendering text-shadow text-transform text-underline-position top touch-action transform transform-box transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi unicode-range user-zoom vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-rate voice-range voice-stress voice-volume white-space widows width will-change word-break word-spacing word-wrap writing-mode z-index zoom")
-function! csscomplete#CompleteCSS(findstart, base)
-
-if a:findstart
- " We need whole line to proper checking
- let line = getline('.')
- let start = col('.') - 1
- let compl_begin = col('.') - 2
- while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
- let start -= 1
- endwhile
- let b:compl_context = line[0:compl_begin]
- return start
-endif
-
-" There are few chars important for context:
-" ^ ; : { } /* */
-" Where ^ is start of line and /* */ are comment borders
-" Depending on their relative position to cursor we will know what should
-" be completed.
-" 1. if nearest are ^ or { or ; current word is property
-" 2. if : it is value (with exception of pseudo things)
-" 3. if } we are outside of css definitions
-" 4. for comments ignoring is be the easiest but assume they are the same
-" as 1.
-" 5. if @ complete at-rule
-" 6. if ! complete important
-if exists("b:compl_context")
- let line = b:compl_context
- unlet! b:compl_context
-else
- let line = a:base
-endif
-
-let res = []
-let res2 = []
-let borders = {}
-
-" Check last occurrence of sequence
-
-let openbrace = strridx(line, '{')
-let closebrace = strridx(line, '}')
-let colon = strridx(line, ':')
-let semicolon = strridx(line, ';')
-let opencomm = strridx(line, '/*')
-let closecomm = strridx(line, '*/')
-let style = strridx(line, 'style\s*=')
-let atrule = strridx(line, '@')
-let exclam = strridx(line, '!')
-
-if openbrace > -1
- let borders[openbrace] = "openbrace"
-endif
-if closebrace > -1
- let borders[closebrace] = "closebrace"
-endif
-if colon > -1
- let borders[colon] = "colon"
-endif
-if semicolon > -1
- let borders[semicolon] = "semicolon"
-endif
-if opencomm > -1
- let borders[opencomm] = "opencomm"
-endif
-if closecomm > -1
- let borders[closecomm] = "closecomm"
-endif
-if style > -1
- let borders[style] = "style"
-endif
-if atrule > -1
- let borders[atrule] = "atrule"
-endif
-if exclam > -1
- let borders[exclam] = "exclam"
-endif
-
-
-if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
- " Complete properties
-
-
- let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
-
- for m in s:values
- if m =~? '^'.entered_property
- call add(res, m . ':')
- elseif m =~? entered_property
- call add(res2, m . ':')
- endif
- endfor
-
- return res + res2
-
-elseif borders[max(keys(borders))] == 'colon'
- " Get name of property
- let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$'))
-
- if prop == 'azimuth'
- let values = ["left-side", "far-left", "left", "center-left", "center", "center-right", "right", "far-right", "right-side", "behind", "leftwards", "rightwards"]
- elseif prop == 'background-attachment'
- let values = ["scroll", "fixed"]
- elseif prop == 'background-color'
- let values = ["transparent", "rgb(", "#"]
- elseif prop == 'background-image'
- let values = ["url(", "none"]
- elseif prop == 'background-position'
- let vals = matchstr(line, '.*:\s*\zs.*')
- if vals =~ '^\%([a-zA-Z]\+\)\?$'
- let values = ["top", "center", "bottom"]
- elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
- let values = ["left", "center", "right"]
- else
- return []
- endif
- elseif prop == 'background-repeat'
- let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"]
- elseif prop == 'background'
- let values = ["url(", "scroll", "fixed", "transparent", "rgb(", "#", "none", "top", "center", "bottom" , "left", "right", "repeat", "repeat-x", "repeat-y", "no-repeat"]
- elseif prop == 'border-collapse'
- let values = ["collapse", "separate"]
- elseif prop == 'border-color'
- let values = ["rgb(", "#", "transparent"]
- elseif prop == 'border-spacing'
- return []
- elseif prop == 'border-style'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif prop =~ 'border-\%(top\|right\|bottom\|left\)$'
- let vals = matchstr(line, '.*:\s*\zs.*')
- if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
- let values = ["thin", "thick", "medium"]
- elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
- let values = ["rgb(", "#", "transparent"]
- else
- return []
- endif
- elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-color'
- let values = ["rgb(", "#", "transparent"]
- elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-style'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif prop =~ 'border-\%(top\|right\|bottom\|left\)-width'
- let values = ["thin", "thick", "medium"]
- elseif prop == 'border-width'
- let values = ["thin", "thick", "medium"]
- elseif prop == 'border'
- let vals = matchstr(line, '.*:\s*\zs.*')
- if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
- let values = ["thin", "thick", "medium"]
- elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
- let values = ["rgb(", "#", "transparent"]
- else
- return []
- endif
- elseif prop == 'bottom'
- let values = ["auto"]
- elseif prop == 'caption-side'
- let values = ["top", "bottom"]
- elseif prop == 'clear'
- let values = ["none", "left", "right", "both"]
- elseif prop == 'clip'
- let values = ["auto", "rect("]
- elseif prop == 'color'
- let values = ["rgb(", "#"]
- elseif prop == 'content'
- let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"]
- elseif prop =~ 'counter-\%(increment\|reset\)$'
- let values = ["none"]
- elseif prop =~ '^\%(cue-after\|cue-before\|cue\)$'
- let values = ["url(", "none"]
- elseif prop == 'cursor'
- let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"]
- elseif prop == 'direction'
- let values = ["ltr", "rtl"]
- elseif prop == 'display'
- let values = ["inline", "block", "list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none"]
- elseif prop == 'elevation'
- let values = ["below", "level", "above", "higher", "lower"]
- elseif prop == 'empty-cells'
- let values = ["show", "hide"]
- elseif prop == 'float'
- let values = ["left", "right", "none"]
- elseif prop == 'font-family'
- let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
- elseif prop == 'font-size'
- let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
- elseif prop == 'font-style'
- let values = ["normal", "italic", "oblique"]
- elseif prop == 'font-variant'
- let values = ["normal", "small-caps"]
- elseif prop == 'font-weight'
- let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
- elseif prop == 'font'
- let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"]
- elseif prop =~ '^\%(height\|width\)$'
- let values = ["auto"]
- elseif prop =~ '^\%(left\|rigth\)$'
- let values = ["auto"]
- elseif prop == 'letter-spacing'
- let values = ["normal"]
- elseif prop == 'line-height'
- let values = ["normal"]
- elseif prop == 'list-style-image'
- let values = ["url(", "none"]
- elseif prop == 'list-style-position'
- let values = ["inside", "outside"]
- elseif prop == 'list-style-type'
- let values = ["disc", "circle", "square", "decimal", "decimal-leading-zero", "lower-roman", "upper-roman", "lower-latin", "upper-latin", "none"]
- elseif prop == 'list-style'
- return []
- elseif prop == 'margin'
- let values = ["auto"]
- elseif prop =~ 'margin-\%(right\|left\|top\|bottom\)$'
- let values = ["auto"]
- elseif prop == 'max-height'
- let values = ["auto"]
- elseif prop == 'max-width'
- let values = ["none"]
- elseif prop == 'min-height'
- let values = ["none"]
- elseif prop == 'min-width'
- let values = ["none"]
- elseif prop == 'orphans'
- return []
- elseif prop == 'outline-color'
- let values = ["rgb(", "#"]
- elseif prop == 'outline-style'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif prop == 'outline-width'
- let values = ["thin", "thick", "medium"]
- elseif prop == 'outline'
- let vals = matchstr(line, '.*:\s*\zs.*')
- if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$'
- let values = ["rgb(", "#"]
- elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$'
- let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
- elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
- let values = ["thin", "thick", "medium"]
- else
- return []
- endif
- elseif prop == 'overflow'
- let values = ["visible", "hidden", "scroll", "auto"]
- elseif prop == 'padding'
- return []
- elseif prop =~ 'padding-\%(top\|right\|bottom\|left\)$'
- return []
- elseif prop =~ 'page-break-\%(after\|before\)$'
- let values = ["auto", "always", "avoid", "left", "right"]
- elseif prop == 'page-break-inside'
- let values = ["auto", "avoid"]
- elseif prop =~ 'pause-\%(after\|before\)$'
- return []
- elseif prop == 'pause'
- return []
- elseif prop == 'pitch-range'
- return []
- elseif prop == 'pitch'
- let values = ["x-low", "low", "medium", "high", "x-high"]
- elseif prop == 'play-during'
- let values = ["url(", "mix", "repeat", "auto", "none"]
- elseif prop == 'position'
- let values = ["static", "relative", "absolute", "fixed"]
- elseif prop == 'quotes'
- let values = ["none"]
- elseif prop == 'richness'
- return []
- elseif prop == 'speak-header'
- let values = ["once", "always"]
- elseif prop == 'speak-numeral'
- let values = ["digits", "continuous"]
- elseif prop == 'speak-punctuation'
- let values = ["code", "none"]
- elseif prop == 'speak'
- let values = ["normal", "none", "spell-out"]
- elseif prop == 'speech-rate'
- let values = ["x-slow", "slow", "medium", "fast", "x-fast", "faster", "slower"]
- elseif prop == 'stress'
- return []
- elseif prop == 'table-layout'
- let values = ["auto", "fixed"]
- elseif prop == 'text-align'
- let values = ["left", "right", "center", "justify"]
- elseif prop == 'text-decoration'
- let values = ["none", "underline", "overline", "line-through", "blink"]
- elseif prop == 'text-indent'
- return []
- elseif prop == 'text-transform'
- let values = ["capitalize", "uppercase", "lowercase", "none"]
- elseif prop == 'top'
- let values = ["auto"]
- elseif prop == 'unicode-bidi'
- let values = ["normal", "embed", "bidi-override"]
- elseif prop == 'vertical-align'
- let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"]
- elseif prop == 'visibility'
- let values = ["visible", "hidden", "collapse"]
- elseif prop == 'voice-family'
- return []
- elseif prop == 'volume'
- let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"]
- elseif prop == 'white-space'
- let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
- elseif prop == 'widows'
- return []
- elseif prop == 'word-spacing'
- let values = ["normal"]
- elseif prop == 'z-index'
- let values = ["auto"]
- else
- " If no property match it is possible we are outside of {} and
- " trying to complete pseudo-(class|element)
- let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$'))
- if stridx(',a,abbr,acronym,address,area,b,base,bdo,big,blockquote,body,br,button,caption,cite,code,col,colgroup,dd,del,dfn,div,dl,dt,em,fieldset,form,head,h1,h2,h3,h4,h5,h6,hr,html,i,img,input,ins,kbd,label,legend,li,link,map,meta,noscript,object,ol,optgroup,option,p,param,pre,q,samp,script,select,small,span,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,ul,var,', ','.element.',') > -1
- let values = ["first-child", "link", "visited", "hover", "active", "focus", "lang", "first-line", "first-letter", "before", "after"]
- else
- return []
- endif
- endif
-
- " Complete values
- let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
-
- for m in values
- if m =~? '^'.entered_value
- call add(res, m)
- elseif m =~? entered_value
- call add(res2, m)
- endif
- endfor
-
- return res + res2
-
-elseif borders[max(keys(borders))] == 'closebrace'
-
- return []
-
-elseif borders[max(keys(borders))] == 'exclam'
-
- " Complete values
- let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
-
- let values = ["important"]
-
- for m in values
- if m =~? '^'.entered_imp
- call add(res, m)
- endif
- endfor
-
- return res
-
-elseif borders[max(keys(borders))] == 'atrule'
-
- let afterat = matchstr(line, '.*@\zs.*')
-
- if afterat =~ '\s'
-
- let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze')
-
- if atrulename == 'media'
- let values = ["screen", "tty", "tv", "projection", "handheld", "print", "braille", "aural", "all"]
-
- let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$')
-
- elseif atrulename == 'import'
- let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$')
-
- if entered_atruleafter =~ "^[\"']"
- let filestart = matchstr(entered_atruleafter, '^.\zs.*')
- let files = split(glob(filestart.'*'), '\n')
- let values = map(copy(files), '"\"".v:val')
-
- elseif entered_atruleafter =~ "^url("
- let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
- let files = split(glob(filestart.'*'), '\n')
- let values = map(copy(files), '"url(".v:val')
-
- else
- let values = ['"', 'url(']
-
- endif
-
- else
- return []
-
- endif
-
- for m in values
- if m =~? '^'.entered_atruleafter
- call add(res, m)
- elseif m =~? entered_atruleafter
- call add(res2, m)
- endif
- endfor
-
- return res + res2
-
- endif
-
- let values = ["charset", "page", "media", "import", "font-face"]
- let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
-
- for m in values
- if m =~? '^'.entered_atrule
- call add(res, m .' ')
- elseif m =~? entered_atrule
- call add(res2, m .' ')
- endif
- endfor
-
- return res + res2
-
-endif
+function! csscomplete#CompleteCSS(findstart, base)
-return []
+ if a:findstart
+ " We need whole line to proper checking
+ let line = getline('.')
+ let start = col('.') - 1
+ let compl_begin = col('.') - 2
+ while start >= 0 && line[start - 1] =~ '\%(\k\|-\)'
+ let start -= 1
+ endwhile
+ let b:after = line[compl_begin :]
+ let b:compl_context = line[0:compl_begin]
+ return start
+ endif
+
+ " There are few chars important for context:
+ " ^ ; : { } /* */
+ " Where ^ is start of line and /* */ are comment borders
+ " Depending on their relative position to cursor we will know what should
+ " be completed.
+ " 1. if nearest are ^ or { or ; current word is property
+ " 2. if : it is value (with exception of pseudo things)
+ " 3. if } we are outside of css definitions
+ " 4. for comments ignoring is be the easiest but assume they are the same
+ " as 1.
+ " 5. if @ complete at-rule
+ " 6. if ! complete important
+ if exists("b:compl_context")
+ let line = b:compl_context
+ let after = b:after
+ unlet! b:compl_context
+ else
+ let line = a:base
+ endif
+
+ let res = []
+ let res2 = []
+ let borders = {}
+
+ " Check last occurrence of sequence
+
+ let openbrace = strridx(line, '{')
+ let closebrace = strridx(line, '}')
+ let colon = strridx(line, ':')
+ let semicolon = strridx(line, ';')
+ let opencomm = strridx(line, '/*')
+ let closecomm = strridx(line, '*/')
+ let style = strridx(line, 'style\s*=')
+ let atrule = strridx(line, '@')
+ let exclam = strridx(line, '!')
+
+ if openbrace > -1
+ let borders[openbrace] = "openbrace"
+ endif
+ if closebrace > -1
+ let borders[closebrace] = "closebrace"
+ endif
+ if colon > -1
+ let borders[colon] = "colon"
+ endif
+ if semicolon > -1
+ let borders[semicolon] = "semicolon"
+ endif
+ if opencomm > -1
+ let borders[opencomm] = "opencomm"
+ endif
+ if closecomm > -1
+ let borders[closecomm] = "closecomm"
+ endif
+ if style > -1
+ let borders[style] = "style"
+ endif
+ if atrule > -1
+ let borders[atrule] = "atrule"
+ endif
+ if exclam > -1
+ let borders[exclam] = "exclam"
+ endif
+
+
+ if len(borders) == 0 || borders[max(keys(borders))] =~ '^\%(openbrace\|semicolon\|opencomm\|closecomm\|style\)$'
+ " Complete properties
+
+
+ let entered_property = matchstr(line, '.\{-}\zs[a-zA-Z-]*$')
+
+ for m in s:values
+ if m =~? '^'.entered_property
+ call add(res, m . ':')
+ elseif m =~? entered_property
+ call add(res2, m . ':')
+ endif
+ endfor
+
+ return res + res2
+
+ elseif borders[max(keys(borders))] == 'colon'
+ " Get name of property
+ let prop = tolower(matchstr(line, '\zs[a-zA-Z-]*\ze\s*:[^:]\{-}$'))
+
+ let wide_keywords = ["initial", "inherit", "unset"]
+ let color_values = ["transparent", "rgb(", "rgba(", "hsl(", "hsla(", "#"]
+ let border_style_values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
+ let border_width_values = ["thin", "thick", "medium"]
+ let list_style_type_values = ["decimal", "decimal-leading-zero", "arabic-indic", "armenian", "upper-armenian", "lower-armenian", "bengali", "cambodian", "khmer", "cjk-decimal", "devanagari", "georgian", "gujarati", "gurmukhi", "hebrew", "kannada", "lao", "malayalam", "mongolian", "myanmar", "oriya", "persian", "lower-roman", "upper-roman", "tamil", "telugu", "thai", "tibetan", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "cjk-earthly-branch", "cjk-heavenly-stem", "lower-greek", "hiragana", "hiragana-iroha", "katakana", "katakana-iroha", "disc", "circle", "square", "disclosure-open", "disclosure-closed"]
+ let timing_functions = ["cubic-bezier(", "steps(", "linear", "ease", "ease-in", "ease-in-out", "ease-out", "step-start", "step-end"]
+
+ if prop == 'all'
+ let values = []
+ elseif prop == 'additive-symbols'
+ let values = []
+ elseif prop == 'align-content'
+ let values = ["flex-start", "flex-end", "center", "space-between", "space-around", "stretch"]
+ elseif prop == 'align-items'
+ let values = ["flex-start", "flex-end", "center", "baseline", "stretch"]
+ elseif prop == 'align-self'
+ let values = ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"]
+ elseif prop == 'animation'
+ let values = timing_functions + ["normal", "reverse", "alternate", "alternate-reverse"] + ["none", "forwards", "backwards", "both"] + ["running", "paused"]
+ elseif prop == 'animation-delay'
+ let values = []
+ elseif prop == 'animation-direction'
+ let values = ["normal", "reverse", "alternate", "alternate-reverse"]
+ elseif prop == 'animation-duration'
+ let values = []
+ elseif prop == 'animation-fill-mode'
+ let values = ["none", "forwards", "backwards", "both"]
+ elseif prop == 'animation-iteration-count'
+ let values = []
+ elseif prop == 'animation-name'
+ let values = []
+ elseif prop == 'animation-play-state'
+ let values = ["running", "paused"]
+ elseif prop == 'animation-timing-function'
+ let values = timing_functions
+ elseif prop == 'background-attachment'
+ let values = ["scroll", "fixed"]
+ elseif prop == 'background-color'
+ let values = color_values
+ elseif prop == 'background-image'
+ let values = ["url(", "none"]
+ elseif prop == 'background-position'
+ let vals = matchstr(line, '.*:\s*\zs.*')
+ if vals =~ '^\%([a-zA-Z]\+\)\?$'
+ let values = ["top", "center", "bottom"]
+ elseif vals =~ '^[a-zA-Z]\+\s\+\%([a-zA-Z]\+\)\?$'
+ let values = ["left", "center", "right"]
+ else
+ return []
+ endif
+ elseif prop == 'background-repeat'
+ let values = ["repeat", "repeat-x", "repeat-y", "no-repeat"]
+ elseif prop == 'background-size'
+ let values = ["auto", "contain", "cover"]
+ elseif prop == 'background'
+ let values = ["scroll", "fixed"] + color_values + ["url(", "none"] + ["top", "center", "bottom", "left", "right"] + ["repeat", "repeat-x", "repeat-y", "no-repeat"] + ["auto", "contain", "cover"]
+ elseif prop =~ 'border\%(-top\|-right\|-bottom\|-left\|-block-start\|-block-end\)\?$'
+ let vals = matchstr(line, '.*:\s*\zs.*')
+ if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
+ let values = border_width_values
+ elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
+ let values = border_style_values
+ elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
+ let values = color_values
+ else
+ return []
+ endif
+ elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-color'
+ let values = color_values
+ elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-style'
+ let values = border_style_values
+ elseif prop =~ 'border-\%(top\|right\|bottom\|left\|block-start\|block-end\)-width'
+ let values = border_width_values
+ elseif prop == 'border-color'
+ let values = color_values
+ elseif prop == 'border-style'
+ let values = border_style_values
+ elseif prop == 'border-width'
+ let values = border_width_values
+ elseif prop == 'bottom'
+ let values = ["auto"]
+ elseif prop == 'box-decoration-break'
+ let values = ["slice", "clone"]
+ elseif prop == 'box-shadow'
+ let values = ["inset"]
+ elseif prop == 'box-sizing'
+ let values = ["border-box", "content-box"]
+ elseif prop =~ 'break-\%(before\|after\)'
+ let values = ["auto", "always", "avoid", "left", "right", "page", "column", "region", "recto", "verso", "avoid-page", "avoid-column", "avoid-region"]
+ elseif prop == 'break-inside'
+ let values = ["auto", "avoid", "avoid-page", "avoid-column", "avoid-region"]
+ elseif prop == 'caption-side'
+ let values = ["top", "bottom"]
+ elseif prop == 'clear'
+ let values = ["none", "left", "right", "both"]
+ elseif prop == 'clip'
+ let values = ["auto", "rect("]
+ elseif prop == 'clip-path'
+ let values = ["fill-box", "stroke-box", "view-box", "none"]
+ elseif prop == 'color'
+ let values = color_values
+ elseif prop == 'columns'
+ let values = []
+ elseif prop == 'column-count'
+ let values = ['auto']
+ elseif prop == 'column-fill'
+ let values = ['auto', 'balance']
+ elseif prop == 'column-rule-color'
+ let values = color_values
+ elseif prop == 'column-rule-style'
+ let values = border_style_values
+ elseif prop == 'column-rule-width'
+ let values = border_width_values
+ elseif prop == 'column-rule'
+ let vals = matchstr(line, '.*:\s*\zs.*')
+ if vals =~ '^\%([a-zA-Z0-9.]\+\)\?$'
+ let values = border_width_values
+ elseif vals =~ '^[a-zA-Z0-9.]\+\s\+\%([a-zA-Z]\+\)\?$'
+ let values = border_style_values
+ elseif vals =~ '^[a-zA-Z0-9.]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
+ let values = color_values
+ else
+ return []
+ endif
+ elseif prop == 'column-span'
+ let values = ["none", "all"]
+ elseif prop == 'column-width'
+ let values = ["auto"]
+ elseif prop == 'content'
+ let values = ["normal", "attr(", "open-quote", "close-quote", "no-open-quote", "no-close-quote"]
+ elseif prop =~ 'counter-\%(increment\|reset\)$'
+ let values = ["none"]
+ elseif prop =~ 'cue\%(-after\|-before\)\=$'
+ let values = ["url("]
+ elseif prop == 'cursor'
+ let values = ["url(", "auto", "crosshair", "default", "pointer", "move", "e-resize", "ne-resize", "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "text", "wait", "help", "progress"]
+ elseif prop == 'direction'
+ let values = ["ltr", "rtl"]
+ elseif prop == 'display'
+ let values = ["inline", "block", "list-item", "inline-list-item", "run-in", "inline-block", "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", "table-column", "table-cell", "table-caption", "none", "flex", "inline-flex", "grid", "inline-grid", "ruby", "ruby-base", "ruby-text", "ruby-base-container", "ruby-text-container", "contents"]
+ elseif prop == 'elevation'
+ let values = ["below", "level", "above", "higher", "lower"]
+ elseif prop == 'empty-cells'
+ let values = ["show", "hide"]
+ elseif prop == 'fallback'
+ let values = list_style_type_values
+ elseif prop == 'filter'
+ let values = ["blur(", "brightness(", "contrast(", "drop-shadow(", "grayscale(", "hue-rotate(", "invert(", "opacity(", "sepia(", "saturate("]
+ elseif prop == 'flex-basis'
+ let values = ["auto", "content"]
+ elseif prop == 'flex-flow'
+ let values = ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"]
+ elseif prop == 'flex-grow'
+ let values = []
+ elseif prop == 'flex-shrink'
+ let values = []
+ elseif prop == 'flex-wrap'
+ let values = ["nowrap", "wrap", "wrap-reverse"]
+ elseif prop == 'flex'
+ let values = ["nowrap", "wrap", "wrap-reverse"] + ["row", "row-reverse", "column", "column-reverse", "nowrap", "wrap", "wrap-reverse"] + ["auto", "content"]
+ elseif prop == 'float'
+ let values = ["left", "right", "none"]
+ elseif prop == 'font-family'
+ let values = ["sans-serif", "serif", "monospace", "cursive", "fantasy"]
+ elseif prop == 'font-feature-settings'
+ let values = ["normal", '"aalt"', '"abvf"', '"abvm"', '"abvs"', '"afrc"', '"akhn"', '"blwf"', '"blwm"', '"blws"', '"calt"', '"case"', '"ccmp"', '"cfar"', '"cjct"', '"clig"', '"cpct"', '"cpsp"', '"cswh"', '"curs"', '"cv', '"c2pc"', '"c2sc"', '"dist"', '"dlig"', '"dnom"', '"dtls"', '"expt"', '"falt"', '"fin2"', '"fin3"', '"fina"', '"flac"', '"frac"', '"fwid"', '"half"', '"haln"', '"halt"', '"hist"', '"hkna"', '"hlig"', '"hngl"', '"hojo"', '"hwid"', '"init"', '"isol"', '"ital"', '"jalt"', '"jp78"', '"jp83"', '"jp90"', '"jp04"', '"kern"', '"lfbd"', '"liga"', '"ljmo"', '"lnum"', '"locl"', '"ltra"', '"ltrm"', '"mark"', '"med2"', '"medi"', '"mgrk"', '"mkmk"', '"mset"', '"nalt"', '"nlck"', '"nukt"', '"numr"', '"onum"', '"opbd"', '"ordn"', '"ornm"', '"palt"', '"pcap"', '"pkna"', '"pnum"', '"pref"', '"pres"', '"pstf"', '"psts"', '"pwid"', '"qwid"', '"rand"', '"rclt"', '"rkrf"', '"rlig"', '"rphf"', '"rtbd"', '"rtla"', '"rtlm"', '"ruby"', '"salt"', '"sinf"', '"size"', '"smcp"', '"smpl"', '"ss01"', '"ss02"', '"ss03"', '"ss04"', '"ss05"', '"ss06"', '"ss07"', '"ss08"', '"ss09"', '"ss10"', '"ss11"', '"ss12"', '"ss13"', '"ss14"', '"ss15"', '"ss16"', '"ss17"', '"ss18"', '"ss19"', '"ss20"', '"ssty"', '"stch"', '"subs"', '"sups"', '"swsh"', '"titl"', '"tjmo"', '"tnam"', '"tnum"', '"trad"', '"twid"', '"unic"', '"valt"', '"vatu"', '"vert"', '"vhal"', '"vjmo"', '"vkna"', '"vkrn"', '"vpal"', '"vrt2"', '"zero"']
+ elseif prop == 'font-kerning'
+ let values = ["auto", "normal", "none"]
+ elseif prop == 'font-language-override'
+ let values = ["normal"]
+ elseif prop == 'font-size'
+ let values = ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller"]
+ elseif prop == 'font-size-adjust'
+ let values = []
+ elseif prop == 'font-stretch'
+ let values = ["normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"]
+ elseif prop == 'font-style'
+ let values = ["normal", "italic", "oblique"]
+ elseif prop == 'font-synthesis'
+ let values = ["none", "weight", "style"]
+ elseif prop == 'font-variant-alternates'
+ let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("]
+ elseif prop == 'font-variant-caps'
+ let values = ["normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"]
+ elseif prop == 'font-variant-asian'
+ let values = ["normal", "ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"]
+ elseif prop == 'font-variant-ligatures'
+ let values = ["normal", "none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"]
+ elseif prop == 'font-variant-numeric'
+ let values = ["normal", "ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"]
+ elseif prop == 'font-variant-position'
+ let values = ["normal", "sub", "super"]
+ elseif prop == 'font-variant'
+ let values = ["normal", "historical-forms", "stylistic(", "styleset(", "character-variant(", "swash(", "ornaments(", "annotation("] + ["small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"] + ["ruby", "jis78", "jis83", "jis90", "jis04", "simplified", "traditional"] + ["none", "common-ligatures", "no-common-ligatures", "discretionary-ligatures", "no-discretionary-ligatures", "historical-ligatures", "no-historical-ligatures", "contextual", "no-contextual"] + ["ordinal", "slashed-zero", "lining-nums", "oldstyle-nums", "proportional-nums", "tabular-nums", "diagonal-fractions", "stacked-fractions"] + ["sub", "super"]
+ elseif prop == 'font-weight'
+ let values = ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"]
+ elseif prop == 'font'
+ let values = ["normal", "italic", "oblique", "small-caps", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "larger", "smaller", "sans-serif", "serif", "monospace", "cursive", "fantasy", "caption", "icon", "menu", "message-box", "small-caption", "status-bar"]
+ elseif prop =~ '^\%(height\|width\)$'
+ let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
+ elseif prop =~ '^\%(left\|rigth\)$'
+ let values = ["auto"]
+ elseif prop == 'image-rendering'
+ let values = ["auto", "crisp-edges", "pixelated"]
+ elseif prop == 'image-orientation'
+ let values = ["from-image", "flip"]
+ elseif prop == 'ime-mode'
+ let values = ["auto", "normal", "active", "inactive", "disabled"]
+ elseif prop == 'inline-size'
+ let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
+ elseif prop == 'isolation'
+ let values = ["auto", "isolate"]
+ elseif prop == 'justify-content'
+ let values = ["flex-start", "flex-end", "center", "space-between", "space-around"]
+ elseif prop == 'letter-spacing'
+ let values = ["normal"]
+ elseif prop == 'line-break'
+ let values = ["auto", "loose", "normal", "strict"]
+ elseif prop == 'line-height'
+ let values = ["normal"]
+ elseif prop == 'list-style-image'
+ let values = ["url(", "none"]
+ elseif prop == 'list-style-position'
+ let values = ["inside", "outside"]
+ elseif prop == 'list-style-type'
+ let values = list_style_type_values
+ elseif prop == 'list-style'
+ let values = list_style_type_values + ["inside", "outside"] + ["url(", "none"]
+ elseif prop == 'margin'
+ let values = ["auto"]
+ elseif prop =~ 'margin-\%(right\|left\|top\|bottom\|block-start\|block-end\|inline-start\|inline-end\)$'
+ let values = ["auto"]
+ elseif prop == 'marks'
+ let values = ["crop", "cross", "none"]
+ elseif prop == 'mask'
+ let values = ["url("]
+ elseif prop == 'mask-type'
+ let values = ["luminance", "alpha"]
+ elseif prop == '\%(max\|min\)-\%(block\|inline\)-size'
+ let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
+ elseif prop == '\%(max\|min\)-\%(height\|width\)'
+ let values = ["auto", "border-box", "content-box", "max-content", "min-content", "available", "fit-content"]
+ elseif prop == '\%(max\|min\)-zoom'
+ let values = ["auto"]
+ elseif prop == 'mix-blend-mode'
+ let values = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]
+ elseif prop == 'opacity'
+ let values = []
+ elseif prop == 'orientation'
+ let values = ["auto", "portrait", "landscape"]
+ elseif prop == 'orphans'
+ let values = []
+ elseif prop == 'outline-offset'
+ let values = []
+ elseif prop == 'outline-color'
+ let values = color_values
+ elseif prop == 'outline-style'
+ let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
+ elseif prop == 'outline-width'
+ let values = ["thin", "thick", "medium"]
+ elseif prop == 'outline'
+ let vals = matchstr(line, '.*:\s*\zs.*')
+ if vals =~ '^\%([a-zA-Z0-9,()#]\+\)\?$'
+ let values = color_values
+ elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+\%([a-zA-Z]\+\)\?$'
+ let values = ["none", "hidden", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"]
+ elseif vals =~ '^[a-zA-Z0-9,()#]\+\s\+[a-zA-Z]\+\s\+\%([a-zA-Z(]\+\)\?$'
+ let values = ["thin", "thick", "medium"]
+ else
+ return []
+ endif
+ elseif prop == 'overflow-wrap'
+ let values = ["normal", "break-word"]
+ elseif prop =~ 'overflow\%(-x\|-y\)\='
+ let values = ["visible", "hidden", "scroll", "auto"]
+ elseif prop == 'pad'
+ let values = []
+ elseif prop == 'padding'
+ let values = []
+ elseif prop =~ 'padding-\%(top\|right\|bottom\|left\|inline-start\|inline-end\|block-start\|block-end\)$'
+ let values = []
+ elseif prop =~ 'page-break-\%(after\|before\)$'
+ let values = ["auto", "always", "avoid", "left", "right", "recto", "verso"]
+ elseif prop == 'page-break-inside'
+ let values = ["auto", "avoid"]
+ elseif prop =~ 'pause\%(-after\|-before\)\=$'
+ let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
+ elseif prop == 'perspective'
+ let values = ["none"]
+ elseif prop == 'perspective-origin'
+ let values = ["top", "bottom", "left", "center", " right"]
+ elseif prop == 'pointer-events'
+ let values = ["auto", "none", "visiblePainted", "visibleFill", "visibleStroke", "visible", "painted", "fill", "stroke", "all"]
+ elseif prop == 'position'
+ let values = ["static", "relative", "absolute", "fixed", "sticky"]
+ elseif prop == 'prefix'
+ let values = []
+ elseif prop == 'quotes'
+ let values = ["none"]
+ elseif prop == 'range'
+ let values = ["auto", "infinite"]
+ elseif prop == 'resize'
+ let values = ["none", "both", "horizontal", "vertical"]
+ elseif prop =~ 'rest\%(-after\|-before\)\=$'
+ let values = ["none", "x-weak", "weak", "medium", "strong", "x-strong"]
+ elseif prop == 'ruby-align'
+ let values = ["start", "center", "space-between", "space-around"]
+ elseif prop == 'ruby-merge'
+ let values = ["separate", "collapse", "auto"]
+ elseif prop == 'ruby-position'
+ let values = ["over", "under", "inter-character"]
+ elseif prop == 'scroll-behavior'
+ let values = ["auto", "smooth"]
+ elseif prop == 'scroll-snap-coordinate'
+ let values = ["none"]
+ elseif prop == 'scroll-snap-destination'
+ return []
+ elseif prop == 'scroll-snap-points-\%(x\|y\)$'
+ let values = ["none", "repeat("]
+ elseif prop == 'scroll-snap-type\%(-x\|-y\)\=$'
+ let values = ["none", "mandatory", "proximity"]
+ elseif prop == 'shape-image-threshold'
+ let values = []
+ elseif prop == 'shape-margin'
+ let values = []
+ elseif prop == 'shape-outside'
+ let values = ["margin-box", "border-box", "padding-box", "content-box", 'inset(', 'circle(', 'ellipse(', 'polygon(', 'url(']
+ elseif prop == 'speak'
+ let values = ["auto", "none", "normal"]
+ elseif prop == 'speak-as'
+ let values = ["auto", "normal", "spell-out", "digits"]
+ elseif prop == 'src'
+ let values = ["url("]
+ elseif prop == 'suffix'
+ let values = []
+ elseif prop == 'symbols'
+ let values = []
+ elseif prop == 'system'
+ let vals = matchstr(line, '.*:\s*\zs.*')
+ if vals =~ '^extends'
+ let values = list_style_type_values
+ else
+ let values = ["cyclic", "numeric", "alphabetic", "symbolic", "additive", "fixed", "extends"]
+ endif
+ elseif prop == 'table-layout'
+ let values = ["auto", "fixed"]
+ elseif prop == 'tab-size'
+ let values = []
+ elseif prop == 'text-align'
+ let values = ["start", "end", "left", "right", "center", "justify", "match-parent"]
+ elseif prop == 'text-align-last'
+ let values = ["auto", "start", "end", "left", "right", "center", "justify"]
+ elseif prop == 'text-combine-upright'
+ let values = ["none", "all", "digits"]
+ elseif prop == 'text-decoration-line'
+ let values = ["none", "underline", "overline", "line-through", "blink"]
+ elseif prop == 'text-decoration-color'
+ let values = color_values
+ elseif prop == 'text-decoration-style'
+ let values = ["solid", "double", "dotted", "dashed", "wavy"]
+ elseif prop == 'text-decoration'
+ let values = ["none", "underline", "overline", "line-through", "blink"] + ["solid", "double", "dotted", "dashed", "wavy"] + color_values
+ elseif prop == 'text-emphasis-color'
+ let values = color_values
+ elseif prop == 'text-emphasis-position'
+ let values = ["over", "under", "left", "right"]
+ elseif prop == 'text-emphasis-style'
+ let values = ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
+ elseif prop == 'text-emphasis'
+ let values = color_values + ["over", "under", "left", "right"] + ["none", "filled", "open", "dot", "circle", "double-circle", "triangle", "sesame"]
+ elseif prop == 'text-indent'
+ let values = ["hanging", "each-line"]
+ elseif prop == 'text-orientation'
+ let values = ["mixed", "upright", "sideways", "sideways-right", "use-glyph-orientation"]
+ elseif prop == 'text-overflow'
+ let values = ["clip", "ellipsis"]
+ elseif prop == 'text-rendering'
+ let values = ["auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"]
+ elseif prop == 'text-shadow'
+ let values = color_values
+ elseif prop == 'text-transform'
+ let values = ["capitalize", "uppercase", "lowercase", "full-width", "none"]
+ elseif prop == 'text-underline-position'
+ let values = ["auto", "under", "left", "right"]
+ elseif prop == 'touch-action'
+ let values = ["auto", "none", "pan-x", "pan-y", "manipulation", "pan-left", "pan-right", "pan-top", "pan-down"]
+ elseif prop == 'transform'
+ let values = ["matrix(", "translate(", "translateX(", "translateY(", "scale(", "scaleX(", "scaleY(", "rotate(", "skew(", "skewX(", "skewY(", "matrix3d(", "translate3d(", "translateZ(", "scale3d(", "scaleZ(", "rotate3d(", "rotateX(", "rotateY(", "rotateZ(", "perspective("]
+ elseif prop == 'transform-box'
+ let values = ["border-box", "fill-box", "view-box"]
+ elseif prop == 'transform-origin'
+ let values = ["left", "center", "right", "top", "bottom"]
+ elseif prop == 'transform-style'
+ let values = ["flat", "preserve-3d"]
+ elseif prop == 'top'
+ let values = ["auto"]
+ elseif prop == 'transition-property'
+ let values = ["all", "none"] + s:values
+ elseif prop == 'transition-duration'
+ let values = []
+ elseif prop == 'transition-delay'
+ let values = []
+ elseif prop == 'transition-timing-function'
+ let values = timing_functions
+ elseif prop == 'transition'
+ let values = ["all", "none"] + s:values + timing_functions
+ elseif prop == 'unicode-bidi'
+ let values = ["normal", "embed", "isolate", "bidi-override", "isolate-override", "plaintext"]
+ elseif prop == 'unicode-range'
+ let values = ["U+"]
+ elseif prop == 'user-zoom'
+ let values = ["zoom", "fixed"]
+ elseif prop == 'vertical-align'
+ let values = ["baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom"]
+ elseif prop == 'visibility'
+ let values = ["visible", "hidden", "collapse"]
+ elseif prop == 'voice-volume'
+ let values = ["silent", "x-soft", "soft", "medium", "loud", "x-loud"]
+ elseif prop == 'voice-balance'
+ let values = ["left", "center", "right", "leftwards", "rightwards"]
+ elseif prop == 'voice-family'
+ let values = []
+ elseif prop == 'voice-rate'
+ let values = ["normal", "x-slow", "slow", "medium", "fast", "x-fast"]
+ elseif prop == 'voice-pitch'
+ let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
+ elseif prop == 'voice-range'
+ let values = ["absolute", "x-low", "low", "medium", "high", "x-high"]
+ elseif prop == 'voice-stress'
+ let values = ["normal", "strong", "moderate", "none", "reduced "]
+ elseif prop == 'voice-duration'
+ let values = ["auto"]
+ elseif prop == 'white-space'
+ let values = ["normal", "pre", "nowrap", "pre-wrap", "pre-line"]
+ elseif prop == 'widows'
+ let values = []
+ elseif prop == 'will-change'
+ let values = ["auto", "scroll-position", "contents"] + s:values
+ elseif prop == 'word-break'
+ let values = ["normal", "break-all", "keep-all"]
+ elseif prop == 'word-spacing'
+ let values = ["normal"]
+ elseif prop == 'word-wrap'
+ let values = ["normal", "break-word"]
+ elseif prop == 'writing-mode'
+ let values = ["horizontal-tb", "vertical-rl", "vertical-lr", "sideways-rl", "sideways-lr"]
+ elseif prop == 'z-index'
+ let values = ["auto"]
+ elseif prop == 'zoom'
+ let values = ["auto"]
+ else
+ " If no property match it is possible we are outside of {} and
+ " trying to complete pseudo-(class|element)
+ let element = tolower(matchstr(line, '\zs[a-zA-Z1-6]*\ze:[^:[:space:]]\{-}$'))
+ if stridx('a,abbr,address,area,article,aside,audio,b,base,bdi,bdo,bgsound,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,element,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,main,map,mark,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,pre,progress,q,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,span,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,u,ul,var,video,wbr', ','.element.',') > -1
+ let values = ["active", "any", "checked", "default", "dir(", "disabled", "empty", "enabled", "first", "first-child", "first-of-type", "fullscreen", "focus", "hover", "indeterminate", "in-range", "invalid", "lang(", "last-child", "last-of-type", "left", "link", "not(", "nth-child(", "nth-last-child(", "nth-last-of-type(", "nth-of-type(", "only-child", "only-of-type", "optional", "out-of-range", "read-only", "read-write", "required", "right", "root", "scope", "target", "valid", "visited", "first-line", "first-letter", "before", "after", "selection", "backdrop"]
+ else
+ return []
+ endif
+ endif
+
+ let values = wide_keywords + values
+ " Complete values
+ let entered_value = matchstr(line, '.\{-}\zs[a-zA-Z0-9#,.(_-]*$')
+
+ for m in values
+ if m =~? '^'.entered_value
+ call add(res, m)
+ elseif m =~? entered_value
+ call add(res2, m)
+ endif
+ endfor
+
+ return res + res2
+
+ elseif borders[max(keys(borders))] == 'closebrace'
+
+ return []
+
+ elseif borders[max(keys(borders))] == 'exclam'
+
+ " Complete values
+ let entered_imp = matchstr(line, '.\{-}!\s*\zs[a-zA-Z ]*$')
+
+ let values = ["important"]
+
+ for m in values
+ if m =~? '^'.entered_imp
+ call add(res, m)
+ endif
+ endfor
+
+ return res
+
+ elseif borders[max(keys(borders))] == 'atrule'
+
+ let afterat = matchstr(line, '.*@\zs.*')
+
+ if afterat =~ '\s'
+
+ let atrulename = matchstr(line, '.*@\zs[a-zA-Z-]\+\ze')
+
+ if atrulename == 'media'
+ let entered_atruleafter = matchstr(line, '.*@media\s\+\zs.*$')
+
+ if entered_atruleafter =~ "([^)]*$"
+ let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs[^)]*$')
+ let values = ["max-width", "min-width", "width", "max-height", "min-height", "height", "max-aspect-ration", "min-aspect-ration", "aspect-ratio", "orientation", "max-resolution", "min-resolution", "resolution", "scan", "grid", "update-frequency", "overflow-block", "overflow-inline", "max-color", "min-color", "color", "max-color-index", "min-color-index", "color-index", "monochrome", "inverted-colors", "pointer", "hover", "any-pointer", "any-hover", "light-level", "scripting"]
+ else
+ let values = ["screen", "print", "speech", "all", "not", "and", "("]
+ endif
+
+ elseif atrulename == 'supports'
+ let entered_atruleafter = matchstr(line, '.*@supports\s\+\zs.*$')
+
+ if entered_atruleafter =~ "([^)]*$"
+ let entered_atruleafter = matchstr(entered_atruleafter, '(\s*\zs.*$')
+ let values = s:values
+ else
+ let values = ["("]
+ endif
+
+ elseif atrulename == 'charset'
+ let entered_atruleafter = matchstr(line, '.*@charset\s\+\zs.*$')
+ let values = [
+ \ '"UTF-8";', '"ANSI_X3.4-1968";', '"ISO_8859-1:1987";', '"ISO_8859-2:1987";', '"ISO_8859-3:1988";', '"ISO_8859-4:1988";', '"ISO_8859-5:1988";',
+ \ '"ISO_8859-6:1987";', '"ISO_8859-7:1987";', '"ISO_8859-8:1988";', '"ISO_8859-9:1989";', '"ISO-8859-10";', '"ISO_6937-2-add";', '"JIS_X0201";',
+ \ '"JIS_Encoding";', '"Shift_JIS";', '"Extended_UNIX_Code_Packed_Format_for_Japanese";', '"Extended_UNIX_Code_Fixed_Width_for_Japanese";',
+ \ '"BS_4730";', '"SEN_850200_C";', '"IT";', '"ES";', '"DIN_66003";', '"NS_4551-1";', '"NF_Z_62-010";', '"ISO-10646-UTF-1";', '"ISO_646.basic:1983";',
+ \ '"INVARIANT";', '"ISO_646.irv:1983";', '"NATS-SEFI";', '"NATS-SEFI-ADD";', '"NATS-DANO";', '"NATS-DANO-ADD";', '"SEN_850200_B";', '"KS_C_5601-1987";',
+ \ '"ISO-2022-KR";', '"EUC-KR";', '"ISO-2022-JP";', '"ISO-2022-JP-2";', '"JIS_C6220-1969-jp";', '"JIS_C6220-1969-ro";', '"PT";', '"greek7-old";',
+ \ '"latin-greek";', '"NF_Z_62-010_(1973)";', '"Latin-greek-1";', '"ISO_5427";', '"JIS_C6226-1978";', '"BS_viewdata";', '"INIS";', '"INIS-8";',
+ \ '"INIS-cyrillic";', '"ISO_5427:1981";', '"ISO_5428:1980";', '"GB_1988-80";', '"GB_2312-80";', '"NS_4551-2";', '"videotex-suppl";', '"PT2";',
+ \ '"ES2";', '"MSZ_7795.3";', '"JIS_C6226-1983";', '"greek7";', '"ASMO_449";', '"iso-ir-90";', '"JIS_C6229-1984-a";', '"JIS_C6229-1984-b";',
+ \ '"JIS_C6229-1984-b-add";', '"JIS_C6229-1984-hand";', '"JIS_C6229-1984-hand-add";', '"JIS_C6229-1984-kana";', '"ISO_2033-1983";',
+ \ '"ANSI_X3.110-1983";', '"T.61-7bit";', '"T.61-8bit";', '"ECMA-cyrillic";', '"CSA_Z243.4-1985-1";', '"CSA_Z243.4-1985-2";', '"CSA_Z243.4-1985-gr";',
+ \ '"ISO_8859-6-E";', '"ISO_8859-6-I";', '"T.101-G2";', '"ISO_8859-8-E";', '"ISO_8859-8-I";', '"CSN_369103";', '"JUS_I.B1.002";', '"IEC_P27-1";',
+ \ '"JUS_I.B1.003-serb";', '"JUS_I.B1.003-mac";', '"greek-ccitt";', '"NC_NC00-10:81";', '"ISO_6937-2-25";', '"GOST_19768-74";', '"ISO_8859-supp";',
+ \ '"ISO_10367-box";', '"latin-lap";', '"JIS_X0212-1990";', '"DS_2089";', '"us-dk";', '"dk-us";', '"KSC5636";', '"UNICODE-1-1-UTF-7";', '"ISO-2022-CN";',
+ \ '"ISO-2022-CN-EXT";', '"ISO-8859-13";', '"ISO-8859-14";', '"ISO-8859-15";', '"ISO-8859-16";', '"GBK";', '"GB18030";', '"OSD_EBCDIC_DF04_15";',
+ \ '"OSD_EBCDIC_DF03_IRV";', '"OSD_EBCDIC_DF04_1";', '"ISO-11548-1";', '"KZ-1048";', '"ISO-10646-UCS-2";', '"ISO-10646-UCS-4";', '"ISO-10646-UCS-Basic";',
+ \ '"ISO-10646-Unicode-Latin1";', '"ISO-10646-J-1";', '"ISO-Unicode-IBM-1261";', '"ISO-Unicode-IBM-1268";', '"ISO-Unicode-IBM-1276";',
+ \ '"ISO-Unicode-IBM-1264";', '"ISO-Unicode-IBM-1265";', '"UNICODE-1-1";', '"SCSU";', '"UTF-7";', '"UTF-16BE";', '"UTF-16LE";', '"UTF-16";', '"CESU-8";',
+ \ '"UTF-32";', '"UTF-32BE";', '"UTF-32LE";', '"BOCU-1";', '"ISO-8859-1-Windows-3.0-Latin-1";', '"ISO-8859-1-Windows-3.1-Latin-1";',
+ \ '"ISO-8859-2-Windows-Latin-2";', '"ISO-8859-9-Windows-Latin-5";', '"hp-roman8";', '"Adobe-Standard-Encoding";', '"Ventura-US";',
+ \ '"Ventura-International";', '"DEC-MCS";', '"IBM850";', '"PC8-Danish-Norwegian";', '"IBM862";', '"PC8-Turkish";', '"IBM-Symbols";', '"IBM-Thai";',
+ \ '"HP-Legal";', '"HP-Pi-font";', '"HP-Math8";', '"Adobe-Symbol-Encoding";', '"HP-DeskTop";', '"Ventura-Math";', '"Microsoft-Publishing";',
+ \ '"Windows-31J";', '"GB2312";', '"Big5";', '"macintosh";', '"IBM037";', '"IBM038";', '"IBM273";', '"IBM274";', '"IBM275";', '"IBM277";', '"IBM278";',
+ \ '"IBM280";', '"IBM281";', '"IBM284";', '"IBM285";', '"IBM290";', '"IBM297";', '"IBM420";', '"IBM423";', '"IBM424";', '"IBM437";', '"IBM500";', '"IBM851";',
+ \ '"IBM852";', '"IBM855";', '"IBM857";', '"IBM860";', '"IBM861";', '"IBM863";', '"IBM864";', '"IBM865";', '"IBM868";', '"IBM869";', '"IBM870";', '"IBM871";',
+ \ '"IBM880";', '"IBM891";', '"IBM903";', '"IBM904";', '"IBM905";', '"IBM918";', '"IBM1026";', '"EBCDIC-AT-DE";', '"EBCDIC-AT-DE-A";', '"EBCDIC-CA-FR";',
+ \ '"EBCDIC-DK-NO";', '"EBCDIC-DK-NO-A";', '"EBCDIC-FI-SE";', '"EBCDIC-FI-SE-A";', '"EBCDIC-FR";', '"EBCDIC-IT";', '"EBCDIC-PT";', '"EBCDIC-ES";',
+ \ '"EBCDIC-ES-A";', '"EBCDIC-ES-S";', '"EBCDIC-UK";', '"EBCDIC-US";', '"UNKNOWN-8BIT";', '"MNEMONIC";', '"MNEM";', '"VISCII";', '"VIQR";', '"KOI8-R";',
+ \ '"HZ-GB-2312";', '"IBM866";', '"IBM775";', '"KOI8-U";', '"IBM00858";', '"IBM00924";', '"IBM01140";', '"IBM01141";', '"IBM01142";', '"IBM01143";',
+ \ '"IBM01144";', '"IBM01145";', '"IBM01146";', '"IBM01147";', '"IBM01148";', '"IBM01149";', '"Big5-HKSCS";', '"IBM1047";', '"PTCP154";', '"Amiga-1251";',
+ \ '"KOI7-switched";', '"BRF";', '"TSCII";', '"windows-1250";', '"windows-1251";', '"windows-1252";', '"windows-1253";', '"windows-1254";', '"windows-1255";',
+ \ '"windows-1256";', '"windows-1257";', '"windows-1258";', '"TIS-620";']
+
+ elseif atrulename == 'namespace'
+ let entered_atruleafter = matchstr(line, '.*@namespace\s\+\zs.*$')
+ let values = ["url("]
+
+ elseif atrulename == 'document'
+ let entered_atruleafter = matchstr(line, '.*@document\s\+\zs.*$')
+ let values = ["url(", "url-prefix(", "domain(", "regexp("]
+
+ elseif atrulename == 'import'
+ let entered_atruleafter = matchstr(line, '.*@import\s\+\zs.*$')
+
+ if entered_atruleafter =~ "^[\"']"
+ let filestart = matchstr(entered_atruleafter, '^.\zs.*')
+ let files = split(glob(filestart.'*'), '\n')
+ let values = map(copy(files), '"\"".v:val')
+
+ elseif entered_atruleafter =~ "^url("
+ let filestart = matchstr(entered_atruleafter, "^url([\"']\\?\\zs.*")
+ let files = split(glob(filestart.'*'), '\n')
+ let values = map(copy(files), '"url(".v:val')
+
+ else
+ let values = ['"', 'url(']
+
+ endif
+
+ else
+ return []
+
+ endif
+
+ for m in values
+ if m =~? '^'.entered_atruleafter
+ if entered_atruleafter =~? '^"' && m =~? '^"'
+ let m = m[1:]
+ endif
+ if b:after =~? '"' && stridx(m, '"') > -1
+ let m = m[0:stridx(m, '"')-1]
+ endif
+ call add(res, m)
+ elseif m =~? entered_atruleafter
+ if m =~? '^"'
+ let m = m[1:]
+ endif
+ call add(res2, m)
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+
+ let values = ["charset", "page", "media", "import", "font-face", "namespace", "supports", "keyframes", "viewport", "document"]
+
+ let entered_atrule = matchstr(line, '.*@\zs[a-zA-Z-]*$')
+
+ for m in values
+ if m =~? '^'.entered_atrule
+ call add(res, m .' ')
+ elseif m =~? entered_atrule
+ call add(res2, m .' ')
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+
+ return []
endfunction
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 53668b15be..64c08e98fa 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: Oct 23, 2015
-" Version: 154
+" Date: Feb 16, 2016
+" Version: 155 ASTRO-ONLY
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
-" Copyright: Copyright (C) 1999-2015 Charles E. Campbell {{{1
+" Copyright: Copyright (C) 2016 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,
@@ -30,7 +30,7 @@ if v:version < 704 || !has("patch213")
let s:needpatch213= 1
finish
endif
-let g:loaded_netrw = "v154"
+let g:loaded_netrw = "v155"
if !exists("s:NOTE")
let s:NOTE = 0
let s:WARNING = 1
@@ -55,7 +55,7 @@ setl cpo&vim
" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number)
" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number)
" (this function can optionally take a list of messages)
-" Oct 09, 2015 : max errnum currently is 102
+" Jan 19, 2016 : max errnum currently is 103
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)
@@ -77,7 +77,7 @@ fun! netrw#ErrorMsg(level,msg,errnum)
" (default) netrw creates a one-line window to show error/warning
" messages (reliably displayed)
- " record current window number for NetrwRestorePosn()'s benefit
+ " record current window number
let s:winBeforeErr= winnr()
" call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("<slnum>"))
@@ -416,18 +416,20 @@ if !exists("g:netrw_localmovecmd")
let g:netrw_localmovecmd= ""
endif
endif
-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
-if has("win32") || has("win95") || has("win64") || has("win16")
- if g:netrw_cygwin
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
- else
- let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir"
- endif
-else
- call s:NetrwInit("g:netrw_localrmdir","rmdir")
+if v:version < 704 || !has("patch1109")
+ 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
+ if has("win32") || has("win95") || has("win64") || has("win16")
+ if g:netrw_cygwin
+ call s:NetrwInit("g:netrw_localrmdir","rmdir")
+ else
+ let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir"
+ endif
+ else
+ call s:NetrwInit("g:netrw_localrmdir","rmdir")
+ endif
endif
call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
" sanity checks
@@ -489,6 +491,7 @@ endif
call s:NetrwInit("g:netrw_special_syntax" , 0)
call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
call s:NetrwInit("g:netrw_use_noswf" , 1)
+call s:NetrwInit("g:netrw_sizestyle" ,"b")
" Default values - t-w ---------- {{{3
call s:NetrwInit("g:netrw_timefmt","%c")
if !exists("g:netrw_xstrlen")
@@ -614,7 +617,7 @@ endif
" == 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("%"))
+" 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("%")." ft=".&ft)
" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
if !exists("b:netrw_curdir")
let b:netrw_curdir= getcwd()
@@ -1165,7 +1168,8 @@ fun! netrw#Lexplore(count,rightside,...)
" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>"))
exe lexwinnr."wincmd w"
let g:netrw_winsize = -winwidth(0)
- let t:netrw_lexposn = netrw#SavePosn()
+ let t:netrw_lexposn = winsaveview()
+" call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>"))
" call Decho("saving t:netrw_lexposn",'~'.expand("<slnum>"))
close
if lexwinnr < curwin
@@ -1205,7 +1209,8 @@ fun! netrw#Lexplore(count,rightside,...)
let t:netrw_lexbufnr = bufnr("%")
if exists("t:netrw_lexposn")
" call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>"))
- call netrw#RestorePosn(t:netrw_lexposn)
+" call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>"))
+ call winrestview(t:netrw_lexposn)
unlet t:netrw_lexposn
endif
endif
@@ -1273,7 +1278,8 @@ endfun
fun! netrw#MakeTgt(dname)
" call Dfunc("netrw#MakeTgt(dname<".a:dname.">)")
" simplify the target (eg. /abc/def/../ghi -> /abc/ghi)
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://')
" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>"))
if s:netrwmftgt_islocal
@@ -1290,7 +1296,8 @@ fun! netrw#MakeTgt(dname)
if g:netrw_fastbrowse <= 1
call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir)
endif
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))"
+ call winrestview(svpos)
" call Dret("netrw#MakeTgt")
endfun
@@ -1532,9 +1539,11 @@ endfun
" netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2
fun! netrw#Nread(mode,fname)
" call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)")
- call netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
call netrw#NetRead(a:mode,a:fname)
- call netrw#RestorePosn()
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST
if exists("w:netrw_bannercnt")
@@ -1552,8 +1561,8 @@ fun! s:NetrwOptionRestore(vt)
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
if !exists("{a:vt}netrw_optionsave")
if exists("s:nbcd_curpos_{bufnr('%')}")
-" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>"))
- NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')})
+" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')})
" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"),'~'.expand("<slnum>"))
" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>"))
unlet s:nbcd_curpos_{bufnr('%')}
@@ -1629,8 +1638,10 @@ fun! s:NetrwOptionRestore(vt)
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!!!
- sil! let &l:swf= {a:vt}netrw_swfkeep
+ if !g:netrw_use_noswf
+ " following line causes a Press ENTER in windows -- can't seem to work around it!!!
+ sil! let &l:swf= {a:vt}netrw_swfkeep
+ endif
unlet {a:vt}netrw_swfkeep
endif
endif
@@ -1646,8 +1657,8 @@ fun! s:NetrwOptionRestore(vt)
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("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("<slnum>"))
- NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')})
+" call Decho("restoring posn to s:nbcd_curpos_".bufnr('%')."<".string(s:nbcd_curpos_{bufnr('%')}).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(s:nbcd_curpos_{bufnr('%')})
" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("<slnum>"))
if exists("s:nbcd_curpos_".bufnr('%'))
unlet s:nbcd_curpos_{bufnr('%')}
@@ -1729,11 +1740,11 @@ fun! s:NetrwOptionSave(vt)
let {a:vt}netrw_rokeep = &l:ro
let {a:vt}netrw_selkeep = &l:sel
let {a:vt}netrw_spellkeep = &l:spell
- if g:netrw_use_noswf
- let {a:vt}netrw_swfkeep = &l:swf
+ if !g:netrw_use_noswf
+ let {a:vt}netrw_swfkeep = &l:swf
endif
if has("clipboard")
- let {a:vt}netrw_starkeep = @*
+ let {a:vt}netrw_starkeep = @*
endif
let {a:vt}netrw_tskeep = &l:ts
let {a:vt}netrw_twkeep = &l:tw " textwidth
@@ -2664,7 +2675,9 @@ fun! netrw#NetSource(...)
" call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("<slnum>"))
exe "so ".fnameescape(s:netrw_tmpfile)
" call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("<slnum>"))
- call delete(s:netrw_tmpfile)
+ if delete(s:netrw_tmpfile)
+ call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".s:netrw_tmpfile.">!",103)
+ endif
unlet s:netrw_tmpfile
else
call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48)
@@ -3504,7 +3517,11 @@ fun! s:NetrwBookHistSave()
let savefile= s:NetrwHome()."/.netrwhist"
1split
call s:NetrwEnew()
- setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf
+ if g:netrw_use_noswf
+ setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf
+ else
+ setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000
+ endif
setl nocin noai noci magic nospell nohid wig= noaw
setl ma noro write
if exists("+acd") | setl noacd | endif
@@ -3566,6 +3583,7 @@ fun! s:NetrwBrowse(islocal,dirname)
" This is useful when one edits a local file, then :e ., then :Rex
if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != ""
let w:netrw_rexfile= bufname("#")
+" call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr())
endif
" s:NetrwBrowse : initialize history {{{3
@@ -3683,7 +3701,8 @@ fun! s:NetrwBrowse(islocal,dirname)
" get/set-up buffer {{{3
" call Decho("saving position across a buffer refresh",'~'.expand("<slnum>"))
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let reusing= s:NetrwGetBuffer(a:islocal,dirname)
" maintain markfile highlighting
@@ -3792,10 +3811,18 @@ fun! s:NetrwBrowse(islocal,dirname)
NetrwKeepj call s:NetrwCommands(a:islocal)
NetrwKeepj call s:PerformListing(a:islocal)
+ " restore option(s)
+ call s:NetrwOptionRestore("w:")
+" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
+
" If there is a rexposn: restore position with rexposn
" Otherwise : set rexposn
if exists("s:rexposn_".bufnr("%"))
- NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')})
+" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
+ if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
+ NetrwKeepj exe w:netrw_bannercnt
+ endif
else
NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir)
endif
@@ -3804,13 +3831,11 @@ fun! s:NetrwBrowse(islocal,dirname)
" call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("<slnum>"))
setl beval
endif
- call s:NetrwOptionRestore("w:")
-" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
" restore position
if reusing
-" call Decho("reusing=".reusing.": restoring position across buffer refresh",'~'.expand("<slnum>"))
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
endif
" The s:LocalBrowseRefresh() function is called by an autocmd
@@ -3828,7 +3853,19 @@ endfun
" differ from vim's. This function insures that netrw's idea of the current
" directory is used.
fun! s:NetrwFile(fname)
-" call Dfunc("s:NetrwFile(fname<".a:fname.">)")
+" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr())
+" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'))
+" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'))
+" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'))
+" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'))
+
+ " clean up any leading treedepthstring
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
+ let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','')
+" call Decho("clean up any leading treedepthstring: fname<".fname.">")
+ else
+ let fname= a:fname
+ endif
if g:netrw_keepdir
" vim's idea of the current directory possibly may differ from netrw's
@@ -3837,28 +3874,28 @@ fun! s:NetrwFile(fname)
endif
if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
- if a:fname =~ '^\' || a:fname =~ '^\a:\'
+ if fname =~ '^\' || fname =~ '^\a:\'
" windows, but full path given
- let ret= a:fname
-" call Decho("windows+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>"))
+ let ret= fname
+" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>"))
else
" windows, relative path given
- let ret= s:ComposePath(b:netrw_curdir,a:fname)
-" call Decho("windows+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>"))
+ let ret= s:ComposePath(b:netrw_curdir,fname)
+" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>"))
endif
- elseif a:fname =~ '^/'
+ elseif fname =~ '^/'
" not windows, full path given
- let ret= a:fname
-" call Decho("unix+full path: isdirectory(".a:fname.")",'~'.expand("<slnum>"))
+ let ret= fname
+" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>"))
else
" not windows, relative path given
- let ret= s:ComposePath(b:netrw_curdir,a:fname)
-" call Decho("unix+rltv path: isdirectory(".a:fname.")",'~'.expand("<slnum>"))
+ let ret= s:ComposePath(b:netrw_curdir,fname)
+" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>"))
endif
else
" vim and netrw agree on the current directory
- let ret= a:fname
+ let ret= fname
" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>"))
endif
@@ -3872,23 +3909,29 @@ fun! s:NetrwFileInfo(islocal,fname)
" call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">")
let ykeep= @@
if a:islocal
+ let lsopt= "-lsad"
+ if g:netrw_sizestyle =~ 'H'
+ let lsopt= "-lsadh"
+ elseif g:netrw_sizestyle =~ 'h'
+ let lsopt= "-lsadh --si"
+ endif
if (has("unix") || has("macunix")) && executable("/bin/ls")
if getline(".") == "../"
- echo system("/bin/ls -lsad ".s:ShellEscape(".."))
+ echo system("/bin/ls ".lsopt." ".s:ShellEscape(".."))
" call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("<slnum>"))
elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring
- echo system("/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir))
+ echo system("/bin/ls ".lsopt." ".s:ShellEscape(b:netrw_curdir))
" call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("<slnum>"))
elseif exists("b:netrw_curdir")
- echo system("/bin/ls -lsad ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname)))
+ echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname)))
" call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("<slnum>"))
else
" call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("<slnum>"))
- echo system("/bin/ls -lsad ".s:ShellEscape(s:NetrwFile(a:fname)))
+ echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:NetrwFile(a:fname)))
" call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("<slnum>"))
endif
else
@@ -3901,6 +3944,9 @@ fun! s:NetrwFileInfo(islocal,fname)
endif
let t = getftime(s:NetrwFile(fname))
let sz = getfsize(s:NetrwFile(fname))
+ if g:netrw_sizestyle =~ "[hH]"
+ let sz= s:NetrwHumanReadable(sz)
+ endif
echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname)))
" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("<slnum>"))
endif
@@ -4029,11 +4075,15 @@ fun! s:NetrwGetBuffer(islocal,dirname)
let w:netrw_treebufnr= bufnr("%")
" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("<slnum>"))
exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum)
- setl bt=nofile noswf
- nnoremap <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr>
- nnoremap <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr>
- nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[')<cr>
- nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']')<cr>
+ if g:netrw_use_noswf
+ setl nobl bt=nofile noswf
+ else
+ setl nobl bt=nofile
+ endif
+ nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[[')<cr>
+ nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']]')<cr>
+ nnoremap <silent> <buffer> [] :sil call <SID>TreeListMove('[]')<cr>
+ nnoremap <silent> <buffer> ][ :sil call <SID>TreeListMove('][')<cr>
" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>"))
else
" let v:errmsg = "" " Decho
@@ -4197,7 +4247,7 @@ fun! s:NetrwGetWord()
NetrwKeepj norm! 0
let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e')
- elseif w:netrw_liststyle == s:TREELIST
+ elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
" call Decho("treelist handling",'~'.expand("<slnum>"))
let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e')
let dirname= substitute(dirname,'\t -->.*$','','')
@@ -4286,7 +4336,8 @@ fun! s:NetrwListStyle(islocal)
let ykeep = @@
let fname = s:NetrwGetWord()
if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST
" call Decho("fname<".fname.">",'~'.expand("<slnum>"))
" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>"))
@@ -4307,7 +4358,7 @@ fun! s:NetrwListStyle(islocal)
" call Decho("use wide list",'~'.expand("<slnum>"))
let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
- elseif w:netrw_liststyle == s:TREELIST
+ elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
" call Decho("use tree list",'~'.expand("<slnum>"))
let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
@@ -4334,7 +4385,8 @@ fun! s:NetrwListStyle(islocal)
NetrwKeepj call s:NetrwCursor()
" restore position; keep cursor on the filename
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
let @@= ykeep
" call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : ""))
@@ -4350,7 +4402,8 @@ fun! s:NetrwBannerCtrl(islocal)
let g:netrw_banner= !g:netrw_banner
" refresh the listing
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
" keep cursor on the filename
@@ -4385,7 +4438,8 @@ fun! s:NetrwBookmark(del,...)
if exists("s:netrwmarkfilelist_{curbufnr}")
" for every filename in the marked list
" call Decho("bookmark every filename in marked list",'~'.expand("<slnum>"))
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let islocal= expand("%") !~ '^\a\{3,}://'
for fname in s:netrwmarkfilelist_{curbufnr}
if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif
@@ -4393,7 +4447,8 @@ fun! s:NetrwBookmark(del,...)
let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd()
call s:NetrwUnmarkList(curbufnr,curdir)
NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
else
let fname= s:NetrwGetWord()
if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif
@@ -4528,9 +4583,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Decho("saving options",'~'.expand("<slnum>"))
NetrwKeepj call s:NetrwOptionSave("s:")
NetrwKeepj call s:NetrwSafeOptions()
- let nbcd_curpos = netrw#SavePosn()
+ let nbcd_curpos = winsaveview()
+" call Decho("saving posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("<slnum>"))
let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos
-" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn",'~'.expand("<slnum>"))
if (has("win32") || has("win95") || has("win64") || has("win16"))
let dirname = substitute(b:netrw_curdir,'\\','/','ge')
else
@@ -4553,7 +4608,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
setl ma noro nowrap
NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp])
setl noma nomod nowrap
- NetrwKeepj call netrw#RestorePosn(nbcd_curpos)
+" call Decho("restoring posn to nbcd_curpos<".string(nbcd_curpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(nbcd_curpos)
NetrwKeepj call s:NetrwOptionRestore("s:")
" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
endif
@@ -4585,8 +4641,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>"))
" save position for benefit of Rexplore
- let s:rexposn_{bufnr("%")}= netrw#SavePosn()
-" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>"))
+ let s:rexposn_{bufnr("%")}= winsaveview()
+" call Decho("edit-a-file: saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>"))
" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("<slnum>"))
@@ -4602,6 +4658,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("<slnum>"))
" call Decho("edit-a-file: tree listing",'~'.expand("<slnum>"))
elseif newdir =~ '^\(/\|\a:\)'
+" call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">")
let dirname= newdir
else
let dirname= s:ComposePath(dirname,newdir)
@@ -4609,8 +4666,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("<slnum>"))
" this lets netrw#BrowseX avoid the edit
if a:0 < 1
-" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>"))
+" call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>"))
NetrwKeepj call s:NetrwOptionRestore("s:")
+ let curdir= b:netrw_curdir
if !exists("s:didsplit")
" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>"))
if type(g:netrw_browse_split) == 3
@@ -4627,6 +4685,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
if !&ea
keepalt wincmd _
endif
+ call s:SetRexDir(a:islocal,b:netrw_curdir)
elseif g:netrw_browse_split == 2
" vertically splitting the window first
" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>"))
@@ -4634,10 +4693,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
if !&ea
keepalt wincmd |
endif
+ call s:SetRexDir(a:islocal,b:netrw_curdir)
elseif g:netrw_browse_split == 3
" open file in new tab
" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>"))
keepalt tabnew
+ call s:SetRexDir(a:islocal,b:netrw_curdir)
elseif g:netrw_browse_split == 4
" act like "P" (ie. open previous window)
" call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>"))
@@ -4646,6 +4707,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Dret("s:NetrwBrowseChgDir")
return
endif
+ call s:SetRexDir(a:islocal,b:netrw_curdir)
else
" handling a file, didn't split, so remove menu
" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>"))
@@ -4663,6 +4725,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
endif
exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w"
endif
+ call s:SetRexDir(a:islocal,curdir)
endif
endif
@@ -4802,7 +4865,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>"))
" search treedict for tree dir as-is
-" call Decho("search treedict for tree dir as-is",'~'.expand("<slnum>"))
+" call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("<slnum>"))
if has_key(w:netrw_treedict,treedir)
" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>"))
let haskey= 1
@@ -4811,7 +4874,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
endif
" search treedict for treedir with a [/@] appended
-" call Decho("search treedict for treedir with a [/@] appended",'~'.expand("<slnum>"))
+" call Decho("tree-list: search treedict for treedir with a [/@] appended",'~'.expand("<slnum>"))
if !haskey && treedir !~ '[/@]$'
if has_key(w:netrw_treedict,treedir."/")
let treedir= treedir."/"
@@ -4823,7 +4886,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
endif
" search treedict for treedir with any trailing / elided
-" call Decho("search treedict for treedir with any trailing / elided",'~'.expand("<slnum>"))
+" call Decho("tree-list: search treedict for treedir with any trailing / elided",'~'.expand("<slnum>"))
if !haskey && treedir =~ '/$'
let treedir= substitute(treedir,'/$','','')
if has_key(w:netrw_treedict,treedir)
@@ -4967,14 +5030,15 @@ fun! netrw#BrowseX(fname,remote)
" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")")
" if its really just a directory, then do a "gf" instead
- if a:fname =~ '/$'
+ if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && fname =~ '/$' && fname !~ '^https\=:')
norm! gf
" call Dret("netrw#BrowseX : did gf instead")
endif
let ykeep = @@
- let screenposn = netrw#SavePosn()
+ let screenposn = winsaveview()
+" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
" need to save and restore aw setting as gx can invoke this function from non-netrw buffers
let awkeep = &aw
@@ -4996,7 +5060,8 @@ fun! netrw#BrowseX(fname,remote)
endif
endfor
endif
- call netrw#RestorePosn(screenposn)
+" call Decho("restoring posn to screenposn<".string(screenposn).">,'~'.expand("<slnum>"))"
+ call winrestview(screenposn)
let @@= ykeep
let &aw= awkeep
" call Dret("netrw#BrowseX : coredump handler invoked")
@@ -5167,7 +5232,8 @@ fun! netrw#BrowseX(fname,remote)
exe "sil! NetrwKeepj norm! \<c-o>"
" redraw!
endif
- call netrw#RestorePosn(screenposn)
+" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
+ call winrestview(screenposn)
let @@ = ykeep
let &aw= awkeep
@@ -5310,6 +5376,32 @@ fun! s:NetrwForceChgDir(islocal,newdir)
endfun
" ---------------------------------------------------------------------
+" s:NetrwGlob: does glob() if local, remote listing otherwise {{{2
+fun! s:NetrwGlob(direntry,expr)
+" call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr.">)")
+ if netrw#CheckIfRemote()
+ keepalt 1sp
+ keepalt enew
+ let keep_liststyle = w:netrw_liststyle
+ let w:netrw_liststyle = s:THINLIST
+ if s:NetrwRemoteListing() == 0
+ keepj keepalt %s@/@@
+ let filelist= getline(1,$)
+ q!
+ else
+ " remote listing error -- leave treedict unchanged
+ let filelist= w:netrw_treedict[a:direntry]
+ endif
+ let w:netrw_liststyle= keep_liststyle
+ else
+ let filelist= glob(s:ComposePath(a:direntry,a:expr),0,1,1)
+ let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
+ endif
+" call Dret("s:NetrwGlob ".string(filelist))
+ return filelist
+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.">)")
@@ -5336,7 +5428,8 @@ endfun
fun! s:NetrwHide(islocal)
" call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide)
let ykeep= @@
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
if exists("s:netrwmarkfilelist_{bufnr('%')}")
" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("<slnum>"))
@@ -5378,7 +5471,8 @@ fun! s:NetrwHide(islocal)
endif
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
let @@= ykeep
" call Dret("NetrwHide")
endfun
@@ -5390,7 +5484,8 @@ fun! s:NetrwHideEdit(islocal)
let ykeep= @@
" save current cursor position
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" get new hiding list from user
call inputsave()
@@ -5403,7 +5498,8 @@ fun! s:NetrwHideEdit(islocal)
sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./"))
" restore cursor position
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
let @@= ykeep
" call Dret("NetrwHideEdit")
@@ -5415,7 +5511,8 @@ fun! s:NetrwHidden(islocal)
" call Dfunc("s:NetrwHidden()")
let ykeep= @@
" save current position
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+'
" remove pattern from hiding list
@@ -5428,7 +5525,8 @@ fun! s:NetrwHidden(islocal)
" refresh screen and return to saved position
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
let @@= ykeep
" call Dret("s:NetrwHidden")
endfun
@@ -5540,10 +5638,10 @@ fun! s:NetrwServerEdit(islocal,fname)
if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$')
" handle directories in the local window -- not in the remote vim server
- " user must have closed the NETRWSERVER window. Treat as a normal editing from netrw.
+ " user must have closed the NETRWSERVER window. Treat as normal editing from netrw.
" call Decho("handling directory in client window",'~'.expand("<slnum>"))
let g:netrw_browse_split= 0
- if exists("s:netrw_browse_split_".winnr())
+ if exists("s:netrw_browse_split") && exists("s:netrw_browse_split_".winnr())
let g:netrw_browse_split= s:netrw_browse_split_{winnr()}
unlet s:netrw_browse_split_{winnr()}
endif
@@ -5820,9 +5918,11 @@ fun! s:NetrwMakeDir(usrhost)
if v:shell_error == 0
" refresh listing
" call Decho("refresh listing",'~'.expand("<slnum>"))
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
elseif !exists("g:netrw_quiet")
call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26)
endif
@@ -5836,9 +5936,11 @@ fun! s:NetrwMakeDir(usrhost)
call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1))
if v:shell_error == 0
" refresh listing
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
elseif !exists("g:netrw_quiet")
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27)
endif
@@ -5846,7 +5948,8 @@ fun! s:NetrwMakeDir(usrhost)
elseif b:netrw_method == 2
" Remote mkdir: using ftp+.netrc
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
if exists("b:netrw_fname")
" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>"))
@@ -5856,11 +5959,13 @@ fun! s:NetrwMakeDir(usrhost)
endif
call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"')
NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
elseif b:netrw_method == 3
" Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc)
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
if exists("b:netrw_fname")
" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>"))
@@ -5870,7 +5975,8 @@ fun! s:NetrwMakeDir(usrhost)
endif
call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"')
NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
endif
let @@= ykeep
@@ -5884,22 +5990,30 @@ fun! s:TreeSqueezeDir(islocal)
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
" its a tree-listing style
let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
- let iline = line(".") - 1
let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1)
-" call Decho("curdepth=".curdepth,'~'.expand("<slnum>"))
+ let depth = strchars(substitute(curdepth,' ','','g'))
+ let srch = -1
+" call Decho("curdepth<".curdepth.'>','~'.expand("<slnum>"))
+" call Decho("depth =".depth,'~'.expand("<slnum>"))
" call Decho("stopline#".stopline,'~'.expand("<slnum>"))
-" call Decho("starting with line#".line(".").": ".getline('.'),'~'.expand("<slnum>"))
- while iline > stopline
- " find a line that has less depth
- let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
-" call Decho("considering line#".line(".").": ".getline('.'),'~'.expand("<slnum>"))
- if depth < curdepth
- break
- endif
- norm! k
- endwhile
-" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>"))
- call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord()))
+" call Decho("curline#".line(".")."<".getline('.').'>','~'.expand("<slnum>"))
+ if depth >= 2
+ NetrwKeepj norm! 0
+ let curdepthm1= substitute(curdepth,'^'.s:treedepthstring,'','')
+ let srch = search('^'.curdepthm1.'\%('.s:treedepthstring.'\)\@!','bW',stopline)
+" call Decho("curdepthm1<".curdepthm1.'>','~'.expand("<slnum>"))
+" call Decho("case depth>=2: srch<".srch.'>','~'.expand("<slnum>"))
+ elseif depth == 1
+ NetrwKeepj norm! 0
+ let treedepthchr= substitute(s:treedepthstring,' ','','')
+ let srch = search('^[^'.treedepthchr.']','bW',stopline)
+" call Decho("case depth==1: srch<".srch.'>','~'.expand("<slnum>"))
+ endif
+ if srch > 0
+" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>"))
+ call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord()))
+ exe srch
+ endif
endif
" call Dret("s:TreeSqueezeDir")
endfun
@@ -5927,23 +6041,24 @@ fun! s:NetrwMaps(islocal)
if a:islocal
" call Decho("make local maps",'~'.expand("<slnum>"))
" local normal-mode maps
- nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(1)<cr>
- nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(1)<cr>
- nnoremap <buffer> <silent> <nowait> c :call <SID>NetrwLcd(b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(1)<cr>
+ nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(1)<cr>
+ nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(1)<cr>
+ nnoremap <buffer> <silent> <nowait> c :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr>
- nnoremap <buffer> <silent> <nowait> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
- nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(1)<cr>
- nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr>
- nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr>
- nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(1)<cr>
+ nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
+ nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr>
+ nnoremap <buffer> <silent> <nowait> d :<c-u>call <SID>NetrwMakeDir("")<cr>
nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr>
nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr>
nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr>
nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr>
nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr>
- nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(1)<cr>
+ nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr>
+ nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(1)<cr>
+ nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(1,0)<cr>
+ nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(1,1)<cr>
nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
@@ -5957,104 +6072,110 @@ fun! s:NetrwMaps(islocal)
nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr>
- nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr>
+ nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr>
nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr>
nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr>
nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
- nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(1)<cr>
+ nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(1)<cr>
nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(3)<cr>
- nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
- nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(1)<cr>
+ nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
+ nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(1)<cr>
nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr>
- nnoremap <buffer> <silent> <nowait> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
+ nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr>
+ nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr>
- nnoremap <buffer> <silent> <nowait> S :call <SID>NetSortSequence(1)<cr>
+ nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(1)<cr>
+ nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr>
nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(4)<cr>
- nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr>
- nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr>
+ nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr>
nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr>
- nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
- nnoremap <buffer> <silent> <nowait> X :call <SID>NetrwLocalExecute(expand("<cword>"))"<cr>
- " local insert-mode maps
- inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr>
- inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr>
- inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr>
- inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr>
- inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
- inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(1)<cr>
- inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>
- inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr>
- nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr>
- inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
- inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr>
- inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
- inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
- inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
- inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
- inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
- inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
- inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr>
- inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
- inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
- inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr>
- inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr>
- inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
- inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr>
- inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
- inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr>
- inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr>
- inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
- inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr>
- inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr>
- inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
- inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
- inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
- inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr>
- inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
- inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr>
- inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr>
- inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr>
- inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr>
- inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr>
- inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
- inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
- inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr>
- inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
+ nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
+ nnoremap <buffer> <silent> <nowait> X :<c-u>call <SID>NetrwLocalExecute(expand("<cword>"))"<cr>
+" " local insert-mode maps
+" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr>
+" inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr>
+" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr>
+" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr>
+" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
+" inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>
+" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr>
+" nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr>
+" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
+" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr>
+" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
+" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
+" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
+" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
+" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
+" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
+" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr>
+" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
+" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
+" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr>
+" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr>
+" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
+" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr>
+" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
+" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr>
+" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr>
+" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
+" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr>
+" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr>
+" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
+" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
+" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
+" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr>
+" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr>
+" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr>
+" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr>
+" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr>
+" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr>
+" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr>
+" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr>
+" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
+" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
+" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr>
+" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
if !hasmapto('<Plug>NetrwHideEdit')
nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
- imap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
+" imap <buffer> <unique> <c-h> <c-o><Plug>NetrwHideEdit
endif
- nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr>
+ nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr>
if !hasmapto('<Plug>NetrwRefresh')
nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh
- imap <buffer> <unique> <c-l> <Plug>NetrwRefresh
+" imap <buffer> <unique> <c-l> <c-o><Plug>NetrwRefresh
endif
- nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr>
+ nnoremap <buffer> <silent> <Plug>NetrwRefresh <c-l>:call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr>
if s:didstarstar || !mapcheck("<s-down>","n")
nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
- inoremap <buffer> <silent> <s-down> :Nexplore<cr>
+" inoremap <buffer> <silent> <s-down> <c-o>:Nexplore<cr>
endif
if s:didstarstar || !mapcheck("<s-up>","n")
nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
- inoremap <buffer> <silent> <s-up> :Pexplore<cr>
+" inoremap <buffer> <silent> <s-up> <c-o>:Pexplore<cr>
+ endif
+ if !hasmapto('<Plug>NetrwTreeSqueeze')
+ nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze
+" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze
endif
+ nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(1)<cr>
let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape)
if g:netrw_mousemaps == 1
- nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse
+ nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse
nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse
nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr>
@@ -6067,14 +6188,14 @@ fun! s:NetrwMaps(islocal)
nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
imap <buffer> <leftmouse> <Plug>ILeftmouse
- ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr>
+" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr>
imap <buffer> <middlemouse> <Plug>IMiddlemouse
- ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
- imap <buffer> <s-leftmouse> <Plug>ISLeftmouse
- ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
+" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
+" imap <buffer> <s-leftmouse> <Plug>ISLeftmouse
+" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
- exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
endif
exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
@@ -6083,10 +6204,10 @@ fun! s:NetrwMaps(islocal)
exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>'
nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
" support user-specified maps
@@ -6096,13 +6217,24 @@ fun! s:NetrwMaps(islocal)
" call Decho("make remote maps",'~'.expand("<slnum>"))
call s:RemotePathAnalysis(b:netrw_curdir)
" remote normal-mode maps
- nnoremap <buffer> <silent> <nowait> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
- nnoremap <buffer> <silent> <nowait> <s-cr> :call <SID>TreeSqueezeDir(0)<cr>
- nnoremap <buffer> <silent> <nowait> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
- nnoremap <buffer> <silent> <nowait> <c-r> :call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr>
- nnoremap <buffer> <silent> <nowait> - :call <SID>NetrwBrowseUpDir(0)<cr>
- nnoremap <buffer> <silent> <nowait> a :call <SID>NetrwHide(0)<cr>
+ nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(0)<cr>
+ nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(0)<cr>
+ nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(0)<cr>
+ nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr>
+ nnoremap <buffer> <silent> <nowait> <c-l> :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
+ nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
+ nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr>
+ nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr>
+ nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr>
+ nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr>
+ nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr>
+ nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(0)<cr>
+ nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(0,0)<cr>
+ nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(0,1)<cr>
nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
@@ -6114,99 +6246,96 @@ fun! s:NetrwMaps(islocal)
nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr>
- nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr>
+ nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr>
nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr>
nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr>
nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr>
nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
- nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr>
- nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr>
- nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr>
- nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr>
- nnoremap <buffer> <silent> <nowait> i :call <SID>NetrwListStyle(0)<cr>
- nnoremap <buffer> <silent> <nowait> I :call <SID>NetrwBannerCtrl(1)<cr>
- nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr>
- nnoremap <buffer> <silent> <nowait> O :call <SID>NetrwObtain(0)<cr>
- nnoremap <buffer> <silent> <nowait> p :call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
- nnoremap <buffer> <silent> <nowait> P :call <SID>NetrwPrevWinOpen(0)<cr>
+ nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(0)<cr>
+ nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr>
+ nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
+ nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(0)<cr>
nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr>
- nnoremap <buffer> <silent> <nowait> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
- nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr>
- nnoremap <buffer> <silent> <nowait> S :call <SID>NetSortSequence(0)<cr>
- nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr>
- nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr>
- nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr>
- nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
- nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr>
- nnoremap <buffer> <silent> <nowait> x :call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
- nnoremap <buffer> <silent> <nowait> % :call <SID>NetrwOpenFile(0)<cr>
- " remote insert-mode maps
- inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
- inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
- inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr>
- inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr>
- inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr>
- inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
- inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
- inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
- inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
- inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
- inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
- inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr>
- inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
- inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
- inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr>
- inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
- inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr>
- inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr>
- nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
- inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr>
- inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr>
- inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr>
- inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
- inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr>
- inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr>
- inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr>
- inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
- inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr>
- inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr>
- inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
- inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
- inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
- inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr>
- inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
- inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr>
- inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr>
- inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr>
- inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr>
- inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr>
- inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
- inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr>
- inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
- inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr>
+ nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr>
+ nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
+ nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr>
+ nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(0)<cr>
+ nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(0,'b',v:count1)<cr>
+ nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr>
+ nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(0,'h',v:count)<cr>
+ nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
+ nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr>
+ nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
+" " remote insert-mode maps
+" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
+" inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
+" inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr>
+" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr>
+" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr>
+" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
+" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
+" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
+" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
+" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
+" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
+" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr>
+" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
+" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
+" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr>
+" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
+" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr>
+" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr>
+" nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
+" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr>
+" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr>
+" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr>
+" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
+" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr>
+" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr>
+" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr>
+" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
+" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr>
+" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr>
+" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
+" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
+" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
+" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr>
+" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr>
+" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
+" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr>
+" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr>
+" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr>
+" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr>
+" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr>
+" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
+" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr>
+" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
+" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr>
if !hasmapto('<Plug>NetrwHideEdit')
nmap <buffer> <c-h> <Plug>NetrwHideEdit
- imap <buffer> <c-h> <Plug>NetrwHideEdit
+" imap <buffer> <c-h> <Plug>NetrwHideEdit
endif
nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr>
if !hasmapto('<Plug>NetrwRefresh')
nmap <buffer> <c-l> <Plug>NetrwRefresh
- imap <buffer> <c-l> <Plug>NetrwRefresh
+" imap <buffer> <c-l> <Plug>NetrwRefresh
endif
+ if !hasmapto('<Plug>NetrwTreeSqueeze')
+ nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze
+" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze
+ endif
+ nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(0)<cr>
let mapsafepath = escape(s:path, s:netrw_map_escape)
let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape)
@@ -6226,14 +6355,14 @@ fun! s:NetrwMaps(islocal)
nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
imap <buffer> <leftmouse> <Plug>ILeftmouse
- ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr>
+" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr>
imap <buffer> <middlemouse> <Plug>IMiddlemouse
- ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
+" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
imap <buffer> <s-leftmouse> <Plug>ISLeftmouse
- ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
+" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
- exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
endif
exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
@@ -6242,12 +6371,12 @@ fun! s:NetrwMaps(islocal)
exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
- exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
- inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr>
+" inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr>
" support user-specified maps
call netrw#UserMaps(0)
@@ -6257,7 +6386,7 @@ fun! s:NetrwMaps(islocal)
endfun
" ---------------------------------------------------------------------
-" s:NetrwCommands: sets up commands {{{2
+" s:NetrwCommands: set up commands {{{2
" If -buffer, the command is only available from within netrw buffers
" Otherwise, the command is available from any window, so long as netrw
" has been used at least once in the session.
@@ -6266,7 +6395,7 @@ fun! s:NetrwCommands(islocal)
com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(<bang>0,<f-args>)
com! -nargs=* NetrwC call s:NetrwSetChgwin(<q-args>)
- 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
+ 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,"win#".winnr()." not a former netrw window",79)|endif
if a:islocal
com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,<f-args>)
else
@@ -6319,9 +6448,11 @@ fun! s:NetrwMarkTarget(...)
let s:netrwmftgt = tgt
let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://'
let curislocal = b:netrw_curdir !~ '^\a\{3,}://'
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./'))
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
" call Dret("s:NetrwMarkTarget")
endfun
@@ -6460,6 +6591,48 @@ fun! s:NetrwMarkFile(islocal,fname)
endfun
" ---------------------------------------------------------------------
+" s:NetrwMarkFileArgList: ma: move the marked file list to the argument list (tomflist=0) {{{2
+" mA: move the argument list to marked file list (tomflist=1)
+" Uses the global marked file list
+fun! s:NetrwMarkFileArgList(islocal,tomflist)
+" call Dfunc("s:NetrwMarkFileArgList(islocal=".a:islocal.",tomflist=".a:tomflist.")")
+
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ let curdir = s:NetrwGetCurdir(a:islocal)
+ let curbufnr = bufnr("%")
+
+ if a:tomflist
+ " mA: move argument list to marked file list
+ while argc()
+ let fname= argv(0)
+" call Decho("exe argdel ".fname,'~'.expand("<slnum>"))
+ exe "argdel ".fnameescape(fname)
+ call s:NetrwMarkFile(a:islocal,fname)
+ endwhile
+
+ else
+ " ma: move marked file list to argument list
+ if exists("s:netrwmarkfilelist")
+
+ " for every filename in the marked list
+ for fname in s:netrwmarkfilelist
+" call Decho("exe argadd ".fname,'~'.expand("<slnum>"))
+ exe "argadd ".fnameescape(fname)
+ endfor " for every file in the marked list
+
+ " unmark list and refresh
+ call s:NetrwUnmarkList(curbufnr,curdir)
+ NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
+ endif
+ endif
+
+" call Dret("s:NetrwMarkFileArgList")
+endfun
+
+" ---------------------------------------------------------------------
" s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2
" compress/decompress files using the programs
" in g:netrw_compress and g:netrw_uncompress,
@@ -6469,7 +6642,8 @@ endfun
" g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf", ".xz" : "unxz"}
fun! s:NetrwMarkFileCompress(islocal)
" call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curdir = s:NetrwGetCurdir(a:islocal)
let curbufnr = bufnr("%")
@@ -6524,7 +6698,8 @@ fun! s:NetrwMarkFileCompress(islocal)
call s:NetrwUnmarkList(curbufnr,curdir)
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
endif
" call Dret("s:NetrwMarkFileCompress")
endfun
@@ -6541,6 +6716,12 @@ fun! s:NetrwMarkFileCopy(islocal,...)
let curdir = s:NetrwGetCurdir(a:islocal)
let curbufnr = bufnr("%")
+ if b:netrw_curdir !~ '/$'
+ if !exists("b:netrw_curdir")
+ let b:netrw_curdir= curdir
+ endif
+ let b:netrw_curdir= b:netrw_curdir."/"
+ endif
" sanity check
if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
@@ -6557,7 +6738,7 @@ fun! s:NetrwMarkFileCopy(islocal,...)
endif
" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
- if a:islocal && s:netrwmftgt_islocal
+ if a:islocal && s:netrwmftgt_islocal
" Copy marked files, local directory to local directory
" call Decho("copy from local to local",'~'.expand("<slnum>"))
if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s'
@@ -6571,12 +6752,12 @@ fun! s:NetrwMarkFileCopy(islocal,...)
if len(s:netrwmarkfilelist_{bufnr('%')}) == 1
" only one marked file
" call Decho("case: only one marked file",'~'.expand("<slnum>"))
- let args = s:ShellEscape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0])
+ let args = s:ShellEscape(b:netrw_curdir.s:netrwmarkfilelist_{bufnr('%')}[0])
let oldname = s:netrwmarkfilelist_{bufnr('%')}[0]
elseif a:0 == 1
" call Decho("case: handling one input argument",'~'.expand("<slnum>"))
" this happens when the next case was used to recursively call s:NetrwMarkFileCopy()
- let args = s:ShellEscape(b:netrw_curdir."/".a:1)
+ let args = s:ShellEscape(b:netrw_curdir.a:1)
let oldname = a:1
else
" copy multiple marked files inside the same directory
@@ -6611,9 +6792,12 @@ fun! s:NetrwMarkFileCopy(islocal,...)
let args= substitute(args,'/','\\','g')
let tgt = substitute(tgt, '/','\\','g')
endif
- if args =~ "'"|let args= substitute(args,"'\\(.*\\)'",'\1','')|endif
- if tgt =~ "'"|let tgt = substitute(tgt,"'\\(.*\\)'",'\1','') |endif
- if args =~ '//$'|let args= substitute(args,'//$','/','')|endif
+ if args =~ "'" |let args= substitute(args,"'\\(.*\\)'",'\1','')|endif
+ if tgt =~ "'" |let tgt = substitute(tgt ,"'\\(.*\\)'",'\1','')|endif
+ if args =~ '//'|let args= substitute(args,'//','/','g')|endif
+ if tgt =~ '//'|let tgt = substitute(tgt ,'//','/','g')|endif
+" call Decho("args <".args.">",'~'.expand("<slnum>"))
+" call Decho("tgt <".tgt.">",'~'.expand("<slnum>"))
if isdirectory(s:NetrwFile(args))
" call Decho("args<".args."> is a directory",'~'.expand("<slnum>"))
let copycmd= g:netrw_localcopydircmd
@@ -6688,11 +6872,17 @@ fun! s:NetrwMarkFileCopy(islocal,...)
NetrwKeepj call s:NetrwDelete(fname)
endfor
call s:NetrwLcd(curdir)
- call s:NetrwExe("sil !".g:netrw_localrmdir." ".s: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." ".s:ShellEscape(tmpdir,1) )
- return
+ if v:version < 704 || !has("patch1109")
+ call s:NetrwExe("sil !".g:netrw_localrmdir." ".s: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." ".s:ShellEscape(tmpdir,1) )
+ return
+ endif
+ else
+ if delete(tmpdir,"d")
+ call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
+ endif
endif
else
call s:NetrwLcd(curdir)
@@ -6703,21 +6893,38 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" -------
" cleanup
" -------
-" call Decho("cleanup",'~'.expand("<slnum>"))
- 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
- NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir)
+" call Decho("cleanup",'~'.expand("<slnum>"))
+" call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("<slnum>"))
+" call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("<slnum>"))
+" call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>"))
+" call Decho(" curdir =".curdir,'~'.expand("<slnum>"))
+" call Decho(" a:islocal =".a:islocal,'~'.expand("<slnum>"))
+" call Decho(" curbufnr =".curbufnr,'~'.expand("<slnum>"))
+ if exists("s:recursive")
+" call Decho(" s:recursive =".s:recursive,'~'.expand("<slnum>"))
+ else
+" call Decho(" s:recursive =n/a",'~'.expand("<slnum>"))
endif
+ " see s:LocalFastBrowser() for g:netrw_fastbrowse interpretation (refreshing done for both slow and medium)
if g:netrw_fastbrowse <= 1
NetrwKeepj call s:LocalBrowseRefresh()
+ else
+ " refresh local and targets for fast browsing
+ if !exists("s:recursive")
+ " remove markings from local buffer
+" call Decho(" remove markings from local buffer",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwUnmarkList(curbufnr,curdir)
+ endif
+
+ " refresh buffers
+ if s:netrwmftgt_islocal
+" call Decho(" refresh s:netrwmftgt=".s:netrwmftgt,'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
+ endif
+ if a:islocal && s:netrwmftgt != curdir
+" call Decho(" refresh curdir=".curdir,'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir)
+ endif
endif
" call Dret("s:NetrwMarkFileCopy 1")
@@ -6798,7 +7005,7 @@ fun! s:NetrwMarkFileEdit(islocal)
endfun
" ---------------------------------------------------------------------
-" s:NetrwMarkFileQFEL: convert a quickfix-error list into a marked file list {{{2
+" s:NetrwMarkFileQFEL: convert a quickfix-error or location list into a marked file list {{{2
fun! s:NetrwMarkFileQFEL(islocal,qfel)
" call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)")
call s:NetrwUnmarkAll()
@@ -6834,7 +7041,8 @@ endfun
" mX enbloc=1: Uses the global marked-file list, applies command to entire list
fun! s:NetrwMarkFileExe(islocal,enbloc)
" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curdir = s:NetrwGetCurdir(a:islocal)
let curbufnr = bufnr("%")
@@ -6894,7 +7102,8 @@ fun! s:NetrwMarkFileExe(islocal,enbloc)
" refresh the listing
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
else
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
endif
@@ -6926,7 +7135,8 @@ fun! s:NetrwMarkFileExe(islocal,enbloc)
" refresh the listing
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
endif
@@ -6939,7 +7149,8 @@ endfun
" Uses the local marked file list.
fun! s:NetrwMarkHideSfx(islocal)
" call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curbufnr = bufnr("%")
" s:netrwmarkfilelist_{curbufnr}: the List of marked files
@@ -6982,7 +7193,8 @@ fun! s:NetrwMarkHideSfx(islocal)
" refresh the listing
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
else
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
endif
@@ -6995,7 +7207,8 @@ endfun
" Uses the local marked-file list.
fun! s:NetrwMarkFileVimCmd(islocal)
" call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curdir = s:NetrwGetCurdir(a:islocal)
let curbufnr = bufnr("%")
@@ -7039,7 +7252,8 @@ fun! s:NetrwMarkFileVimCmd(islocal)
" refresh the listing
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
else
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
endif
@@ -7053,7 +7267,8 @@ endfun
" Uses the local marked file list.
fun! s:NetrwMarkHideSfx(islocal)
" call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curbufnr = bufnr("%")
" s:netrwmarkfilelist_{curbufnr}: the List of marked files
@@ -7096,7 +7311,8 @@ fun! s:NetrwMarkHideSfx(islocal)
" refresh the listing
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
else
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
endif
@@ -7109,7 +7325,8 @@ endfun
" Uses the global markfilelist
fun! s:NetrwMarkFileGrep(islocal)
" call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curbufnr = bufnr("%")
let curdir = s:NetrwGetCurdir(a:islocal)
@@ -7150,7 +7367,8 @@ fun! s:NetrwMarkFileGrep(islocal)
echo "(use :cn, :cp to navigate, :Rex to return)"
2match none
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
if exists("nonisi")
" original, user-supplied pattern did not begin with a character from isident
@@ -7456,7 +7674,8 @@ endfun
" Uses the global markfilelist
fun! s:NetrwMarkFileTag(islocal)
" call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curdir = s:NetrwGetCurdir(a:islocal)
let curbufnr = bufnr("%")
@@ -7494,7 +7713,8 @@ fun! s:NetrwMarkFileTag(islocal)
endif
2match none
call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
endif
" call Dret("s:NetrwMarkFileTag")
@@ -7507,8 +7727,9 @@ endfun
" s:netrwmftgt_islocal : 0=target directory is remote
" 1=target directory is local
fun! s:NetrwMarkFileTgt(islocal)
-" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+" call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")")
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curdir = s:NetrwGetCurdir(a:islocal)
let hadtgt = exists("s:netrwmftgt")
if !exists("w:netrw_bannercnt")
@@ -7526,7 +7747,8 @@ fun! s:NetrwMarkFileTgt(islocal)
call s:LocalBrowseRefresh()
endif
call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
" call Dret("s:NetrwMarkFileTgt : removed target")
return
else
@@ -7570,12 +7792,13 @@ fun! s:NetrwMarkFileTgt(islocal)
call s:LocalBrowseRefresh()
endif
" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- if w:netrw_liststyle == s:TREELIST
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop))
else
call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
endif
- call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ call winrestview(svpos)
if !hadtgt
sil! NetrwKeepj norm! j
endif
@@ -7590,7 +7813,7 @@ endfun
fun! s:NetrwGetCurdir(islocal)
" call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")")
- if w:netrw_liststyle == s:TREELIST
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop)
" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("<slnum>"))
elseif !exists("b:netrw_curdir")
@@ -7626,8 +7849,8 @@ fun! s:NetrwOpenFile(islocal)
endif
let g:netrw_quiet = 1
" save position for benefit of Rexplore
- let s:rexposn_{bufnr("%")}= netrw#SavePosn()
-" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>"))
+ let s:rexposn_{bufnr("%")}= winsaveview()
+" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
if b:netrw_curdir =~ '/$'
exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname)
else
@@ -7702,7 +7925,8 @@ fun! s:NetSortSequence(islocal)
" call Dfunc("NetSortSequence(islocal=".a:islocal.")")
let ykeep= @@
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
call inputsave()
let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
call inputrestore()
@@ -7710,7 +7934,8 @@ fun! s:NetSortSequence(islocal)
" refresh the listing
let g:netrw_sort_sequence= newsortseq
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
let @@= ykeep
" call Dret("NetSortSequence")
@@ -7785,7 +8010,8 @@ endfun
" s:netrwmarkfilemtch_# -- used with 2match to display marked files
fun! s:NetrwUnMarkFile(islocal)
" call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")")
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let curbufnr = bufnr("%")
" unmark marked file list
@@ -7806,7 +8032,8 @@ fun! s:NetrwUnMarkFile(islocal)
2match none
" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- call netrw#RestorePosn(svpos)
+"call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+call winrestview(svpos)
" call Dret("s:NetrwUnMarkFile")
endfun
@@ -8276,7 +8503,8 @@ fun! s:NetrwRefresh(islocal,dirname)
let ykeep = @@
" save the cursor position before refresh.
- let screenposn = netrw#SavePosn()
+ let screenposn = winsaveview()
+" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("<slnum>"))
" call Decho("clearing buffer prior to refresh",'~'.expand("<slnum>"))
@@ -8288,7 +8516,8 @@ fun! s:NetrwRefresh(islocal,dirname)
endif
" restore position
- NetrwKeepj call netrw#RestorePosn(screenposn)
+" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(screenposn)
" restore file marks
if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
@@ -8439,8 +8668,8 @@ endfun
" Implements [count]Tb (bookhist<b>)
" [count]Th (bookhist<h>)
" 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.")")
+fun! s:NetrwSetTgt(islocal,bookhist,choice)
+" call Dfunc("s:NetrwSetTgt(islocal=".a:islocal." bookhist<".a:bookhist."> choice#".a:choice.")")
if a:bookhist == 'b'
" supports choosing a bookmark as a target using a qb-generated list
@@ -8462,6 +8691,12 @@ fun! s:NetrwSetTgt(bookhist,choice)
endif
endif
+ " refresh the display
+ if !exists("b:netrw_curdir")
+ let b:netrw_curdir= getcwd()
+ endif
+ call s:NetrwRefresh(a:islocal,b:netrw_curdir)
+
" call Dret("s:NetrwSetTgt")
endfun
@@ -8470,12 +8705,14 @@ endfun
fun! s:NetrwSortStyle(islocal)
" call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">")
NetrwKeepj call s:NetrwSaveWordPosn()
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let g:netrw_sort_by= (g:netrw_sort_by =~ '^n')? 'time' : (g:netrw_sort_by =~ '^t')? 'size' : (g:netrw_sort_by =~ '^siz')? 'exten' : 'name'
NetrwKeepj norm! 0
NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
" call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">")
endfun
@@ -8653,6 +8890,9 @@ endfun
" (full path directory with trailing slash returned)
fun! s:NetrwTreeDir(islocal)
" call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft)
+" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'))
+" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'))
+" call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'))
if exists("s:treedir")
" s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early
@@ -8665,12 +8905,13 @@ fun! s:NetrwTreeDir(islocal)
if !exists("b:netrw_curdir") || b:netrw_curdir == ""
let b:netrw_curdir= getcwd()
endif
-
let treedir = b:netrw_curdir
" call Decho("set initial treedir<".treedir.">",'~'.expand("<slnum>"))
- let s:treecurpos= netrw#SavePosn()
- if w:netrw_liststyle == s:TREELIST
+ let s:treecurpos= winsaveview()
+" call Decho("saving posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
+
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
" call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("<slnum>"))
" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
@@ -8701,13 +8942,12 @@ fun! s:NetrwTreeDir(islocal)
" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">")
return b:netrw_curdir
" else " Decho
-" call Decho(".user did not attempt to close treeroot",'~'.expand("<slnum>"))
+" call Decho(".user not attempting to close treeroot",'~'.expand("<slnum>"))
endif
" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>"))
-" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">",'~'.expand("<slnum>"))
- let potentialdir= substitute(curline,'^'.s:treedepthstring.'* \(.*\)@$','\1','')
-" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(s:NetrwFile(potentialdir)),'~'.expand("<slnum>"))
+ let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1',''))
+" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("<slnum>"))
" COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop
" if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir))
@@ -8763,9 +9003,13 @@ fun! s:NetrwTreeDisplay(dir,depth)
let depth= s:treedepthstring.a:depth
" call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>"))
-" call Decho("w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>"))
+" call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>"))
for entry in w:netrw_treedict[dir]
- let direntry= substitute(dir.'/'.entry,'[@/]$','','e')
+ if dir =~ '/$'
+ let direntry= substitute(dir.entry,'[@/]$','','e')
+ else
+ let direntry= substitute(dir.'/'.entry,'[@/]$','','e')
+ endif
" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>"))
if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
@@ -8786,10 +9030,48 @@ fun! s:NetrwTreeDisplay(dir,depth)
endfun
" ---------------------------------------------------------------------
+" s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2
+fun! s:NetrwRefreshTreeDict(dir)
+" call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)")
+ for entry in w:netrw_treedict[a:dir]
+ let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e')
+" call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>"))
+
+ if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
+" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefreshTreeDict(direntry)
+ let liststar = s:NetrwGlob(direntry,'*')
+ let listdotstar = s:NetrwGlob(direntry,'.*')
+ let w:netrw_treedict[direntry] = liststar + listdotstar
+" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
+
+ elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/')
+" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/')
+ let liststar = s:NetrwGlob(direntry.'/','*')
+ let listdotstar= s:NetrwGlob(direntry.'/','.*')
+ let w:netrw_treedict[direntry]= liststar + listdotstar
+" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
+
+ elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@')
+" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
+ NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/')
+ let liststar = s:NetrwGlob(direntry.'/','*')
+ let listdotstar= s:NetrwGlob(direntry.'/','.*')
+" call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
+
+ else
+" call Decho('not updating w:netrw_treedict['.direntry.'] with entry<'.entry.'> (no subtree)',,'~'.expand("<slnum>"))
+ endif
+ endfor
+" call Dret("s:NetrwRefreshTreeDict")
+endfun
+
+" ---------------------------------------------------------------------
" s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2
" Called by s:PerformListing()
fun! s:NetrwTreeListing(dirname)
- if w:netrw_liststyle == s:TREELIST
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
" call Dfunc("NetrwTreeListing() bufname<".expand("%").">")
" call Decho("curdir<".a:dirname.">",'~'.expand("<slnum>"))
" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("<slnum>"))
@@ -8811,13 +9093,13 @@ fun! s:NetrwTreeListing(dirname)
let w:netrw_treedict= {}
endif
- " update the directory listing for the current directory
-" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]",'~'.expand("<slnum>"))
+ " update the dictionary for the current directory
+" call Decho("updating: w:netrw_treedict[".a:dirname.'] -> [directory listing]','~'.expand("<slnum>"))
" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>"))
- exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d'
+ exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d _'
let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$"))
" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("<slnum>"))
- exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d"
+ exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _"
" if past banner, record word
if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt
@@ -8852,6 +9134,8 @@ endfun
" wipes that out prior to calling this function
fun! s:NetrwTreePath(treetop)
" call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">")
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
" call Decho("depth<".depth."> 1st subst",'~'.expand("<slnum>"))
let depth = substitute(depth,'^'.s:treedepthstring,'','')
@@ -8886,6 +9170,8 @@ fun! s:NetrwTreePath(treetop)
let treedir= a:treetop.'/'.treedir
endif
let treedir= substitute(treedir,'//$','/','')
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))"
+ call winrestview(svpos)
" call Dret("s:NetrwTreePath <".treedir.">")
return treedir
endfun
@@ -8930,6 +9216,7 @@ fun! s:NetrwWideListing()
" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>"))
if has("clipboard")
sil! let keepregstar = @*
+ sil! let keepregplus = @+
endif
while line("$") >= newcolstart
if newcolend > line("$") | let newcolend= line("$") | endif
@@ -8940,11 +9227,12 @@ fun! s:NetrwWideListing()
else
exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
endif
- exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d'
+ exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
exe 'sil! NetrwKeepj '.w:netrw_bannercnt
endwhile
if has("clipboard")
sil! let @*= keepregstar
+ sil! let @+= keepregplus
endif
exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e'
NetrwKeepj call histdel("/",-1)
@@ -9205,7 +9493,7 @@ fun! s:PerformListing(islocal)
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("<slnum>"))
" resolve symbolic links if local and (thin or tree)
- if a:islocal && (w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:TREELIST)
+ if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST))
" call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("<slnum>"))
g/@$/call s:ShowLink()
endif
@@ -9247,7 +9535,8 @@ fun! s:PerformListing(islocal)
if exists("s:treecurpos")
" call Decho("s:treecurpos exists; restore posn",'~'.expand("<slnum>"))
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("<slnum>"))
- NetrwKeepj call netrw#RestorePosn(s:treecurpos)
+" call Decho("restoring posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(s:treecurpos)
unlet s:treecurpos
endif
@@ -9310,7 +9599,7 @@ endfun
" enforced here.
fun! s:NetrwRemoteFtpCmd(path,listcmd)
" 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,'~'.expand("<slnum>"))
+" call Decho("line($)=".line("$")." win#".winnr()." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>"))
" sanity check: {{{3
if !exists("w:netrw_method")
if exists("b:netrw_method")
@@ -9329,8 +9618,8 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
" clear off any older non-banner lines " {{{3
" note that w:netrw_bannercnt indexes the line after the banner
-" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)",'~'.expand("<slnum>"))
- exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d"
+" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d _ (clear off old non-banner lines)",'~'.expand("<slnum>"))
+ exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _"
".........................................
if w:netrw_method == 2 || w:netrw_method == 5 " {{{3
@@ -9427,7 +9716,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e
NetrwKeepj call histdel("/",-1)
NetrwKeepj call histdel("/",-1)
- if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
+ if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)
exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e'
NetrwKeepj call histdel("/",-1)
endif
@@ -9451,7 +9740,7 @@ endfun
" ---------------------------------------------------------------------
" s:NetrwRemoteListing: {{{2
fun! s:NetrwRemoteListing()
-" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)")
+" call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">) win#".winnr())
if !exists("w:netrw_bannercnt") && exists("s:bannercnt")
let w:netrw_bannercnt= s:bannercnt
@@ -9515,7 +9804,7 @@ fun! s:NetrwRemoteListing()
let mesg= getline(".")
if exists("w:netrw_bannercnt")
setl ma
- exe w:netrw_bannercnt.",$d"
+ exe w:netrw_bannercnt.",$d _"
setl noma
endif
NetrwKeepj call s:NetrwOptionRestore("w:")
@@ -9524,7 +9813,7 @@ fun! s:NetrwRemoteListing()
return -1
endif
- if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
+ if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)
" shorten the listing
" call Decho("generate short listing",'~'.expand("<slnum>"))
exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt
@@ -9654,7 +9943,8 @@ endfun
fun! s:NetrwRemoteRm(usrhost,path) range
" call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>"))
- let svpos= netrw#SavePosn()
+ let svpos= winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let all= 0
if exists("s:netrwmarkfilelist_{bufnr('%')}")
@@ -9696,7 +9986,8 @@ fun! s:NetrwRemoteRm(usrhost,path) range
" refresh the (remote) directory listing
" call Decho("refresh remote directory listing",'~'.expand("<slnum>"))
NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
" call Dret("s:NetrwRemoteRm")
endfun
@@ -9736,7 +10027,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all)
if path =~ '^\a\{3,}://'
let path= substitute(path,'^\a\{3,}://[^/]\+/','','')
endif
- sil! NetrwKeepj .,$d
+ sil! NetrwKeepj .,$d _
call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"')
else
" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("<slnum>"))
@@ -9827,7 +10118,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range
" call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)")
" preparation for removing multiple files/directories
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
let ctr = a:firstline
let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd)
@@ -9893,7 +10185,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range
" refresh the directory
NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
" call Dret("NetrwRemoteRename")
endfun
@@ -9955,7 +10248,7 @@ endfun
" ---------------------------------------------------------------------
" netrw#LocalBrowseCheck: {{{2
fun! netrw#LocalBrowseCheck(dirname)
- " This function is called by netrwPlugin.vim's s:LocalBrowse() and by s:NetrwRexplore()
+ " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), and by <cr> when atop listed file/directory
" unfortunate interaction -- split window debugging can't be
" used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter
" event triggers another call to LocalBrowseCheck() when attempts
@@ -10074,6 +10367,9 @@ fun! s:LocalBrowseRefresh()
let g:netrw_quickhelp= g:netrw_quickhelp - 1
endif
" call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("<slnum>"))
+ if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
+ NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop)
+ endif
NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
endif
let ibl= ibl + 1
@@ -10263,6 +10559,9 @@ fun! s:LocalListing()
if w:netrw_liststyle == s:LONGLIST
let sz = getfsize(filename)
+ if g:netrw_sizestyle =~ "[hH]"
+ let sz= s:NetrwHumanReadable(sz)
+ endif
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,'~'.expand("<slnum>"))
@@ -10281,6 +10580,9 @@ fun! s:LocalListing()
" sort by size (handles file sizes up to 1 quintillion bytes, US)
" call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("<slnum>"))
let sz = getfsize(filename)
+ if g:netrw_sizestyle =~ "[hH]"
+ let sz= s:NetrwHumanReadable(sz)
+ endif
let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("<slnum>"))
let fszpfile= fsz.'/'.pfile
@@ -10339,7 +10641,8 @@ fun! s:NetrwLocalRename(path) range
" preparation for removing multiple files/directories
let ykeep = @@
let ctr = a:firstline
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
" rename files given by the markfilelist
if exists("s:netrwmarkfilelist_{bufnr('%')}")
@@ -10405,7 +10708,8 @@ fun! s:NetrwLocalRename(path) range
" refresh the directory
" call Decho("refresh the directory listing",'~'.expand("<slnum>"))
NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
let @@= ykeep
" call Dret("NetrwLocalRename")
@@ -10421,7 +10725,8 @@ fun! s:NetrwLocalRm(path) range
let ykeep = @@
let ret = 0
let all = 0
- let svpos = netrw#SavePosn()
+ let svpos = winsaveview()
+" call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
if exists("s:netrwmarkfilelist_{bufnr('%')}")
" remove all marked files
@@ -10471,7 +10776,8 @@ fun! s:NetrwLocalRm(path) range
" call Decho("bufname<".bufname("%").">",'~'.expand("<slnum>"))
if bufname("%") != "NetrwMessage"
NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
- NetrwKeepj call netrw#RestorePosn(svpos)
+" call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(svpos)
endif
let @@= ykeep
@@ -10533,28 +10839,34 @@ fun! s:NetrwLocalRmFile(path,fname,all)
let rmfile= substitute(rmfile,'[\/]$','','e')
if all || ok =~ 'y\%[es]' || ok == ""
-" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>"))
- call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile))
-" call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>"))
+ if v:version < 704 || !has("patch1109")
+" " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>"))
+ call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile))
+" " call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>"))
- if v:shell_error != 0
-" call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
- let errcode= s:NetrwDelete(rmfile)
-" call Decho("errcode=".errcode,'~'.expand("<slnum>"))
-
- if errcode != 0
- if has("unix")
-" call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
- call system("rm ".s: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)
+ if v:shell_error != 0
+" " call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
+ let errcode= s:NetrwDelete(rmfile)
+" " call Decho("errcode=".errcode,'~'.expand("<slnum>"))
+
+ if errcode != 0
+ if has("unix")
+" " call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
+ call system("rm ".s: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
- elseif !exists("g:netrw_quiet")
- call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35)
- let ok="no"
endif
endif
+ else
+ if delete(rmfile,"d")
+ call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
+ endif
endif
endif
endif
@@ -10594,81 +10906,6 @@ fun! netrw#Call(funcname,...)
endfun
" ------------------------------------------------------------------------
-" netrw#RestorePosn: restores the cursor and file position as saved by netrw#SavePosn() {{{2
-fun! netrw#RestorePosn(...)
-" call Dfunc("netrw#RestorePosn() a:0=".a:0." winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1))
- let eikeep= &ei
- setl ei=all
- if expand("%") == "NetrwMessage"
- if exists("s:winBeforeErr")
- exe s:winBeforeErr."wincmd w"
- endif
- endif
-
- if a:0 > 0
- exe "keepj ".a:1
- endif
-" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a'),'~'.expand("<slnum>"))
-" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
- if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle
- let usesrch= 1
- else
- let usesrch= 0
- endif
-
-" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1),'~'.expand("<slnum>"))
-" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1),'~'.expand("<slnum>"))
-" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0),'~'.expand("<slnum>"))
-" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a'),'~'.expand("<slnum>"))
-
- " restore window
- if exists("w:netrw_winnr")
-" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w",'~'.expand("<slnum>"))
- exe "sil! ".w:netrw_winnr."wincmd w"
- endif
-" if v:shell_error == 0
- " as suggested by Bram M: redraw on no error
- " allows protocol error messages to remain visible
-" redraw!
-" endif
-
- " restore top-of-screen line
- if exists("w:netrw_hline")
-" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z",'~'.expand("<slnum>"))
- exe "keepj norm! ".w:netrw_hline."G0z\<CR>"
- endif
-
- " restore position
- " when the window's height x width has changed, the line,col is no longer useful
- if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch
-" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|",'~'.expand("<slnum>"))
- exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>"
-
- elseif exists("w:netrw_winfile")
- if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw')
- if exists("w:netrw_bannercnt")
-" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>"))
- exe "keepj ".w:netrw_bannercnt
- norm! 0
- else
- " go to upper left corner
-" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>"))
- keepj 1
- norm! 0
- endif
- else
-" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("<slnum>"))
- endif
-
- else
-" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0),'~'.expand("<slnum>"))
- keepj 1
- norm! 0
- endif
-
- let &ei= eikeep
-" call Dret("netrw#RestorePosn : line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol())
-endfun
" ---------------------------------------------------------------------
" netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2
@@ -10713,48 +10950,6 @@ fun! netrw#RFC2396(fname)
endfun
" ---------------------------------------------------------------------
-" netrw#SavePosn: saves position of cursor on screen {{{2
-fun! netrw#SavePosn()
-" call Dfunc("netrw#SavePosn() win#".winnr()." 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,'~'.expand("<slnum>"))
-
- " save filename under cursor
-" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>"))
- if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw"
- let winfile = "|let w:netrw_winfile=\"".fnameescape(s:NetrwGetWord())."\""
- else
- let winfile= ""
- endif
-" "call Decho("winfile<".winfile.">",'~'.expand("<slnum>"))
- if exists("w:netrw_liststyle")
- let liststyle = "|let liststyle=".w:netrw_liststyle
- else
- let liststyle= ""
- endif
-" "call Decho("liststyle=".liststyle,'~'.expand("<slnum>"))
-
- " Save top-of-screen line
- keepj norm! H0
- let w:netrw_hline= line(".")
-
- " save up alternate position information
- " use this when window height x width has changed
- let w:netrw_winh = winheight(0)
- let w:netrw_winw = winwidth(0)
-
- " 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."|let w:netrw_winh=".w:netrw_winh."|let w:netrw_winw=".w:netrw_winw.liststyle.winfile
-
- keepj call netrw#RestorePosn()
-" call Dret("netrw#SavePosn : win#=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a"))
- return ret
-endfun
-
-" ---------------------------------------------------------------------
" netrw#UserMaps: supports user-specified maps {{{2
" see :help function()
"
@@ -11198,6 +11393,9 @@ fun! s:NetrwEnew(...)
NetrwKeepj call s:NetrwOptionRestore("w:")
" call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>"))
+ " when tree listing uses file TreeListing... a new buffer is made.
+ " Want the old buffer to be unlisted.
+ setl nobl
let netrw_keepdiff= &l:diff
noswapfile NetrwKeepj keepalt enew!
let &l:diff= netrw_keepdiff
@@ -11227,8 +11425,9 @@ fun! s:NetrwEnew(...)
let b:netrw_curdir= a:1
if b:netrw_curdir =~ '/$'
if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
+ setl nobl
file NetrwTreeListing
- setl bt=nowrite noswf bh=hide
+ setl nobl bt=nowrite bh=hide
nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr>
nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr>
else
@@ -11331,6 +11530,50 @@ fun! s:NetrwSaveWordPosn()
endfun
" ---------------------------------------------------------------------
+" s:NetrwHumanReadable: takes a number and makes it "human readable" {{{2
+" 1000 -> 1K, 1000000 -> 1M, 1000000000 -> 1G
+fun! s:NetrwHumanReadable(sz)
+" call Dfunc("s:NetrwHumanReadable(sz=".a:sz.") type=".type(a:sz)." style=".g:netrw_sizestyle )
+
+ if g:netrw_sizestyle == 'h'
+ if a:sz >= 1000000000
+ let sz = printf("%.1f",a:sz/1000000000.0)."g"
+ elseif a:sz >= 10000000
+ let sz = printf("%d",a:sz/1000000)."m"
+ elseif a:sz >= 1000000
+ let sz = printf("%.1f",a:sz/1000000.0)."m"
+ elseif a:sz >= 10000
+ let sz = printf("%d",a:sz/1000)."k"
+ elseif a:sz >= 1000
+ let sz = printf("%.1f",a:sz/1000.0)."k"
+ else
+ let sz= a:sz
+ endif
+
+ elseif g:netrw_sizestyle == 'H'
+ if a:sz >= 1073741824
+ let sz = printf("%.1f",a:sz/1073741824.0)."G"
+ elseif a:sz >= 10485760
+ let sz = printf("%d",a:sz/1048576)."M"
+ elseif a:sz >= 1048576
+ let sz = printf("%.1f",a:sz/1048576.0)."M"
+ elseif a:sz >= 10240
+ let sz = printf("%d",a:sz/1024)."K"
+ elseif a:sz >= 1024
+ let sz = printf("%.1f",a:sz/1024.0)."K"
+ else
+ let sz= a:sz
+ endif
+
+ else
+ let sz= a:sz
+ endif
+
+" call Dret("s:NetrwHumanReadable ".sz)
+ return sz
+endfun
+
+" ---------------------------------------------------------------------
" s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2
" changed sorting, etc. Also see s:NetrwSaveWordPosn().
fun! s:NetrwRestoreWordPosn()
@@ -11449,7 +11692,7 @@ fun! s:NetrwRexplore(islocal,dirname)
if exists("s:netrwdrag")
return
endif
-" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">")
+" call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir."> win#".winnr())
" call Decho("currently in bufname<".bufname("%").">",'~'.expand("<slnum>"))
" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>"))
@@ -11474,7 +11717,7 @@ fun! s:NetrwRexplore(islocal,dirname)
" call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("<slnum>"))
if !exists("w:netrw_rexlocal")
-" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft.")")
+" call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft." win#".winnr().")")
return
endif
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
@@ -11489,7 +11732,8 @@ fun! s:NetrwRexplore(islocal,dirname)
if exists("s:rexposn_".bufnr("%"))
" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("<slnum>"))
" restore position in directory listing
- NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')})
+" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>"))
+ NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
if exists("s:rexposn_".bufnr('%'))
unlet s:rexposn_{bufnr('%')}
endif
@@ -11571,10 +11815,13 @@ endfun
" ---------------------------------------------------------------------
" s:SetRexDir: set directory for :Rexplore {{{2
fun! s:SetRexDir(islocal,dirname)
-" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)")
+" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">) win#".winnr())
let w:netrw_rexdir = a:dirname
let w:netrw_rexlocal = a:islocal
- let s:rexposn_{bufnr("%")} = netrw#SavePosn()
+ let s:rexposn_{bufnr("%")} = winsaveview()
+" call Decho("setting w:netrw_rexdir =".w:netrw_rexdir)
+" call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal)
+" call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("<slnum>"))
" call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname)
endfun
@@ -11685,56 +11932,39 @@ fun! s:ShellEscape(s, ...)
endfun
" ---------------------------------------------------------------------
-" s:TreeListMove: {{{2
+" s:TreeListMove: supports [[, ]], [], and ][ in tree mode {{{2
fun! s:TreeListMove(dir)
" call Dfunc("s:TreeListMove(dir<".a:dir.">)")
- let curline = getline('.')
- let prvline = (line(".") > 1)? getline(line(".")-1) : ''
- let nxtline = (line(".") < line("$"))? getline(line(".")+1) : ''
- let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','')
- let indentm1 = substitute(curindent,'^'.s:treedepthstring.' ','','')
-" call Decho("prvline <".prvline."> #".line(".")-1,'~'.expand("<slnum>"))
-" call Decho("curline <".curline."> #".line("."),'~'.expand("<slnum>"))
-" call Decho("nxtline <".nxtline."> #".line(".")+1,'~'.expand("<slnum>"))
-" call Decho("curindent<".curindent.">",'~'.expand("<slnum>"))
-" call Decho("indentm1 <".indentm1.">",'~'.expand("<slnum>"))
-
+ let curline = getline('.')
+ let prvline = (line(".") > 1)? getline(line(".")-1) : ''
+ let nxtline = (line(".") < line("$"))? getline(line(".")+1) : ''
+ let curindent = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
+ let indentm1 = substitute(curindent,'^'.s:treedepthstring,'','')
+ let treedepthchr = substitute(s:treedepthstring,' ','','g')
+ let stopline = exists("w:netrw_bannercnt")? w:netrw_bannercnt : 1
+" call Decho("prvline <".prvline."> #".(line(".")-1), '~'.expand("<slnum>"))
+" call Decho("curline <".curline."> #".line(".") , '~'.expand("<slnum>"))
+" call Decho("nxtline <".nxtline."> #".(line(".")+1), '~'.expand("<slnum>"))
+" call Decho("curindent<".curindent.">" , '~'.expand("<slnum>"))
+" call Decho("indentm1 <".indentm1.">" , '~'.expand("<slnum>"))
+ " COMBAK : need to handle when on a directory
+ " COMBAK : need to handle ]] and ][. In general, needs work!!!
if curline !~ '/$'
-" call Decho('regfile','~'.expand("<slnum>"))
- if a:dir == '[' && prvline != ''
+ if a:dir == '[[' && prvline != ''
NetrwKeepj norm! 0
- let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file
+ let nl = search('^'.indentm1.'\%('.s:treedepthstring.'\)\@!','bWe',stopline) " search backwards
" call Decho("regfile srch back: ".nl,'~'.expand("<slnum>"))
- elseif a:dir == ']' && nxtline != ''
- NetrwKeepj norm! $
- let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file
-" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>"))
- endif
-
- elseif a:dir == '[' && prvline != ''
- NetrwKeepj norm! 0
- let curline= line(".")
- let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation
-" call Decho("dir srch back ind: ".nl,'~'.expand("<slnum>"))
- if nl != 0
- if line(".") == curline-1
- let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from directory, indentation - 1
-" call Decho("dir srch back ind-1: ".nl,'~'.expand("<slnum>"))
- endif
- endif
-
- elseif a:dir == ']' && nxtline != ''
- NetrwKeepj norm! $
- let curline = line(".")
- let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation
-" call Decho("dir srch fwd ind: ".nl,'~'.expand("<slnum>"))
- if nl != 0
- if line(".") == curline+1
- let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from directory, indentation - 1
-" call Decho("dir srch fwd ind-1: ".nl,'~'.expand("<slnum>"))
+ elseif a:dir == '[]' && nxtline != ''
+ NetrwKeepj norm! 0
+" call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>')
+ let nl = search('^\%('.curindent.'\)\@!','We') " search forwards
+ if nl != 0
+ NetrwKeepj norm! k
+ else
+ NetrwKeepj norm! G
endif
+" call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>"))
endif
-
endif
" call Dret("s:TreeListMove")
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index c7cb14ded7..2272519dfd 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -94,6 +94,7 @@ function! s:clipboard.set(lines, regtype, reg)
let selection.data = [a:lines, a:regtype]
let argv = split(s:copy[a:reg], " ")
let selection.detach = s:cache_enabled
+ let selection.cwd = "/"
let jobid = jobstart(argv, selection)
if jobid <= 0
echohl WarningMsg
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index 4a8863e15f..e80729add4 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,8 +1,8 @@
" Vim OMNI completion script for SQL
" Language: SQL
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
-" Version: 15.0
-" Last Change: 2013 May 13
+" Version: 16.0
+" Last Change: 2015 Dec 29
" Homepage: http://www.vim.org/scripts/script.php?script_id=1572
" Usage: For detailed help
" ":help sql.txt"
@@ -16,6 +16,12 @@
" look backwards to a FROM clause and find the first table
" and complete it.
"
+" Version 16.0 (Dec 2015)
+" - NF: If reseting the cache and table, procedure or view completion
+" had been used via dbext, have dbext delete or recreate the
+" dictionary so that new objects are picked up for the
+" next completion.
+"
" 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.
@@ -103,7 +109,7 @@ endif
if exists('g:loaded_sql_completion')
finish
endif
-let g:loaded_sql_completion = 150
+let g:loaded_sql_completion = 160
let s:keepcpo= &cpo
set cpo&vim
@@ -459,6 +465,29 @@ function! sqlcomplete#Complete(findstart, base)
let s:tbl_cols = []
let s:syn_list = []
let s:syn_value = []
+
+ if s:sql_file_table != ""
+ if g:loaded_dbext >= 2300
+ call DB_DictionaryDelete("table")
+ else
+ DBCompleteTables!
+ endif
+ endif
+ if s:sql_file_procedure != ""
+ if g:loaded_dbext >= 2300
+ call DB_DictionaryDelete("procedure")
+ else
+ DBCompleteProcedures!
+ endif
+ endif
+ if s:sql_file_view != ""
+ if g:loaded_dbext >= 2300
+ call DB_DictionaryDelete("view")
+ else
+ DBCompleteViews!
+ endif
+ endif
+
let s:sql_file_table = ""
let s:sql_file_procedure = ""
let s:sql_file_view = ""
diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile
index 7423e63673..3d10d0ea98 100644
--- a/runtime/doc/Makefile
+++ b/runtime/doc/Makefile
@@ -6,32 +6,14 @@
AWK = awk
-# Set to $(VIMTARGET) when executed from src/Makefile.
-VIMEXE = vim
-
DOCS = $(wildcard *.txt)
HTMLS = $(DOCS:.txt=.html)
.SUFFIXES:
.SUFFIXES: .c .o .txt .html
-all: tags html
-
-# Use Vim to generate the tags file. Can only be used when Vim has been
-# compiled and installed. Supports multiple languages.
-vimtags: $(DOCS)
- $(VIMEXE) -u NONE -es -c "helptags ++t ." -c quit
-
-# Use "doctags" to generate the tags file. Only works for English!
-tags: doctags $(DOCS)
- ./doctags $(DOCS) | LANG=C LC_ALL=C sort >tags
- uniq -d -2 tags
-
-doctags: doctags.c
- $(CC) doctags.c -o doctags
-
# Awk version of .txt to .html conversion.
-html: noerrors tags $(HTMLS)
+html: noerrors $(HTMLS)
@if test -f errors.log; then cat errors.log; fi
noerrors:
@@ -54,5 +36,5 @@ tags.ref tags.html: tags
$(AWK) -f maketags.awk tags >tags.html
clean:
- -rm -f doctags *.html tags.ref $(HTMLS) errors.log
+ -rm -f *.html tags.ref $(HTMLS) errors.log
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index c8eb0705f6..c3f1b69da7 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1,4 +1,4 @@
-*change.txt* For Vim version 7.4. Last change: 2016 Jan 02
+*change.txt* For Vim version 7.4. Last change: 2016 Feb 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -97,10 +97,10 @@ These commands delete text. You can repeat them with the `.` command
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. Use the |o_v| operator to force the motion to be
-characterwise.
+blanks before the start and there are no non-blanks 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. 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.
@@ -396,6 +396,11 @@ CTRL-X Subtract [count] from the number or alphabetic
{Visual}CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. {not in Vi}
+ On MS-Windows, this is mapped to cut Visual text
+ |dos-standard-mappings|. If you want to disable the
+ mapping, use this: >
+ silent! vunmap <C-X>
+<
*v_g_CTRL-X*
{Visual}g CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. If several lines
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 668790358b..8881845fdd 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -1,4 +1,4 @@
-*develop.txt* For Vim version 7.4. Last change: 2014 Mar 27
+*develop.txt* For Vim version 7.4. Last change: 2016 Jan 31
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/doctags.c b/runtime/doc/doctags.c
deleted file mode 100644
index 9213dd9c1e..0000000000
--- a/runtime/doc/doctags.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* vim:set ts=4 sw=4:
- * this program makes a tags file for vim_ref.txt
- *
- * Usage: doctags vim_ref.txt vim_win.txt ... >tags
- *
- * A tag in this context is an identifier between stars, e.g. *c_files*
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#define LINELEN 200
-
- int
-main(argc, argv)
- int argc;
- char **argv;
-{
- char line[LINELEN];
- char *p1, *p2;
- char *p;
- FILE *fd;
-
- if (argc <= 1)
- {
- fprintf(stderr, "Usage: doctags docfile ... >tags\n");
- exit(1);
- }
- printf("help-tags\ttags\t1\n");
- while (--argc > 0)
- {
- ++argv;
- fd = fopen(argv[0], "r");
- if (fd == NULL)
- {
- fprintf(stderr, "Unable to open %s for reading\n", argv[0]);
- continue;
- }
- while (fgets(line, LINELEN, fd) != NULL)
- {
- p1 = strchr(line, '*'); /* find first '*' */
- while (p1 != NULL)
- {
- p2 = strchr(p1 + 1, '*'); /* find second '*' */
- if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */
- {
- for (p = p1 + 1; p < p2; ++p)
- if (*p == ' ' || *p == '\t' || *p == '|')
- break;
- /*
- * Only accept a *tag* when it consists of valid
- * characters, there is white space before it and is
- * followed by a white character or end-of-line.
- */
- if (p == p2
- && (p1 == line || p1[-1] == ' ' || p1[-1] == '\t')
- && (strchr(" \t\n\r", p[1]) != NULL
- || p[1] == '\0'))
- {
- *p2 = '\0';
- ++p1;
- printf("%s\t%s\t/*", p1, argv[0]);
- while (*p1)
- {
- /* insert backslash before '\\' and '/' */
- if (*p1 == '\\' || *p1 == '/')
- putchar('\\');
- putchar(*p1);
- ++p1;
- }
- printf("*\n");
- p2 = strchr(p2 + 1, '*'); /* find next '*' */
- }
- }
- p1 = p2;
- }
- }
- fclose(fd);
- }
- return 0;
-}
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index c51286a350..69f834b04d 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1,4 +1,4 @@
-*editing.txt* For Vim version 7.4. Last change: 2016 Jan 03
+*editing.txt* For Vim version 7.4. Last change: 2016 Feb 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -368,16 +368,21 @@ Note there are some commands where this works slightly differently, see
Example: >
:n **/*.txt
Finds files:
- ttt.txt
- subdir/ttt.txt
- a/b/c/d/ttt.txt
-When non-wildcard characters are used these are only matched in the first
-directory. Example: >
- :n /usr/inc**/*.h
+ aaa.txt ~
+ subdir/bbb.txt ~
+ a/b/c/d/ccc.txt ~
+When non-wildcard characters are used right before or after "**" these are
+only matched in the top directory. They are not used for directories further
+down in the tree. For example: >
+ :n /usr/inc**/types.h
Finds files:
- /usr/include/types.h
- /usr/include/sys/types.h
- /usr/inc_old/types.h
+ /usr/include/types.h ~
+ /usr/include/sys/types.h ~
+ /usr/inc/old/types.h ~
+Note that the path with "/sys" is included because it does not need to match
+"/inc". Thus it's like matching "/usr/inc*/*/*...", not
+"/usr/inc*/inc*/inc*".
+
*backtick-expansion* *`-expansion*
On Unix and a few other systems you can also use backticks for the file name
argument, for example: >
@@ -596,6 +601,7 @@ list of the current window.
:0argadd x x a b c
:1argadd x a x b c
:$argadd x a b c x
+ And after the last one:
:+2argadd y a b c x y
There is no check for duplicates, it is possible to
add a file to the argument list twice.
@@ -946,7 +952,7 @@ the newly written file (it might be there but contain bogus data). In that
case try recovery, because the swap file is synced to disk and might still be
there. |:recover|
-The directories given with the 'backupdir' option is used to put the backup
+The directories given with the 'backupdir' option are used to put the backup
file in. (default: same directory as the written file).
Whether the backup is a new file, which is a copy of the original file, or the
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a8504e2a2a..869fcf0078 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16
+*eval.txt* For Vim version 7.4. Last change: 2016 Feb 19
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -100,6 +100,9 @@ When mixing Number and Float the Number is converted to Float. Otherwise
there is no automatic conversion of Float. You can use str2float() for String
to Float, printf() for Float to String and float2nr() for Float to Number.
+ *E891* *E892* *E893* *E894*
+When expecting a Float a Number can also be used, but nothing else.
+
*E706* *sticky-type-checking*
You will get an error if you try to change the type of a variable. You need
to |:unlet| it first to avoid this error. String and Number are considered
@@ -870,7 +873,7 @@ cursor: >
:let c = getline(".")[col(".") - 1]
If the length of the String is less than the index, the result is an empty
-String. A negative index always results in an empty string (reason: backwards
+String. A negative index always results in an empty string (reason: backward
compatibility). Use [-1:] to get the last byte.
If expr8 is a |List| then it results the item at index expr1. See |list-index|
@@ -1788,8 +1791,8 @@ arglistid([{winnr} [, {tabnr}]]) Number argument list id
argv({nr}) String {nr} entry of the argument list
argv() List the argument list
assert_equal({exp}, {act} [, {msg}]) none assert {exp} equals {act}
-assert_exception({error} [, {msg}]) none assert {error} is in v:exception
-assert_fails( {cmd} [, {error}]) none assert {cmd} fails
+assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
+assert_fails( {cmd} [, {error}]) none assert {cmd} fails
assert_false({actual} [, {msg}]) none assert {actual} is false
assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr}
@@ -1921,7 +1924,7 @@ has_key({dict}, {key}) Number TRUE if {dict} has entry {key}
haslocaldir() Number TRUE if current window executed |:lcd|
hasmapto({what} [, {mode} [, {abbr}]])
Number TRUE if mapping to {what} exists
-histadd({history},{item}) String add an item to a history
+histadd({history}, {item}) String add an item to a history
histdel({history} [, {item}]) String remove an item from a history
histget({history} [, {index}]) String get the item {index} from a history
histnr({history}) Number highest index of a history
@@ -2212,7 +2215,7 @@ argidx() The result is the current index in the argument list. 0 is
the first file. argc() - 1 is the last one. See |arglist|.
*arglistid()*
-arglistid([{winnr}, [ {tabnr} ]])
+arglistid([{winnr} [, {tabnr}]])
Return the argument list ID. This is a number which
identifies the argument list being used. Zero is used for the
global argument list. See |arglist|.
@@ -3171,6 +3174,11 @@ feedkeys({string} [, {mode}]) *feedkeys()*
if coming from a mapping. This matters for undo,
opening folds, etc.
'i' Insert the string instead of appending (see above).
+ 'x' Execute commands until typeahead is empty. This is
+ similar to using ":normal!". You can call feedkeys()
+ several times without 'x' and then one time with 'x'
+ (possibly with an empty {string}) to execute all the
+ typeahead.
Return value is always 0.
filereadable({file}) *filereadable()*
@@ -3665,7 +3673,8 @@ getftype({fname}) *getftype()*
getftype("/home")
< Note that a type such as "link" will only be returned on
systems that support it. On some systems only "dir" and
- "file" are returned.
+ "file" are returned. On MS-Windows a symbolic link to a
+ directory returns "dir" instead of "link".
*getline()*
getline({lnum} [, {end}])
@@ -4300,21 +4309,24 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()*
with 'shell' or 'shellcmdflag' options. The above call is
only written to show the idea, one needs to perform unquoting
and do split taking quotes into account.
- If passed, {opts} must be a dictionary with any of the
- following keys:
- - on_stdout: stdout event handler
- - on_stderr: stderr event handler
- - on_exit: exit event handler
- - pty: If set, the job will be connected to a new pseudo
- terminal, and the job streams are connected to the master
- file descriptor.
- - width: Width of the terminal screen(only if pty is set)
- - height: Height of the terminal screen(only if pty is set)
- - TERM: $TERM environment variable(only if pty is set)
- - detach: Detach the job process from the nvim process. The
- process won't get killed when nvim exists. If the process
- dies before nvim exits, on_exit will still be invoked.
- This option is only allowed for non-pty jobs.
+
+ {opts} is a dictionary with these keys:
+ on_stdout: stdout event handler
+ on_stderr: stderr event handler
+ on_exit : exit event handler
+ cwd : Working directory of the job; defaults to
+ |current-directory|.
+ pty : If set, the job will be connected to a new pseudo
+ terminal, and the job streams are connected to
+ the master file descriptor.
+ width : (pty only) Width of the terminal screen
+ height : (pty only) Height of the terminal screen
+ TERM : (pty only) $TERM environment variable
+ detach : (non-pty only) Detach the job process from the
+ nvim process. The process will not get killed
+ when nvim exits. If the process dies before
+ nvim exits, on_exit will still be invoked.
+
Either funcrefs or function names can be passed as event
handlers. The {opts} object is also used as the "self"
argument for the callback, so the caller may pass arbitrary
@@ -4746,8 +4758,8 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
respectively. If the {id} argument is not specified or -1,
|matchadd()| automatically chooses a free ID.
- The optional {dict} argmument allows for further custom
- values. Currently this is used to specify a match specifc
+ The optional {dict} argument allows for further custom
+ values. Currently this is used to specify a match specific
conceal character that will be shown for |hl-Conceal|
highlighted matches. The dict can have the following members:
@@ -5600,7 +5612,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
'ignorecase', 'smartcase' and 'magic' are used.
- When the 'z' flag is not given seaching always starts in
+ When the 'z' flag is not given, searching always starts in
column zero and then matches before the cursor are skipped.
When the 'c' flag is present in 'cpo' the next search starts
after the match. Without the 'c' flag the next search starts
@@ -6026,7 +6038,7 @@ setqflist({list} [, {action}[, {title}]]) *setqflist()*
*setreg()*
-setreg({regname}, {value} [,{options}])
+setreg({regname}, {value} [, {options}])
Set the register {regname} to {value}.
{value} may be any value returned by |getreg()|, including
a |List|.
@@ -6207,6 +6219,9 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
sorted numerical. This is like 'n' but a string containing
digits will be used as the number they represent.
+ When {func} is given and it is 'f' then all items will be
+ sorted numerical. All values must be a Number or a Float.
+
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
@@ -7287,7 +7302,7 @@ dialog_gui Compiled with GUI dialog support.
digraphs Compiled with support for digraphs.
eval Compiled with expression evaluation support. Always
true, of course!
-ex_extra Compiled with extra Ex commands |+ex_extra|.
+ex_extra |+ex_extra|, always true now
extra_search Compiled with support for |'incsearch'| and
|'hlsearch'|
farsi Compiled with Farsi support |farsi|.
@@ -7994,7 +8009,7 @@ This does NOT work: >
From Vim version 4.5 until 5.0, every Ex command in
between the ":if" and ":endif" is ignored. These two
commands were just to allow for future expansions in a
- backwards compatible way. Nesting was allowed. Note
+ backward compatible way. Nesting was allowed. Note
that any ":else" or ":elseif" was ignored, the "else"
part was not executed either.
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index e98f0400c4..e75031ccef 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 7.4. Last change: 2016 Jan 10
+*index.txt* For Vim version 7.4. Last change: 2016 Jan 19
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1515,14 +1515,14 @@ tag command action ~
|:tabdo| :tabdo execute command in each tab page
|:tabedit| :tabe[dit] edit a file in a new tab page
|:tabfind| :tabf[ind] find file in 'path', edit it in a new tab page
-|:tabfirst| :tabfir[st] got to first tab page
-|:tablast| :tabl[ast] got to last tab page
+|:tabfirst| :tabfir[st] go to first tab page
+|:tablast| :tabl[ast] go to last tab page
|:tabmove| :tabm[ove] move tab page to other position
|:tabnew| :tabnew edit a file in a new tab page
|:tabnext| :tabn[ext] go to next tab page
|:tabonly| :tabo[nly] close all tab pages except the current one
|:tabprevious| :tabp[revious] go to previous tab page
-|:tabrewind| :tabr[ewind] got to first tab page
+|:tabrewind| :tabr[ewind] go to first tab page
|:tabs| :tabs list the tab pages and what they contain
|:tab| :tab create new tab when opening new window
|:tag| :ta[g] jump to tag
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index f931dfa341..818d6cf64c 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt* For Vim version 7.4. Last change: 2015 Sep 15
+*insert.txt* For Vim version 7.4. Last change: 2016 Jan 31
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt
index 5f4642274c..a2be3cfd49 100644
--- a/runtime/doc/mlang.txt
+++ b/runtime/doc/mlang.txt
@@ -1,4 +1,4 @@
-*mlang.txt* For Vim version 7.4. Last change: 2012 Jan 15
+*mlang.txt* For Vim version 7.4. Last change: 2016 Jan 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -94,13 +94,15 @@ If you used the self-installing .exe file, message translations should work
already. Otherwise get the libintl.dll file if you don't have it yet:
http://sourceforge.net/projects/gettext
+Or:
+ https://mlocati.github.io/gettext-iconv-windows/
This also contains tools xgettext, msgformat and others.
libintl.dll should be placed in same directory with (g)vim.exe, or some
-place where PATH environment value describe. Message files (vim.mo)
-have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the
-abbreviation of the language (mostly two letters).
+place where PATH environment value describe. Vim also finds libintl-8.dll.
+Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES",
+where "xx" is the abbreviation of the language (mostly two letters).
If you write your own translations you need to generate the .po file and
convert it to a .mo file. You need to get the source distribution and read
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 83ae96a651..105be1cd77 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.4. Last change: 2016 Jan 03
+*options.txt* For Vim version 7.4. Last change: 2016 Feb 20
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1602,7 +1602,7 @@ A jump table for the options with a short description can be found at |Q_op|.
line, the remaining space is filled in the normal manner.
See 'preserveindent'.
- *'cpoptions'* *'cpo'*
+ *'cpoptions'* *'cpo'* *cpo*
'cpoptions' 'cpo' string (Vim default: "aABceFs",
Vi default: all flags)
global
@@ -2515,17 +2515,17 @@ A jump table for the options with a short description can be found at |Q_op|.
item default Used for ~
stl:c ' ' or '^' statusline of the current window
- stlnc:c ' ' or '-' statusline of the non-current windows
+ stlnc:c ' ' or '=' statusline of the non-current windows
vert:c '|' vertical separators |:vsplit|
fold:c '-' filling 'foldtext'
diff:c '-' deleted lines of the 'diff' option
Any one that is omitted will fall back to the default. For "stl" and
- "stlnc" the space will be used when there is highlighting, '^' or '-'
+ "stlnc" the space will be used when there is highlighting, '^' or '='
otherwise.
Example: >
- :set fillchars=stl:^,stlnc:-,vert:\|,fold:-,diff:-
+ :set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:-
< This is similar to the default, except that these characters will also
be used when there is highlighting.
@@ -3696,6 +3696,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'*', '"' and '|' (so that CTRL-] on a command finds the help for that
command).
When the 'lisp' option is on the '-' character is always included.
+ This option also influences syntax highlighting, unless the syntax
+ uses |:syn-iskeyword|.
*'isprint'* *'isp'*
'isprint' 'isp' string (default: "@,161-255")
@@ -5955,7 +5957,7 @@ A jump table for the options with a short description can be found at |Q_op|.
The option consists of printf style '%' items interspersed with
normal text. Each status line item is of the form:
%-0{minwid}.{maxwid}{item}
- All fields except the {item} is optional. A single percent sign can
+ All fields except the {item} are optional. A single percent sign can
be given as "%%". Up to 80 items can be specified. *E541*
When the option starts with "%!" then it is used as an expression,
@@ -6461,6 +6463,7 @@ A jump table for the options with a short description can be found at |Q_op|.
non-keyword characters (white space is preferred). Maximum line
length is 510 bytes.
To obtain a file to be used here, check out this ftp site:
+ [Sorry this link doesn't work anymore, do you know the right one?]
ftp://ftp.ox.ac.uk/pub/wordlists/ First get the README file.
To include a comma in a file name precede it with a backslash. Spaces
after a comma are ignored, otherwise spaces are included in the file
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 1705010ff2..2c240fe41f 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -1,4 +1,4 @@
-*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Oct 31
+*pi_netrw.txt* For Vim version 7.4. Last change: 2016 Feb 16
------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell
@@ -6,7 +6,7 @@
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
-Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright*
+Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright*
The VIM LICENSE applies to the files in this package, including
netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and
syntax/netrw.vim. Like anything else that's free, netrw.vim and its
@@ -48,9 +48,10 @@ Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright*
Introduction To Browsing............................|netrw-intro-browse|
Quick Reference: Maps...............................|netrw-browse-maps|
Quick Reference: Commands...........................|netrw-browse-cmds|
+ Banner Display......................................|netrw-I|
Bookmarking A Directory.............................|netrw-mb|
Browsing............................................|netrw-cr|
- Squeezing the Current Tree-Listing Directory......|:netrw-s-cr|
+ Squeezing the Current Tree-Listing Directory........|netrw-s-cr|
Browsing With A Horizontally Split Window...........|netrw-o|
Browsing With A New Tab.............................|netrw-t|
Browsing With A Vertically Split Window.............|netrw-v|
@@ -75,11 +76,13 @@ Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright*
Making The Browsing Directory The Current Directory.|netrw-c|
Marking Files.......................................|netrw-mf|
Unmarking Files.....................................|netrw-mF|
+ Marking Files By Location List......................|netrw-qL|
Marking Files By QuickFix List......................|netrw-qF|
Marking Files By Regular Expression.................|netrw-mr|
Marked Files: Arbitrary Shell Command...............|netrw-mx|
Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX|
Marked Files: Arbitrary Vim Command.................|netrw-mv|
+ Marked Files: Argument List.........................|netrw-ma| |netrw-mA|
Marked Files: Compression And Decompression.........|netrw-mz|
Marked Files: Copying...............................|netrw-mc|
Marked Files: Diff..................................|netrw-md|
@@ -1111,6 +1114,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
qb List bookmarked directories and history |netrw-qb|
qf Display information on file |netrw-qf|
qF Mark files using a quickfix list |netrw-qF|
+ qL Mark files using a |location-list| |netrw-qL|
r Reverse sorting order |netrw-r|
R Rename the designated file(s)/directory(ies) |netrw-R|
s Select sorting style: by name, time, or file size |netrw-s|
@@ -1160,6 +1164,14 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
:Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
:Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
+
+BANNER DISPLAY *netrw-I*
+
+One may toggle the banner display on and off by pressing "I".
+
+Also See: |g:netrw_banner|
+
+
BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
One may easily "bookmark" the currently browsed directory by using >
@@ -1201,7 +1213,7 @@ Related Topics:
|g:netrw_home| controls where .netrwbook is kept
-BROWSING *netrw-cr* {{{2
+BROWSING *netrw-enter* *netrw-cr* {{{2
Browsing is simple: move the cursor onto a file or directory of interest.
Hitting the <cr> (the return key) will select the file or directory.
@@ -1242,11 +1254,21 @@ The price for such re-use is that when changes are made (such as new files
are introduced into a directory), the listing may become out-of-date. One may
always refresh directory listing buffers by pressing ctrl-L (see
|netrw-ctrl-l|).
- *:netrw-s-cr*
- Squeezing the Current Tree-Listing Directory~
- When the tree listing style is enabled (see |netrw-i|) and one is using
- gvim, then the <s-cr> mapping may be used to squeeze (close) the
- directory currently containing the cursor.
+
+ *netrw-s-cr*
+Squeezing the Current Tree-Listing Directory~
+
+When the tree listing style is enabled (see |netrw-i|) and one is using
+gvim, then the <s-cr> mapping may be used to squeeze (close) the
+directory currently containing the cursor.
+
+Otherwise, one may remap a key combination of one's own choice to get
+this effect: >
+
+ nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze
+<
+Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
+for netrw buffers only.
Related topics:
|netrw-ctrl-r| |netrw-o| |netrw-p|
@@ -1495,7 +1517,8 @@ One may also use visual mode (see |visual-start|) to select the text that the
special handler will use. Normally gx uses expand("<cfile>") to pick up the
text under the cursor; one may change what |expand()| uses via the
|g:netrw_gx| variable. Alternatively, one may select the text to be used by
-gx via first making a visual selection (see |visual-block|).
+gx via first making a visual selection (see |visual-block|) or by changing
+the |'isfname'| option (which is global, so netrw doesn't modify it).
Associated setting variables:
|g:netrw_gx| control how gx picks up the text under the cursor
@@ -1713,8 +1736,9 @@ Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
EXPLORING WITH STARS AND PATTERNS {{{2
When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
-following four patterns Explore generates a list of files which satisfy
-the request. >
+following four patterns Explore generates a list of files which satisfy the
+request for the local file system. These exploration patterns will not work
+with remote file browsing.
*/filepat files in current directory which satisfy filepat
**/filepat files in current directory or below which satisfy the
@@ -2079,15 +2103,22 @@ Netrw provides several ways to mark files:
:MF *.c
<
- * Note that :MF uses |<f-args>| to break the line
- at spaces.
+ (Note that :MF uses |<f-args>| to break the line
+ at spaces)
+
+ * Mark files using the |argument-list| (|netrw-mA|)
+
+ * Mark files based upon a |location-list| (|netrw-qL|)
* Mark files based upon the quickfix list (|netrw-qF|)
+ (|quickfix-error-lists|)
The following netrw maps make use of marked files:
|netrw-a| Hide marked files/directories
|netrw-D| Delete marked files/directories
+ |netrw-ma| Move marked files' names to |arglist|
+ |netrw-mA| Move |arglist| filenames to marked file list
|netrw-mb| Append marked files to bookmarks
|netrw-mB| Delete marked files from bookmarks
|netrw-mc| Copy marked files to target
@@ -2146,8 +2177,14 @@ UNMARKING FILES *netrw-mF* {{{2
The "mF" command will unmark all files in the current buffer. One may also use
mf (|netrw-mf|) on a specific, already marked, file to unmark just that file.
+MARKING FILES BY LOCATION LIST *netrw-qL* {{{2
+ (also see |netrw-mf|)
+
+One may convert |location-list|s into a marked file list using "qL".
+You may then proceed with commands such as me (|netrw-me|) to edit them.
-MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
+
+MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
(also see |netrw-mf|)
One may convert |quickfix-error-lists| into a marked file list using "qF".
@@ -2223,6 +2260,16 @@ The command that will be run with this example:
tar cf mynewtarball.tar 'file1' 'file2' ...
+MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA*
+ (See |netrw-mf| and |netrw-mr| for how to mark files)
+ (uses the global marked-file list)
+
+Using ma, one moves filenames from the marked file list to the argument list.
+Using mA, one moves filenames from the argument list to the marked file list.
+
+See Also: |netrw-qF| |argument-list| |:args|
+
+
MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
(See |netrw-mf| and |netrw-mr| for how to mark files)
(uses the local marked file list)
@@ -2232,7 +2279,7 @@ If any marked files are decompressed, then "mz" will compress them
using the command specified by |g:netrw_compress|; by default,
that's "gzip".
-For decompression, netrw provides a |Dictionary| of suffices and their
+For decompression, netrw uses a |Dictionary| of suffices and their
associated decompressing utilities; see |g:netrw_decompress|.
Remember that one can mark multiple files by regular expression
@@ -2287,7 +2334,7 @@ The command will ask for the requested pattern; one may then enter: >
pattern
<
With /pattern/, editing will start with the first item on the |quickfix| list
-that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|). The |:vimgrep|
+that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep|
command is in use, so without 'g' each line is added to quickfix list only
once; with 'g' every match is included.
@@ -2756,6 +2803,16 @@ your browsing preferences. (see also: |netrw-settings|)
evaluation will be suppressed
(see |'ballooneval'|)
+ *g:netrw_sizestyle* not defined: actual bytes (default)
+ ="b" : actual bytes (default)
+ ="h" : human-readable (ex. 5k, 4m, 3g)
+ uses 1000 base
+ ="H" : human-readable (ex. 5K, 4M, 3G)
+ uses 1024 base
+ The long listing (|netrw-i|) and query-file
+ maps (|netrw-qf|) will display file size
+ using the specified style.
+
*g:netrw_usetab* if this variable exists and is non-zero, then
the <tab> map supporting shrinking/expanding a
Lexplore or netrw window will be enabled.
@@ -3024,14 +3081,14 @@ These will:
Related: if you like this idea, you may also find :Lexplore
(|netrw-:Lexplore|) or |g:netrw_chgwin| of interest
-Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'|
+Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose|
PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
-To edit a file or directory in the previously used (last accessed) window (see
-:he |CTRL-W_p|), press a "P". If there's only one window, then the one window
-will be horizontally split (by default).
+To edit a file or directory under the cursor in the previously used (last
+accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one
+window, then the one window will be horizontally split (by default).
If there's more than one window, the previous window will be re-used on
the selected file/directory. If the previous window's associated buffer
@@ -3170,7 +3227,7 @@ only if your terminal supports differentiating <c-tab> from a plain
* Else bring up a |:Lexplore| window
If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping
-for <c-tab>, then the <tab> will not be mapped. One may map something other
+for <c-tab>, then the <c-tab> will not be mapped. One may map something other
than a <c-tab>, too: (but you'll still need to have had g:netrw_usetab set) >
nmap <unique> (whatever) <Plug>NetrwShrink
@@ -3637,13 +3694,13 @@ called netrw.vimrc with the following contents: >
<
Then run netrw as follows: >
- vim -u netrw.vimrc --noplugins [some path here]
+ vim -u netrw.vimrc --noplugins -i NONE [some path here]
<
Perform whatever netrw commands you need to, and check that the problem is
still present. This procedure sidesteps any issues due to personal .vimrc
-settings and other plugins. If the problem does not appear, then you need
-to determine what setting in your .vimrc is causing the conflict with netrw
-or which plugin.
+settings, .viminfo file, and other plugins. If the problem does not appear,
+then you need to determine which setting in your .vimrc is causing the
+conflict with netrw or which plugin(s) is/are involved.
Step 3: If the problem still is present, then get a debugging trace from
netrw:
@@ -3698,6 +3755,37 @@ netrw:
==============================================================================
12. History *netrw-history* {{{1
+ v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
+ mapping of ctrl-l was not allowing refresh of
+ other windows when it was done in a netrw
+ window.
+ Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
+ instead of a loop
+ * NetrwBrowse() will return line to
+ w:netrw_bannercnt if cursor ended up in
+ banner
+ Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
+ Nov 17, 2015 * Commented out imaps -- perhaps someone can
+ tell me how they're useful and should be
+ retained?
+ Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
+ Nov 20, 2015 * gx (|netrw-gx|) on an url downloaded the
+ file in addition to simply bringing up the
+ url in a browser. Fixed.
+ Nov 23, 2015 * Added |g:netrw_sizestyle| support
+ Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
+ maps.
+ Jan 05, 2016 * |netrw-qL| implemented to mark files based
+ upon |location-list|s; similar to |netrw-qF|.
+ Jan 19, 2016 * using - call delete(directoryname,"d") -
+ instead of using g:netrw_localrmdir if
+ v7.4 + patch#1107 is available
+ Jan 28, 2016 * changed to using |winsaveview()| and
+ |winrestview()|
+ Jan 28, 2016 * s:NetrwTreePath() now does a save and
+ restore of view
+ Feb 08, 2016 * Fixed a tree-listing problem with remote
+ directories
v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
a file was not treated properly as a file
due to g:netrw_keepdir == 1
@@ -3858,7 +3946,7 @@ netrw:
handling.
* |:Lexplore| path: will be used to update
a left-side netrw browsing directory.
- Mar 12, 2014 * |:netrw-s-cr|: use <s-cr> to close
+ Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
tree directory implemented
Mar 13, 2014 * (Tony Mechylynck) reported that using
the browser with ftp on a directory,
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index ff4fded0d9..317226108f 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1,4 +1,4 @@
-*quickfix.txt* For Vim version 7.4. Last change: 2015 Sep 08
+*quickfix.txt* For Vim version 7.4. Last change: 2016 Jan 21
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 343d3e62cf..5b382f95f2 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -1,4 +1,4 @@
-*repeat.txt* For Vim version 7.4. Last change: 2016 Jan 16
+*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 12
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 46efe1996a..c9cb849164 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1,4 +1,4 @@
-*starting.txt* For Vim version 7.4. Last change: 2015 Jan 15
+*starting.txt* For Vim version 7.4. Last change: 2016 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -10,9 +10,10 @@ Starting Vim *starting*
2. Initialization |initialization|
3. $VIM and $VIMRUNTIME |$VIM|
4. Suspending |suspend|
-5. Saving settings |save-settings|
-6. Views and Sessions |views-sessions|
-7. The ShaDa file |shada-file|
+5. Exiting |exiting|
+6. Saving settings |save-settings|
+7. Views and Sessions |views-sessions|
+8. The ShaDa file |shada-file|
==============================================================================
1. Vim arguments *vim-arguments*
@@ -696,7 +697,20 @@ can't paste it in another application (since Vim is going to sleep an attempt
to get the selection would make the program hang).
==============================================================================
-5. Saving settings *save-settings*
+5. Exiting *exiting*
+
+There are several ways to exit Vim:
+- Close the last window with `:quit`. Only when there are no changes.
+- Close the last window with `:quit!`. Also when there are changes.
+- Close all windows with `:qall`. Only when there are no changes.
+- Close all windows with `:qall!`. Also when there are changes.
+- Use `:cquit`. Also when there are changes.
+
+When using `:cquit` or when there was an error message Vim exits with exit
+code 1. Errors can be avoide by using `:silent!`.
+
+==============================================================================
+6. Saving settings *save-settings*
Mostly you will edit your vimrc files manually. This gives you the greatest
flexibility. There are a few commands to generate a vimrc file automatically.
@@ -753,7 +767,7 @@ these steps:
You need to escape special characters, esp. spaces.
==============================================================================
-6. Views and Sessions *views-sessions*
+7. Views and Sessions *views-sessions*
This is introduced in sections |21.4| and |21.5| of the user manual.
@@ -897,7 +911,7 @@ To automatically save and restore views for *.c files: >
au BufWinEnter *.c silent loadview
==============================================================================
-7. The ShaDa file *shada* *shada-file*
+8. The ShaDa file *shada* *shada-file*
If you exit Vim and later start it again, you would normally lose a lot of
information. The ShaDa file can be used to remember that information, which
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 81ba639dbe..4e4ea39e7c 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.4. Last change: 2015 Dec 19
+*syntax.txt* For Vim version 7.4. Last change: 2016 Jan 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3422,6 +3422,32 @@ SPELL CHECKING *:syn-spell*
To activate spell checking the 'spell' option must be set.
+SYNTAX ISKEYWORD SETTING *:syn-iskeyword*
+
+:sy[ntax] iskeyword [clear | {option}]
+ This defines the keyword characters. It's like the 'iskeyword' option
+ for but only applies to syntax highlighting.
+
+ clear: Syntax specific iskeyword setting is disabled and the
+ buffer-local 'iskeyword' setting is used.
+ {option} Set the syntax 'iskeyword' option to a new value.
+
+ Example: >
+ :syntax iskeyword @,48-57,192-255,$,_
+<
+ This would set the syntax specific iskeyword option to include all
+ alphabetic characters, plus the numeric characters, all accented
+ characters and also includes the "_" and the "$".
+
+ If no argument is given, the current value will be output.
+
+ Setting this option influences what |/\k| matches in syntax patterns
+ and also determines where |:syn-keyword| will be checked for a new
+ match.
+
+ It is recommended when writing syntax files, to use this command
+ to the correct value for the specific syntax language and not change
+ the 'iskeyword' option.
DEFINING KEYWORDS *:syn-keyword*
@@ -3453,6 +3479,7 @@ DEFINING KEYWORDS *:syn-keyword*
isn't, the keyword will never be recognized.
Multi-byte characters can also be used. These do not have to be in
'iskeyword'.
+ See |:syn-iskeyword| for defining syntax specific iskeyword settings.
A keyword always has higher priority than a match or region, the
keyword is used if more than one item matches. Keywords do not nest
diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt
index 1c536c1eda..c10643940d 100644
--- a/runtime/doc/usr_02.txt
+++ b/runtime/doc/usr_02.txt
@@ -1,4 +1,4 @@
-*usr_02.txt* For Vim version 7.4. Last change: 2016 Jan 15
+*usr_02.txt* For Vim version 7.4. Last change: 2016 Jan 16
VIM USER MANUAL - by Bram Moolenaar
@@ -543,38 +543,42 @@ Summary: *help-summary* >
8) Ex-commands always start with ":", so to go to the :s command help: >
:help :s
-9) Key combinations. They usually start with a single letter indicating
- the mode for which they can be used. E.g.: >
+9) Commands specifically for debugging start with ">". To go to to the help
+ for the "cont" debug command: >
+ :help >cont
+
+10) Key combinations. They usually start with a single letter indicating
+ the mode for which they can be used. E.g.: >
:help i_CTRL-X
-< takes you to the family of Ctrl-X commands for insert mode which can be
- used to auto complete different things. Note, that certain keys will
- always be written the same, e.g. Control will always be CTRL.
- For normal mode commands there is no prefix and the topic is available at
- :h CTRL-<Letter>. E.g. >
+< takes you to the family of Ctrl-X commands for insert mode which can be
+ used to auto complete different things. Note, that certain keys will
+ always be written the same, e.g. Control will always be CTRL.
+ For normal mode commands there is no prefix and the topic is available at
+ :h CTRL-<Letter>. E.g. >
:help CTRL-W
-< In contrast >
+< In contrast >
:help c_CTRL-R
-< will describe what the Ctrl-R does when entering commands in the Command
- line and >
+< will describe what the Ctrl-R does when entering commands in the Command
+ line and >
:help v_Ctrl-A
-< talks about incrementing numbers in visual mode and >
+< talks about incrementing numbers in visual mode and >
:help g_CTRL-A
-< talks about the g<C-A> command (e.g. you have to press "g" then <Ctrl-A>).
- Here the "g" stand for the normal command "g" which always expects a second
- key before doing something similar to the commands starting with "z"
+< talks about the g<C-A> command (e.g. you have to press "g" then <Ctrl-A>).
+ Here the "g" stand for the normal command "g" which always expects a second
+ key before doing something similar to the commands starting with "z"
-10) Regexp items always start with /. So to get help for the "\+" quantifier
+11) Regexp items always start with /. So to get help for the "\+" quantifier
in Vim regexes: >
:help /\+
-< If you need to know everything about regular expressions, start reading
- at: >
+< If you need to know everything about regular expressions, start reading
+ at: >
:help pattern.txt
-11) Registers always start with "quote". To find out about the special ":"
+12) Registers always start with "quote". To find out about the special ":"
register: >
:help quote:
-12) Vim Script (VimL) is available at >
+13) Vim Script (VimL) is available at >
:help eval.txt
< Certain aspects of the language are available at :h expr-X where "X" is a
single letter. E.g. >
@@ -589,7 +593,7 @@ Summary: *help-summary* >
< talks about the append VimL function rather than how to append text in the
current buffer.
-13) Mappings are talked about in the help page :h |map.txt|. Use >
+14) Mappings are talked about in the help page :h |map.txt|. Use >
:help mapmode-i
< to find out about the |:imap| command. Also use :map-topic
to find out about certain subtopics particular for mappings. e.g: >
@@ -598,19 +602,19 @@ Summary: *help-summary* >
:help map-bar
< for how the '|' is handled in mappings.
-14) Command definitions are talked about :h command-topic, so use >
+15) Command definitions are talked about :h command-topic, so use >
:help command-bar
< to find out about the '!' argument for custom commands.
-15) Window management commands always start with CTRL-W, so you find the
+16) Window management commands always start with CTRL-W, so you find the
corresponding help at :h CTRL-W_letter. E.g. >
:help CTRL-W_p
-< for moving the previous accessed window). You can also access >
+< for moving the previous accessed window. You can also access >
:help windows.txt
< and read your way through if you are looking for window handling
commands.
-16) Use |:helpgrep| to search in all help pages (and also of any installed
+17) Use |:helpgrep| to search in all help pages (and also of any installed
plugins). See |:helpgrep| for how to use it.
To search for a topic: >
:helpgrep topic
@@ -621,7 +625,7 @@ Summary: *help-summary* >
:copen
< Move around to the match you like and press Enter to jump to that help.
-17) The user manual. This describes help topics for beginners in a rather
+18) The user manual. This describes help topics for beginners in a rather
friendly way. Start at |usr_toc.txt| to find the table of content (as you
might have guessed): >
:help usr_toc.txt
@@ -634,31 +638,31 @@ Summary: *help-summary* >
:help 10.1
< goes to chapter 10.1 in |usr_10.txt| and talks about recording macros.
-18) Highlighting groups. Always start with hl-groupname. E.g. >
+19) Highlighting groups. Always start with hl-groupname. E.g. >
:help hl-WarningMsg
< talks about the WarningMsg highlighting group.
-19) Syntax highlighting is namespaced to :syn-topic e.g. >
+20) Syntax highlighting is namespaced to :syn-topic e.g. >
:help :syn-conceal
< talks about the conceal argument for the :syn command.
-20) Quickfix commands usually start with :c while location list commands
+21) Quickfix commands usually start with :c while location list commands
usually start with :l
-21) Autocommand events can be found by their name: >
+22) Autocommand events can be found by their name: >
:help BufWinLeave
< To see all possible events: >
:help autocommands-events
-22) Command-line switches always start with "-". So for the help of the -f
+23) Command-line switches always start with "-". So for the help of the -f
command switch of Vim use: >
:help -f
-23) Optional features always start with "+". To find out about the
+24) Optional features always start with "+". To find out about the
conceal feature use: >
:help +conceal
-24) Documentation for included filetype specific functionality is usually
+25) Documentation for included filetype specific functionality is usually
available in the form ft-<filetype>-<functionality>. So >
:help ft-c-syntax
< talks about the C syntax file and the option it provides. Sometimes,
@@ -668,7 +672,7 @@ Summary: *help-summary* >
:help ft-tex-plugin
< are available.
-25) Error and Warning codes can be looked up directly in the help. So >
+26) Error and Warning codes can be looked up directly in the help. So >
:help E297
< takes you exactly to the description of the swap error message and >
:help W10
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index fc8419a522..a14e722328 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 7.4. Last change: 2015 Nov 30
+*usr_41.txt* For Vim version 7.4. Last change: 2016 Feb 14
VIM USER MANUAL - by Bram Moolenaar
@@ -2224,7 +2224,7 @@ This construct makes sure the function is only defined once: >
:endif
<
-UNDO *undo_ftplugin*
+UNDO *undo_indent* *undo_ftplugin*
When the user does ":setfiletype xyz" the effect of the previous filetype
should be undone. Set the b:undo_ftplugin variable to the commands that will
@@ -2239,6 +2239,9 @@ global value. That is mostly the best way to reset the option value.
This does require removing the "C" flag from 'cpoptions' to allow line
continuation, as mentioned above |use-cpo-save|.
+For undoing the effect of an indent script, the b:undo_indent variable should
+be set accordingly.
+
FILE NAME
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 293cfe6e00..a2c0f45b23 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 7.4. Last change: 2016 Jan 10
+*various.txt* For Vim version 7.4. Last change: 2016 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -319,8 +319,7 @@ N *+dialog_con* Support for |:confirm| with console dialog.
N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
N *+digraphs* |digraphs| *E196*
N *+eval* expression evaluation |eval.txt|
-N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|,
- |:normal|, |:retab| and |:right|
+N *+ex_extra* always on now, used to be for Vim's extra Ex commands
N *+extra_search* |'hlsearch'| and |'incsearch'| options.
B *+farsi* |farsi| language
N *+file_in_path* |gf|, |CTRL-W_f| and |<cfile>|
@@ -455,7 +454,7 @@ m *+xpm_w32* Win32 GUI only: pixmap support |w32-xpm-support|
:redi[r] END End redirecting messages.
- *:sil* *:silent*
+ *:sil* *:silent* *:silent!*
:sil[ent][!] {command} Execute {command} silently. Normal messages will not
be given or added to the message history.
When [!] is added, error messages will also be
diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt
index ec35694c9e..54ef8fecb2 100644
--- a/runtime/doc/vi_diff.txt
+++ b/runtime/doc/vi_diff.txt
@@ -1,4 +1,4 @@
-*vi_diff.txt* For Vim version 7.4. Last change: 2015 Nov 01
+*vi_diff.txt* For Vim version 7.4. Last change: 2016 Feb 12
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 51b73223b6..d5c7db992e 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -1,4 +1,4 @@
-*windows.txt* For Vim version 7.4. Last change: 2015 Nov 14
+*windows.txt* For Vim version 7.4. Last change: 2016 Feb 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -707,8 +707,8 @@ can also get to them with the buffer list commands, like ":bnext".
*:bufdo*
:[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if
[range] is given only for buffers for which their
- buffer name is in the [range]. It works like doing
- this: >
+ buffer number is in the [range]. It works like doing
+ this: >
:bfirst
:{cmd}
:bnext
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index d492889fc7..e19a19fb1f 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,11 +1,11 @@
" Vim indent file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: 0.42
-" Last Change: 2015 Nov. 30
+" Version: 0.44
+" Last Change: 2016 Jan. 26
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
-" Useful suggestions were made by: Albert Oliver Serra.
+" Useful suggestions were made by: Albert Oliver Serra and Takuya Fujiwara.
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -92,10 +92,10 @@ function FortranGetIndent(lnum)
"Indent do loops only if they are all guaranteed to be of do/end do type
if exists("b:fortran_do_enddo") || exists("g:fortran_do_enddo")
if prevstat =~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*do\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*end\s*do\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -105,14 +105,14 @@ function FortranGetIndent(lnum)
\ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>'
\ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>'
\ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
" Remove unwanted indent after logical and arithmetic ifs
if prevstat =~? '\<if\>' && prevstat !~? '\<then\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
" Remove unwanted indent after type( statements
if prevstat =~? '^\s*type\s*('
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -125,12 +125,12 @@ function FortranGetIndent(lnum)
\ ||prevstat =~? '^\s*'.prefix.'subroutine\>'
\ ||prevstat =~? '^\s*'.prefix.type.'function\>'
\ ||prevstat =~? '^\s*'.type.prefix.'function\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if getline(v:lnum) =~? '^\s*contains\>'
\ ||getline(v:lnum)=~? '^\s*end\s*'
\ .'\(function\|subroutine\|module\|program\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -141,23 +141,23 @@ function FortranGetIndent(lnum)
\. '\(else\|else\s*if\|else\s*where\|case\|'
\. 'end\s*\(if\|where\|select\|interface\|'
\. 'type\|forall\|associate\|enum\|block\)\)\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
" Fix indent for case statement immediately after select
if prevstat =~? '\<select\s\+\(case\|type\)\>'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
endif
"First continuation line
if prevstat =~ '&\s*$' && prev2stat !~ '&\s*$'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
endif
if prevstat =~ '&\s*$' && prevstat =~ '\<else\s*if\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
"Line after last continuation line
if prevstat !~ '&\s*$' && prev2stat =~ '&\s*$' && prevstat !~? '\<then\>'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim
index 1bffa7f195..07ecd8f141 100644
--- a/runtime/indent/php.vim
+++ b/runtime/indent/php.vim
@@ -3,8 +3,8 @@
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
" URL: http://www.2072productions.com/vim/indent/php.vim
" Home: https://github.com/2072/PHP-Indenting-for-VIm
-" Last Change: 2014 November 26th
-" Version: 1.57
+" Last Change: 2015 September 8th
+" Version: 1.60
"
"
" Type :help php-indent for available options
@@ -50,16 +50,25 @@ let b:did_indent = 1
let g:php_sync_method = 0
+if exists('*shiftwidth')
+ function! s:sw()
+ return shiftwidth()
+ endfunction
+else
+ function! s:sw()
+ return &shiftwidth
+ endfunction
+endif
if exists("PHP_default_indenting")
- let b:PHP_default_indenting = PHP_default_indenting * &sw
+ let b:PHP_default_indenting = PHP_default_indenting * s:sw()
else
let b:PHP_default_indenting = 0
endif
if exists("PHP_outdentSLComments")
- let b:PHP_outdentSLComments = PHP_outdentSLComments * &sw
+ let b:PHP_outdentSLComments = PHP_outdentSLComments * s:sw()
else
let b:PHP_outdentSLComments = 0
endif
@@ -124,7 +133,7 @@ endif
if exists("*GetPhpIndent")
call ResetPhpOptions()
- finish " XXX -- comment this line for easy dev
+ finish
endif
@@ -135,7 +144,7 @@ let s:functionDecl = '\<function\>\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*'
let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$'
-let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
+let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$'
let s:PHP_startindenttag = '<?\%(.*?>\)\@!\|<script[^>]*>\%(.*<\/script>\)\@!'
@@ -200,7 +209,7 @@ function! GetLastRealCodeLNum(startline) " {{{
elseif lastline =~? '^\a\w*;\=$' && lastline !~? s:notPhpHereDoc
- let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<''\\=\1''\\=$', '')
+ let tofind=substitute( lastline, '\(\a\w*\);\=', '<<<\\s*[''"]\\=\1[''"]\\=$', '')
while getline(lnum) !~? tofind && lnum > 1
let lnum = lnum - 1
endwhile
@@ -314,7 +323,7 @@ function! FindTheSwitchIndent (lnum) " {{{
let test = GetLastRealCodeLNum(a:lnum - 1)
if test <= 1
- return indent(1) - &sw * b:PHP_vintage_case_default_indent
+ return indent(1) - s:sw() * b:PHP_vintage_case_default_indent
end
while getline(test) =~ '^\s*}' && test > 1
@@ -328,7 +337,7 @@ function! FindTheSwitchIndent (lnum) " {{{
if getline(test) =~# '^\s*switch\>'
return indent(test)
elseif getline(test) =~# s:defaultORcase
- return indent(test) - &sw * b:PHP_vintage_case_default_indent
+ return indent(test) - s:sw() * b:PHP_vintage_case_default_indent
else
return FindTheSwitchIndent(test)
endif
@@ -401,7 +410,7 @@ function! GetPhpIndent()
endif
if b:PHP_default_indenting
- let b:PHP_default_indenting = g:PHP_default_indenting * &sw
+ let b:PHP_default_indenting = g:PHP_default_indenting * s:sw()
endif
let cline = getline(v:lnum)
@@ -439,6 +448,7 @@ function! GetPhpIndent()
if !b:InPHPcode_checked " {{{ One time check
let b:InPHPcode_checked = 1
+ let b:UserIsTypingComment = 0
let synname = ""
if cline !~ '<?.*?>'
@@ -447,8 +457,7 @@ function! GetPhpIndent()
if synname!=""
if synname == "SpecStringEntrails"
- let b:InPHPcode = -1 " thumb down
- let b:UserIsTypingComment = 0
+ let b:InPHPcode = -1
let b:InPHPcode_tofind = ""
elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter"
let b:InPHPcode = 1
@@ -456,8 +465,7 @@ function! GetPhpIndent()
if synname =~# '^php\%(Doc\)\?Comment'
let b:UserIsTypingComment = 1
- else
- let b:UserIsTypingComment = 0
+ let b:InPHPcode_checked = 0
endif
if synname =~? '^javaScript'
@@ -466,18 +474,16 @@ function! GetPhpIndent()
else
let b:InPHPcode = 0
- let b:UserIsTypingComment = 0
let lnum = v:lnum - 1
- while getline(lnum) !~? '<<<''\=\a\w*''\=$' && lnum > 1
+ while getline(lnum) !~? '<<<\s*[''"]\=\a\w*[''"]\=$' && lnum > 1
let lnum = lnum - 1
endwhile
- let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
+ let b:InPHPcode_tofind = substitute( getline(lnum), '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
endif
else
let b:InPHPcode = 0
- let b:UserIsTypingComment = 0
let b:InPHPcode_tofind = s:PHP_startindenttag
endif
endif "!b:InPHPcode_checked }}}
@@ -537,9 +543,9 @@ function! GetPhpIndent()
elseif last_line =~ '^[^''"`]\+[''"`]$'
let b:InPHPcode = -1
let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '')
- elseif last_line =~? '<<<''\=\a\w*''\=$'
+ elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$'
let b:InPHPcode = 0
- let b:InPHPcode_tofind = substitute( last_line, '^.*<<<''\=\(\a\w*\)''\=$', '^\\s*\1;\\=$', '')
+ let b:InPHPcode_tofind = substitute( last_line, '^.*<<<\s*[''"]\=\(\a\w*\)[''"]\=$', '^\\s*\1;\\=$', '')
elseif !UserIsEditing && cline =~ '^\s*/\*\%(.*\*/\)\@!' && getline(v:lnum + 1) !~ '^\s*\*'
let b:InPHPcode = 0
@@ -660,7 +666,7 @@ function! GetPhpIndent()
let b:PHP_CurrentIndentLevel = b:PHP_default_indenting
return indent(FindTheIfOfAnElse(v:lnum, 1))
elseif cline =~# s:defaultORcase
- return FindTheSwitchIndent(v:lnum) + &sw * b:PHP_vintage_case_default_indent
+ return FindTheSwitchIndent(v:lnum) + s:sw() * b:PHP_vintage_case_default_indent
elseif cline =~ '^\s*)\=\s*{'
let previous_line = last_line
let last_line_num = lnum
@@ -672,7 +678,7 @@ function! GetPhpIndent()
let ind = indent(last_line_num)
if b:PHP_BracesAtCodeLevel
- let ind = ind + &sw
+ let ind = ind + s:sw()
endif
return ind
@@ -683,7 +689,7 @@ function! GetPhpIndent()
endwhile
elseif last_line =~# unstated && cline !~ '^\s*);\='.endline
- let ind = ind + &sw
+ let ind = ind + s:sw()
return ind + addSpecial
elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated
@@ -782,7 +788,7 @@ function! GetPhpIndent()
endif
if !dontIndent && (!b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{')
- let ind = ind + &sw
+ let ind = ind + s:sw()
endif
if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1
@@ -800,17 +806,17 @@ function! GetPhpIndent()
endif
elseif last_line =~ '^\s*'.s:blockstart
- let ind = ind + &sw
+ let ind = ind + s:sw()
elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase
- let ind = ind + &sw
+ let ind = ind + s:sw()
endif
endif
if cline =~ '^\s*[)\]];\='
- let ind = ind - &sw
+ let ind = ind - s:sw()
endif
let b:PHP_CurrentIndentLevel = ind
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index 5bd8c77fab..2d603b0afa 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -3,7 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2015-12-15
+" Latest Revision: 2016-01-15
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
@@ -28,7 +28,7 @@ let s:cpo_save = &cpo
set cpo&vim
function s:buffer_shiftwidth()
- return &shiftwidth
+ return shiftwidth()
endfunction
let s:sh_indent_defaults = {
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index 7511325af4..31b76b8c0c 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Dec 12
+" Last Change: 2016 Jan 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -58,19 +58,19 @@ function GetVimIndentIntern()
if exists("g:vim_indent_cont")
let ind = ind + g:vim_indent_cont
else
- let ind = ind + &sw * 3
+ let ind = ind + shiftwidth() * 3
endif
elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END'
- let ind = ind + &sw
+ let ind = ind + shiftwidth()
else
" A line starting with :au does not increment/decrement indent.
if prev_text !~ '^\s*au\%[tocmd]'
let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>')
if i >= 0
- let ind += &sw
+ let ind += shiftwidth()
if strpart(prev_text, i, 1) == '|' && has('syntax_items')
\ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$'
- let ind -= &sw
+ let ind -= shiftwidth()
endif
endif
endif
@@ -82,7 +82,7 @@ function GetVimIndentIntern()
let i = match(prev_text, '[^\\]|\s*\(ene\@!\)')
if i > 0 && prev_text !~ '^\s*au\%[tocmd]'
if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
endif
@@ -90,7 +90,7 @@ function GetVimIndentIntern()
" Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry,
" :endfun, :else and :augroup END.
if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)'
- let ind = ind - &sw
+ let ind = ind - shiftwidth()
endif
return ind
diff --git a/runtime/indent/zimbu.vim b/runtime/indent/zimbu.vim
index 9565b10843..5451877ea7 100644
--- a/runtime/indent/zimbu.vim
+++ b/runtime/indent/zimbu.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Zimbu
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2012 Sep 08
+" Last Change: 2016 Jan 25
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -74,9 +74,9 @@ func GetZimbuIndent(lnum)
\ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
\ . " =~ '\\(Comment\\|String\\|Char\\)$'")
if pp > 0
- return indent(prevLnum) + &sw
+ return indent(prevLnum) + shiftwidth()
endif
- return indent(prevLnum) + &sw * 2
+ return indent(prevLnum) + shiftwidth() * 2
endif
if plnumstart == p
return indent(prevLnum)
@@ -102,13 +102,13 @@ func GetZimbuIndent(lnum)
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
+ let plindent += shiftwidth()
endif
if thisline =~ '^\s*\(}\|ELSEIF\>\|ELSE\>\|CATCH\|FINALLY\|GENERATE_ELSEIF\>\|GENERATE_ELSE\>\|UNTIL\>\)'
- let plindent -= &sw
+ let plindent -= shiftwidth()
endif
if thisline =~ '^\s*\(CASE\>\|DEFAULT\>\)' && prevline !~ '^\s*SWITCH\>'
- let plindent -= &sw
+ let plindent -= shiftwidth()
endif
" line up continued comment that started after some code
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 873302efee..5db1f64c78 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2015 Dec 31
+" Last Change: 2016 Feb 16
" Exit quickly when:
" - this plugin was already loaded (or disabled)
diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim
index 3776ac30f8..69902b1f19 100644
--- a/runtime/plugin/netrwPlugin.vim
+++ b/runtime/plugin/netrwPlugin.vim
@@ -1,6 +1,6 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION
-" Date: Nov 07, 2014
+" Date: Feb 08, 2016
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
@@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin")
finish
endif
-let g:loaded_netrwPlugin = "v154"
+let g:loaded_netrwPlugin = "v155"
let s:keepcpo = &cpo
set cpo&vim
"DechoRemOn
@@ -55,10 +55,10 @@ augroup Network
augroup END
" Commands: :Nread, :Nwrite, :NetUserPass {{{2
-com! -count=1 -nargs=* Nread call netrw#SavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#RestorePosn()
-com! -range=% -nargs=* Nwrite call netrw#SavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#RestorePosn()
+com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call winrestview(s:svpos)
+com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos)
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
-com! -nargs=* Nsource call netrw#SavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#RestorePosn()
+com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos)
com! -nargs=? Ntree call netrw#SetTreetop(<q-args>)
" Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index ac4909edba..32b63e09e4 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2015 Mar 05
+" Last Change: 2016 Feb 08
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -264,7 +264,7 @@ syn keyword cStorageClass static register auto volatile extern const
if exists("c_gnu")
syn keyword cStorageClass inline __attribute__
endif
-if !exists("c_no_c99")
+if !exists("c_no_c99") && s:ft !=# 'cpp'
syn keyword cStorageClass inline restrict
endif
if !exists("c_no_c11")
diff --git a/runtime/syntax/d.vim b/runtime/syntax/d.vim
index 07a299fa55..8be9b9ff28 100644
--- a/runtime/syntax/d.vim
+++ b/runtime/syntax/d.vim
@@ -1,9 +1,9 @@
-" Vim syntax file for the D programming language (version 1.076 and 2.063).
+" Vim syntax file for the D programming language (version 1.076 and 2.069).
"
" Language: D
" Maintainer: Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
-" Last Change: 2013 October 5
-" Version: 0.26
+" Last Change: 2016 Feb 2
+" Version: 0.28
"
" Contributors:
" - Jason Mills: original Maintainer
@@ -15,6 +15,7 @@
" - Steven N. Oliver
" - Sohgo Takeuchi
" - Robert Clipsham
+" - Petar Kirov
"
" Please submit bugs/comments/suggestions to the github repo:
" https://github.com/JesseKPhillips/d.vim
@@ -114,17 +115,19 @@ syn keyword dTraitsIdentifier contained isIntegral isScalar isStaticArray
syn keyword dTraitsIdentifier contained isUnsigned isVirtualFunction
syn keyword dTraitsIdentifier contained isVirtualMethod isAbstractFunction
syn keyword dTraitsIdentifier contained isFinalFunction isStaticFunction
+syn keyword dTraitsIdentifier contained isOverrideFunction isTemplate
syn keyword dTraitsIdentifier contained isRef isOut isLazy hasMember
-syn keyword dTraitsIdentifier contained identifier getAttributes getMember
-syn keyword dTraitsIdentifier contained getOverloads getProtection
-syn keyword dTraitsIdentifier contained getVirtualFunctions
-syn keyword dTraitsIdentifier contained getVirtualMethods parent
-syn keyword dTraitsIdentifier contained classInstanceSize allMembers
+syn keyword dTraitsIdentifier contained identifier getAliasThis
+syn keyword dTraitsIdentifier contained getAttributes getFunctionAttributes getMember
+syn keyword dTraitsIdentifier contained getOverloads getPointerBitmap getProtection
+syn keyword dTraitsIdentifier contained getVirtualFunctions getVirtualIndex
+syn keyword dTraitsIdentifier contained getVirtualMethods getUnitTests
+syn keyword dTraitsIdentifier contained parent classInstanceSize allMembers
syn keyword dTraitsIdentifier contained derivedMembers isSame compiles
-syn keyword dPragmaIdentifier contained lib msg startaddress GNU_asm
-syn keyword dExternIdentifier contained Windows Pascal Java System D
+syn keyword dPragmaIdentifier contained inline lib mangle msg startaddress GNU_asm
+syn keyword dExternIdentifier contained C C++ D Windows Pascal System Objective-C
syn keyword dAttribute contained safe trusted system
-syn keyword dAttribute contained property disable
+syn keyword dAttribute contained property disable nogc
syn keyword dVersionIdentifier contained DigitalMars GNU LDC SDC D_NET
syn keyword dVersionIdentifier contained X86 X86_64 ARM PPC PPC64 IA64 MIPS MIPS64 Alpha
syn keyword dVersionIdentifier contained SPARC SPARC64 S390 S390X HPPA HPPA64 SH SH64
@@ -134,7 +137,7 @@ syn keyword dVersionIdentifier contained Cygwin MinGW
syn keyword dVersionIdentifier contained LittleEndian BigEndian
syn keyword dVersionIdentifier contained D_InlineAsm_X86 D_InlineAsm_X86_64
syn keyword dVersionIdentifier contained D_Version2 D_Coverage D_Ddoc D_LP64 D_PIC
-syn keyword dVersionIdentifier contained unittest none all
+syn keyword dVersionIdentifier contained unittest assert none all
syn cluster dComment contains=dNestedComment,dBlockComment,dLineComment
@@ -168,10 +171,10 @@ syn match dExternal "\<extern\>"
syn match dExtern "\<extern\s*([_a-zA-Z][_a-zA-Z0-9\+]*\>"he=s+6 contains=dExternIdentifier
" Make import a region to prevent highlighting keywords
-syn region dImport start="import\_s" end=";" contains=dExternal,@dComment
+syn region dImport start="\<import\_s" end=";" contains=dExternal,@dComment
" Make module a region to prevent highlighting keywords
-syn region dImport start="module\_s" end=";" contains=dExternal,@dComment
+syn region dImport start="\<module\_s" end=";" contains=dExternal,@dComment
" dTokens is used by the token string highlighting
syn cluster dTokens contains=dExternal,dConditional,dBranch,dRepeat,dBoolean
@@ -246,13 +249,17 @@ syn match dUnicode "\\u\d\{4\}"
" String.
"
-syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dEscSequence,@Spell
+syn match dFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
+syn match dFormat display "%%" contained
+
+syn region dString start=+"+ end=+"[cwd]\=+ skip=+\\\\\|\\"+ contains=dFormat,dEscSequence,@Spell
syn region dRawString start=+`+ end=+`[cwd]\=+ contains=@Spell
syn region dRawString start=+r"+ end=+"[cwd]\=+ contains=@Spell
syn region dHexString start=+x"+ end=+"[cwd]\=+ contains=@Spell
syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ contains=@Spell
syn region dHereString start=+q"\z(\I\i*\)\n+ end=+^\z1"+ contains=@Spell
+
" Nesting delimited string contents
"
syn region dNestParenString start=+(+ end=+)+ contained transparent contains=dNestParenString,@Spell
@@ -276,8 +283,8 @@ syn cluster dTokens add=dString,dRawString,dHexString,dDelimString,dNestString
" Token strings
"
-syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens
-syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens
+syn region dNestTokenString start=+{+ end=+}+ contained contains=dNestTokenString,@dTokens,dFormat
+syn region dTokenString matchgroup=dTokenStringBrack transparent start=+q{+ end=+}+ contains=dNestTokenString,@dTokens,dFormat
syn cluster dTokens add=dTokenString
@@ -357,6 +364,7 @@ hi def link dString String
hi def link dHexString String
hi def link dCharacter Character
hi def link dEscSequence SpecialChar
+hi def link dFormat SpecialChar
hi def link dSpecialCharError Error
hi def link dOctalError Error
hi def link dOperator Operator
diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim
index 37bf38fe11..b08adec31d 100644
--- a/runtime/syntax/dcl.vim
+++ b/runtime/syntax/dcl.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: DCL (Digital Command Language - vms)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
-" Last Change: Oct 23, 2014
-" Version: 7
+" Last Change: Jan 20, 2016
+" Version: 8
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL
" For version 5.x: Clear all syntax items
@@ -13,10 +13,10 @@ elseif exists("b:current_syntax")
finish
endif
-if version < 600
- set iskeyword=$,@,48-57,_
-else
+if !has("patch-7.4.1141")
setlocal iskeyword=$,@,48-57,_
+else
+ syn iskeyword $,@,48-57,_
endif
syn case ignore
diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim
index 2528f4f9b1..f496398d50 100644
--- a/runtime/syntax/lisp.vim
+++ b/runtime/syntax/lisp.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Lisp
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
-" Last Change: Oct 06, 2014
-" Version: 23
+" Last Change: Jan 20, 2016
+" Version: 24
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP
"
" Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec
@@ -16,8 +16,10 @@ endif
if exists("g:lisp_isk")
exe "setl isk=".g:lisp_isk
-else
+elseif !has("patch-7.4.1141")
setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_
+else
+ syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_
endif
if exists("g:lispsyntax_ignorecase") || exists("g:lispsyntax_clisp")
diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim
index 9c94643836..9a4db26dd8 100644
--- a/runtime/syntax/maple.vim
+++ b/runtime/syntax/maple.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Maple V (based on release 4)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
-" Last Change: Oct 23, 2014
-" Version: 11
+" Last Change: Jan 20, 2016
+" Version: 12
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE
"
" Package Function Selection: {{{1
@@ -30,10 +30,10 @@ elseif exists("b:current_syntax")
endif
" Iskeyword Effects: {{{1
-if version < 600
- set iskeyword=$,48-57,_,a-z,@-Z
+if !has("patch-7.4.1141")
+ setl isk=$,48-57,_,a-z,@-Z
else
- setlocal iskeyword=$,48-57,_,a-z,@-Z
+ syn iskeyword $,48-57,_,a-z,@-Z
endif
" Package Selection: {{{1
diff --git a/runtime/syntax/messages.vim b/runtime/syntax/messages.vim
index 4648e94c13..c22e4e8d0c 100644
--- a/runtime/syntax/messages.vim
+++ b/runtime/syntax/messages.vim
@@ -3,6 +3,7 @@
" Maintainer: Yakov Lerner <iler.ml@gmail.com>
" Latest Revision: 2008-06-29
" Changes: 2008-06-29 support for RFC3339 tuimestamps James Vega
+" 2016 Jan 19: messagesDate changed by Bram
if exists("b:current_syntax")
finish
@@ -13,7 +14,7 @@ set cpo&vim
syn match messagesBegin display '^' nextgroup=messagesDate,messagesDateRFC3339
-syn match messagesDate contained display '\a\a\a [ 0-9]\d *'
+syn match messagesDate contained display '[[:lower:][:upper:]][[:lower:][:upper:]][[:lower:][:upper:]] [ 0-9]\d *'
\ nextgroup=messagesHour
syn match messagesHour contained display '\d\d:\d\d:\d\d\s*'
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 909ead81f1..15a00eb516 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Dec 11, 2015
-" Version: 143
+" Last Change: Feb 16, 2016
+" Version: 144
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
@@ -85,6 +85,11 @@ if g:sh_fold_enabled && &fdm == "manual"
setl fdm=syntax
endif
+" set up the syntax-highlighting iskeyword
+if has("patch-7.4.1141")
+ exe "syn iskeyword ".&iskeyword.",-"
+endif
+
" Set up folding commands for shell {{{1
" =================================
if s:sh_fold_functions
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index d31e14bed0..40013b5b99 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
-" Last Change: Oct 20, 2015
-" Version: 90
+" Last Change: Jan 20, 2016
+" Version: 91
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -129,8 +129,10 @@ endif
" g:tex_isk
if exists("g:tex_isk")
exe "setlocal isk=".g:tex_isk
+elseif !has("patch-7.4.1141")
+ setl isk=48-57,a-z,A-Z,192-255
else
- setlocal isk=48-57,a-z,A-Z,192-255
+ syn iskeyword 48-57,a-z,A-Z,192-255
endif
if b:tex_stylish
setlocal isk+=@-@
diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim
index 162577669f..25d4cd4936 100644
--- a/runtime/syntax/zsh.vim
+++ b/runtime/syntax/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2015-12-25
+" Latest Revision: 2016-01-25
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -14,6 +14,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal iskeyword+=-
+setlocal foldmethod=syntax
syn keyword zshTodo contained TODO FIXME XXX NOTE
@@ -307,19 +308,19 @@ syn match zshNumber '[+-]\=\d\+\.\d\+\>'
" TODO: $[...] is the same as $((...)), so add that as well.
syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst
syn region zshSubst matchgroup=zshSubstDelim transparent
- \ start='\$(' skip='\\)' end=')' contains=TOP
-syn region zshParentheses transparent start='(' skip='\\)' end=')'
+ \ start='\$(' skip='\\)' end=')' contains=TOP fold
+syn region zshParentheses transparent start='(' skip='\\)' end=')' fold
syn region zshMathSubst matchgroup=zshSubstDelim transparent
\ start='\$((' skip='\\)'
\ matchgroup=zshSubstDelim end='))'
\ contains=zshParentheses,@zshSubst,zshNumber,
- \ @zshDerefs,zshString keepend
+ \ @zshDerefs,zshString keepend fold
syn region zshBrackets contained transparent start='{' skip='\\}'
- \ end='}'
+ \ end='}' fold
syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}'
- \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString
+ \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold
syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+
- \ end=+`+ contains=TOP,zshOldSubst
+ \ end=+`+ contains=TOP,zshOldSubst fold
syn sync minlines=50 maxlines=90
syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)'
diff --git a/scripts/msgpack-gen.lua b/scripts/msgpack-gen.lua
index 190af636dc..2da3c174f9 100644
--- a/scripts/msgpack-gen.lua
+++ b/scripts/msgpack-gen.lua
@@ -45,7 +45,7 @@ grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
assert(#arg >= 1)
functions = {}
--- names of all headers relative to the source root(for inclusion in the
+-- names of all headers relative to the source root (for inclusion in the
-- generated file)
headers = {}
-- output file(dispatch function + metadata serialized with msgpack)
@@ -64,24 +64,22 @@ for i = 1, #arg - 1 do
local tmp = grammar:match(input:read('*all'))
for i = 1, #tmp do
local fn = tmp[i]
- if fn.noexport then
- goto continue
- end
- functions[#functions + 1] = tmp[i]
- if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
- -- this function should receive the channel id
- fn.receives_channel_id = true
- -- remove the parameter since it won't be passed by the api client
- table.remove(fn.parameters, 1)
- end
- if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
- -- function can fail if the last parameter type is 'Error'
- fn.can_fail = true
- -- remove the error parameter, msgpack has it's own special field
- -- for specifying errors
- fn.parameters[#fn.parameters] = nil
+ if not fn.noexport then
+ functions[#functions + 1] = tmp[i]
+ if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
+ -- this function should receive the channel id
+ fn.receives_channel_id = true
+ -- remove the parameter since it won't be passed by the api client
+ table.remove(fn.parameters, 1)
+ end
+ if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
+ -- function can fail if the last parameter type is 'Error'
+ fn.can_fail = true
+ -- remove the error parameter, msgpack has it's own special field
+ -- for specifying errors
+ fn.parameters[#fn.parameters] = nil
+ end
end
- ::continue::
end
input:close()
end
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index 62f2b80a82..a40090d4c3 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -92,7 +92,7 @@ commit_message() {
find_git_remote() {
git remote -v \
- | awk '$2 ~ /github.com[:/]neovim\/neovim/ && $3 == "(fetch)" {print $1; exit}'
+ | awk '$2 ~ /github.com[:\/]neovim\/neovim/ && $3 == "(fetch)" {print $1; exit}'
}
assign_commit_details() {
diff --git a/.asan-blacklist b/src/.asan-blacklist
index 63558170b3..63558170b3 100644
--- a/.asan-blacklist
+++ b/src/.asan-blacklist
diff --git a/.valgrind.supp b/src/.valgrind.supp
index 8b630fcaaf..8b630fcaaf 100644
--- a/.valgrind.supp
+++ b/src/.valgrind.supp
diff --git a/Doxyfile b/src/Doxyfile
index de31c8355f..de31c8355f 100644
--- a/Doxyfile
+++ b/src/Doxyfile
diff --git a/clint.py b/src/clint.py
index c19ba4b7ae..80e4c4ac39 100755
--- a/clint.py
+++ b/src/clint.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# vim: set fileencoding=utf-8
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
@@ -217,6 +218,8 @@ _ERROR_CATEGORIES = [
'whitespace/semicolon',
'whitespace/tab',
'whitespace/todo',
+ 'whitespace/line_continuation',
+ 'whitespace/cast',
]
# The default state of the category filter. This is overrided by the --filter=
@@ -2499,6 +2502,27 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
error(filename, linenum, 'whitespace/braces', 5,
'Missing space before }')
+ if Search(r'\S {2,}\\$', line):
+ error(filename, linenum, 'whitespace/line_continuation', 5,
+ 'Too many spaces before \\, line continuation character must be '
+ 'preceded by exactly one space. For “blank lines†'
+ 'it is preferred to use the same amount of spaces as preceding '
+ 'indent')
+
+ if Match(r'^ +#', line):
+ error(filename, linenum, 'whitespace/indent', 5,
+ 'Must not indent preprocessor directives, use 1-space indent '
+ 'after the hash')
+
+ cast_line = re.sub(r'^# *define +\w+\([^)]*\)', '', line)
+ match = Search(r'\((?:const )?(?:struct )?[a-zA-Z_]\w*(?: *\*(?:const)?)*\)'
+ r' +'
+ r'-?(?:\*+|&)?(?:\w+|\+\+|--|\()', cast_line)
+ if match and line[0] == ' ':
+ error(filename, linenum, 'whitespace/cast', 2,
+ 'Should leave no spaces after a cast: {!r}'.format(
+ match.group(0)))
+
def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 20927ec899..feb17e070e 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -78,6 +78,9 @@ foreach(sfile ${NEOVIM_SOURCES})
if(${f} MATCHES "^(regexp_nfa.c)$")
list(APPEND to_remove ${sfile})
endif()
+ if(WIN32 AND ${f} MATCHES "^(pty_process_unix.c)$")
+ list(APPEND to_remove ${sfile})
+ endif()
endforeach()
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
@@ -268,7 +271,7 @@ if(CLANG_ASAN_UBSAN)
set(SANITIZE_RECOVER -fno-sanitize-recover) # Clang 3.5-
endif()
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ")
- set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/.asan-blacklist")
+ set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist")
set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ")
elseif(CLANG_MSAN)
message(STATUS "Enabling Clang memory sanitizer for nvim.")
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index fbfa87d5ae..80a88becf4 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -12,8 +12,8 @@
#define REMOTE_TYPE(type) typedef uint64_t type
#ifdef INCLUDE_GENERATED_DECLARATIONS
- #define ArrayOf(...) Array
- #define DictionaryOf(...) Dictionary
+# define ArrayOf(...) Array
+# define DictionaryOf(...) Dictionary
#endif
// Basic types
diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c
index abbda95073..69df7294ad 100644
--- a/src/nvim/api/private/handle.c
+++ b/src/nvim/api/private/handle.c
@@ -7,24 +7,24 @@
#define HANDLE_INIT(name) name##_handles = pmap_new(uint64_t)()
-#define HANDLE_IMPL(type, name) \
- static PMap(uint64_t) *name##_handles = NULL; \
- \
- type *handle_get_##name(uint64_t handle) \
- { \
- return pmap_get(uint64_t)(name##_handles, handle); \
- } \
- \
- void handle_register_##name(type *name) \
- { \
- assert(!name->handle); \
- name->handle = next_handle++; \
- pmap_put(uint64_t)(name##_handles, name->handle, name); \
- } \
- \
- void handle_unregister_##name(type *name) \
- { \
- pmap_del(uint64_t)(name##_handles, name->handle); \
+#define HANDLE_IMPL(type, name) \
+ static PMap(uint64_t) *name##_handles = NULL; \
+ \
+ type *handle_get_##name(uint64_t handle) \
+ { \
+ return pmap_get(uint64_t)(name##_handles, handle); \
+ } \
+ \
+ void handle_register_##name(type *name) \
+ { \
+ assert(!name->handle); \
+ name->handle = next_handle++; \
+ pmap_put(uint64_t)(name##_handles, name->handle, name); \
+ } \
+ \
+ void handle_unregister_##name(type *name) \
+ { \
+ pmap_del(uint64_t)(name##_handles, name->handle); \
}
static uint64_t next_handle = 1;
diff --git a/src/nvim/api/private/handle.h b/src/nvim/api/private/handle.h
index 1a196f6797..804e266dc3 100644
--- a/src/nvim/api/private/handle.h
+++ b/src/nvim/api/private/handle.h
@@ -4,9 +4,9 @@
#include "nvim/vim.h"
#include "nvim/buffer_defs.h"
-#define HANDLE_DECLS(type, name) \
- type *handle_get_##name(uint64_t handle); \
- void handle_register_##name(type *name); \
+#define HANDLE_DECLS(type, name) \
+ type *handle_get_##name(uint64_t handle); \
+ void handle_register_##name(type *name); \
void handle_unregister_##name(type *name);
HANDLE_DECLS(buf_T, buffer)
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h
index a0f14ac7a4..731f186ecc 100644
--- a/src/nvim/api/private/helpers.h
+++ b/src/nvim/api/private/helpers.h
@@ -8,66 +8,56 @@
#include "nvim/memory.h"
#include "nvim/lib/kvec.h"
-#define api_set_error(err, errtype, ...) \
- do { \
- snprintf((err)->msg, \
- sizeof((err)->msg), \
- __VA_ARGS__); \
- (err)->set = true; \
- (err)->type = kErrorType##errtype; \
+#define api_set_error(err, errtype, ...) \
+ do { \
+ snprintf((err)->msg, \
+ sizeof((err)->msg), \
+ __VA_ARGS__); \
+ (err)->set = true; \
+ (err)->type = kErrorType##errtype; \
} while (0)
#define OBJECT_OBJ(o) o
-#define BOOLEAN_OBJ(b) ((Object) { \
- .type = kObjectTypeBoolean, \
- .data.boolean = b \
- })
-
-#define INTEGER_OBJ(i) ((Object) { \
- .type = kObjectTypeInteger, \
- .data.integer = i \
- })
-
-#define STRING_OBJ(s) ((Object) { \
- .type = kObjectTypeString, \
- .data.string = s \
- })
-
-#define BUFFER_OBJ(s) ((Object) { \
- .type = kObjectTypeBuffer, \
- .data.buffer = s \
- })
-
-#define WINDOW_OBJ(s) ((Object) { \
- .type = kObjectTypeWindow, \
- .data.window = s \
- })
-
-#define TABPAGE_OBJ(s) ((Object) { \
- .type = kObjectTypeTabpage, \
- .data.tabpage = s \
- })
-
-#define ARRAY_OBJ(a) ((Object) { \
- .type = kObjectTypeArray, \
- .data.array = a \
- })
-
-#define DICTIONARY_OBJ(d) ((Object) { \
- .type = kObjectTypeDictionary, \
- .data.dictionary = d \
- })
+#define BOOLEAN_OBJ(b) ((Object) { \
+ .type = kObjectTypeBoolean, \
+ .data.boolean = b })
+
+#define INTEGER_OBJ(i) ((Object) { \
+ .type = kObjectTypeInteger, \
+ .data.integer = i })
+
+#define STRING_OBJ(s) ((Object) { \
+ .type = kObjectTypeString, \
+ .data.string = s })
+
+#define BUFFER_OBJ(s) ((Object) { \
+ .type = kObjectTypeBuffer, \
+ .data.buffer = s })
+
+#define WINDOW_OBJ(s) ((Object) { \
+ .type = kObjectTypeWindow, \
+ .data.window = s })
+
+#define TABPAGE_OBJ(s) ((Object) { \
+ .type = kObjectTypeTabpage, \
+ .data.tabpage = s })
+
+#define ARRAY_OBJ(a) ((Object) { \
+ .type = kObjectTypeArray, \
+ .data.array = a })
+
+#define DICTIONARY_OBJ(d) ((Object) { \
+ .type = kObjectTypeDictionary, \
+ .data.dictionary = d })
#define NIL ((Object) {.type = kObjectTypeNil})
-#define PUT(dict, k, v) \
- kv_push(KeyValuePair, \
- dict, \
- ((KeyValuePair) {.key = cstr_to_string(k), .value = v}))
+#define PUT(dict, k, v) \
+ kv_push(dict, ((KeyValuePair) { .key = cstr_to_string(k), .value = v }))
-#define ADD(array, item) \
- kv_push(Object, array, item)
+#define ADD(array, item) \
+ kv_push(array, item)
#define STATIC_CSTR_AS_STRING(s) ((String) {.data = s, .size = sizeof(s) - 1})
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 46d72b847d..ac7cc65ee4 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -57,6 +57,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
bool remap = true;
bool insert = false;
bool typed = false;
+ bool execute = false;
if (keys.size == 0) {
return;
@@ -68,6 +69,7 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
case 'm': remap = true; break;
case 't': typed = true; break;
case 'i': insert = true; break;
+ case 'x': execute = true; break;
}
}
@@ -86,8 +88,12 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
xfree(keys_esc);
}
- if (vgetc_busy)
+ if (vgetc_busy) {
typebuf_was_filled = true;
+ }
+ if (execute) {
+ exec_normal(true);
+ }
}
/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
@@ -641,14 +647,14 @@ static void write_msg(String message, bool to_err)
static size_t out_pos = 0, err_pos = 0;
static char out_line_buf[LINE_BUFFER_SIZE], err_line_buf[LINE_BUFFER_SIZE];
-#define PUSH_CHAR(i, pos, line_buf, msg) \
- if (message.data[i] == NL || pos == LINE_BUFFER_SIZE - 1) { \
- line_buf[pos] = NUL; \
- msg((uint8_t *)line_buf); \
- pos = 0; \
- continue; \
- } \
- \
+#define PUSH_CHAR(i, pos, line_buf, msg) \
+ if (message.data[i] == NL || pos == LINE_BUFFER_SIZE - 1) { \
+ line_buf[pos] = NUL; \
+ msg((uint8_t *)line_buf); \
+ pos = 0; \
+ continue; \
+ } \
+ \
line_buf[pos++] = message.data[i];
++no_wait_return;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 72716daf0e..71ec20c788 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1534,6 +1534,7 @@ void free_buf_options(buf_T *buf, int free_p_ff)
clear_string_option(&buf->b_p_cms);
clear_string_option(&buf->b_p_nf);
clear_string_option(&buf->b_p_syn);
+ clear_string_option(&buf->b_s.b_syn_isk);
clear_string_option(&buf->b_s.b_p_spc);
clear_string_option(&buf->b_s.b_p_spf);
vim_regfree(buf->b_s.b_cap_prog);
@@ -4950,7 +4951,7 @@ int bufhl_add_hl(buf_T *buf,
bufhl_vec_T* lineinfo = map_ref(linenr_T, bufhl_vec_T)(buf->b_bufhl_info,
lnum, true);
- bufhl_hl_item_T *hlentry = kv_pushp(bufhl_hl_item_T, *lineinfo);
+ bufhl_hl_item_T *hlentry = kv_pushp(*lineinfo);
hlentry->src_id = src_id;
hlentry->hl_id = hl_id;
hlentry->start = col_start;
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h
index d51a2f7dae..36cbec7e60 100644
--- a/src/nvim/buffer.h
+++ b/src/nvim/buffer.h
@@ -76,14 +76,14 @@ static inline void restore_win_for_buf(win_T *save_curwin,
}
}
-#define WITH_BUFFER(b, code) \
- do { \
- buf_T *save_curbuf = NULL; \
- win_T *save_curwin = NULL; \
- tabpage_T *save_curtab = NULL; \
- switch_to_win_for_buf(b, &save_curwin, &save_curtab, &save_curbuf); \
- code; \
- restore_win_for_buf(save_curwin, save_curtab, save_curbuf); \
+#define WITH_BUFFER(b, code) \
+ do { \
+ buf_T *save_curbuf = NULL; \
+ win_T *save_curwin = NULL; \
+ tabpage_T *save_curtab = NULL; \
+ switch_to_win_for_buf(b, &save_curwin, &save_curtab, &save_curbuf); \
+ code; \
+ restore_win_for_buf(save_curwin, save_curtab, save_curbuf); \
} while (0)
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 0324f6b88a..b515c4e1e4 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -438,15 +438,17 @@ typedef struct {
linenr_T b_sst_check_lnum;
uint16_t b_sst_lasttick; /* last display tick */
- /* for spell checking */
- garray_T b_langp; /* list of pointers to slang_T, see spell.c */
- bool b_spell_ismw[256]; /* flags: is midword char */
- char_u *b_spell_ismw_mb; /* multi-byte midword chars */
- char_u *b_p_spc; /* 'spellcapcheck' */
- regprog_T *b_cap_prog; /* program for 'spellcapcheck' */
- char_u *b_p_spf; /* 'spellfile' */
- char_u *b_p_spl; /* 'spelllang' */
- int b_cjk; /* all CJK letters as OK */
+ // for spell checking
+ garray_T b_langp; // list of pointers to slang_T, see spell.c
+ bool b_spell_ismw[256]; // flags: is midword char
+ char_u *b_spell_ismw_mb; // multi-byte midword chars
+ char_u *b_p_spc; // 'spellcapcheck'
+ regprog_T *b_cap_prog; // program for 'spellcapcheck'
+ char_u *b_p_spf; // 'spellfile'
+ char_u *b_p_spl; // 'spelllang'
+ int b_cjk; // all CJK letters as OK
+ char_u b_syn_chartab[32]; // syntax iskeyword option
+ char_u *b_syn_isk; // iskeyword option
} synblock_T;
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index d0dc7b66fc..5ae4416052 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1582,7 +1582,7 @@ static char_u latin1lower[257] =
///
/// @param c character to check
bool vim_islower(int c)
- FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (c <= '@') {
return false;
@@ -1613,7 +1613,7 @@ bool vim_islower(int c)
///
/// @param c character to check
bool vim_isupper(int c)
- FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (c <= '@') {
return false;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 74efadc9e4..03ef41f849 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -961,7 +961,7 @@ static int insert_handle_key(InsertState *s)
break;
case K_EVENT: // some event
- queue_process_events(loop.events);
+ queue_process_events(main_loop.events);
break;
case K_FOCUSGAINED: // Neovim has been given focus
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index dce3556de6..111105fa37 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -67,6 +67,7 @@
#include "nvim/syntax.h"
#include "nvim/tag.h"
#include "nvim/ui.h"
+#include "nvim/main.h"
#include "nvim/mouse.h"
#include "nvim/terminal.h"
#include "nvim/undo.h"
@@ -76,7 +77,7 @@
#include "nvim/eval/decode.h"
#include "nvim/os/os.h"
#include "nvim/event/libuv_process.h"
-#include "nvim/event/pty_process.h"
+#include "nvim/os/pty_process.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/time.h"
@@ -507,6 +508,7 @@ void eval_init(void)
/* add to compat scope dict */
hash_add(&compat_hashtab, p->vv_di.di_key);
}
+ vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
dict_T *const msgpack_types_dict = dict_alloc();
for (size_t i = 0; i < ARRAY_SIZE(msgpack_type_names); i++) {
@@ -2977,11 +2979,16 @@ int do_unlet(char_u *name, int forceit)
} else if (current_funccal != NULL
&& ht == &current_funccal->l_vars.dv_hashtab) {
d = &current_funccal->l_vars;
+ } else if (ht == &compat_hashtab) {
+ d = &vimvardict;
} else {
di = find_var_in_ht(ht, *name, (char_u *)"", false);
d = di->di_tv.vval.v_dict;
}
-
+ if (d == NULL) {
+ EMSG2(_(e_intern2), "do_unlet()");
+ return FAIL;
+ }
hi = hash_find(ht, varname);
if (!HASHITEM_EMPTY(hi)) {
di = HI2DI(hi);
@@ -2990,6 +2997,11 @@ int do_unlet(char_u *name, int forceit)
|| tv_check_lock(d->dv_lock, name, false)) {
return FAIL;
}
+
+ if (d == NULL || tv_check_lock(d->dv_lock, name, false)) {
+ return FAIL;
+ }
+
typval_T oldtv;
bool watched = is_watched(dict);
@@ -9887,7 +9899,7 @@ static void f_getcmdwintype(typval_T *argvars, typval_T *rettv)
static void f_getcwd(typval_T *argvars, typval_T *rettv)
{
// Possible scope of working directory to return.
- CdScope scope = MIN_CD_SCOPE;
+ CdScope scope = kCdScopeInvalid;
// Numbers of the scope objects (window, tab) we want the working directory
// of. A `-1` means to skip this scope, a `0` means the current object.
@@ -9916,26 +9928,27 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv)
return;
}
scope_number[i] = argvars[i].vval.v_number;
- // The scope is the current iteration step.
- scope = i;
// It is an error for the scope number to be less than `-1`.
if (scope_number[i] < -1) {
EMSG(_(e_invarg));
return;
}
+ // Use the narrowest scope the user requested
+ if (scope_number[i] >= 0 && scope == kCdScopeInvalid) {
+ // The scope is the current iteration step.
+ scope = i;
+ } else if (scope_number[i] < 0) {
+ scope = i + 1;
+ }
}
- // Normalize scope, the number of the new scope will be 0.
- if (scope_number[scope] < 0) {
- // Arguments to `getcwd` always end at second-highest scope, so scope will
- // always be <= `MAX_CD_SCOPE`.
- scope++;
+ // If the user didn't specify anything, default to window scope
+ if (scope == kCdScopeInvalid) {
+ scope = MIN_CD_SCOPE;
}
// Find the tabpage by number
- if (scope_number[kCdScopeTab] == -1) {
- tp = NULL;
- } else if (scope_number[kCdScopeTab] > 0) {
+ if (scope_number[kCdScopeTab] > 0) {
tp = find_tabpage(scope_number[kCdScopeTab]);
if (!tp) {
EMSG(_("E5000: Cannot find tab number."));
@@ -9944,16 +9957,14 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv)
}
// Find the window in `tp` by number, `NULL` if none.
- if (scope_number[kCdScopeWindow] == -1) {
- win = NULL;
- } else if (scope_number[kCdScopeWindow] >= 0) {
- if (!tp) {
+ if (scope_number[kCdScopeWindow] >= 0) {
+ if (scope_number[kCdScopeTab] < 0) {
EMSG(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
return;
}
if (scope_number[kCdScopeWindow] > 0) {
- win = find_win_by_nr(&argvars[0], curtab);
+ win = find_win_by_nr(&argvars[0], tp);
if (!win) {
EMSG(_("E5002: Cannot find window number."));
return;
@@ -9988,6 +9999,9 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv)
}
}
break;
+ case kCdScopeInvalid:
+ // We should never get here
+ assert(false);
}
if (from) {
@@ -10835,7 +10849,7 @@ static void f_has_key(typval_T *argvars, typval_T *rettv)
static void f_haslocaldir(typval_T *argvars, typval_T *rettv)
{
// Possible scope of working directory to return.
- CdScope scope = MIN_CD_SCOPE;
+ CdScope scope = kCdScopeInvalid;
// Numbers of the scope objects (window, tab) we want the working directory
// of. A `-1` means to skip this scope, a `0` means the current object.
@@ -10860,25 +10874,26 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv)
return;
}
scope_number[i] = argvars[i].vval.v_number;
- // The scope is the current iteration step.
- scope = i;
if (scope_number[i] < -1) {
EMSG(_(e_invarg));
return;
}
+ // Use the narrowest scope the user requested
+ if (scope_number[i] >= 0 && scope == kCdScopeInvalid) {
+ // The scope is the current iteration step.
+ scope = i;
+ } else if (scope_number[i] < 0) {
+ scope = i + 1;
+ }
}
- // Normalize scope, the number of the new scope will be 0.
- if (scope_number[scope] < 0) {
- // Arguments to `haslocaldir` always end at second-highest scope, so scope
- // will always be <= `MAX_CD_SCOPE`.
- scope++;
+ // If the user didn't specify anything, default to window scope
+ if (scope == kCdScopeInvalid) {
+ scope = MIN_CD_SCOPE;
}
// Find the tabpage by number
- if (scope_number[kCdScopeTab] == -1) {
- tp = NULL;
- } else if (scope_number[kCdScopeTab] > 0) {
+ if (scope_number[kCdScopeTab] > 0) {
tp = find_tabpage(scope_number[kCdScopeTab]);
if (!tp) {
EMSG(_("5000: Cannot find tab number."));
@@ -10887,16 +10902,14 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv)
}
// Find the window in `tp` by number, `NULL` if none.
- if (scope_number[kCdScopeWindow] == -1) {
- win = NULL;
- } else if (scope_number[kCdScopeWindow] >= 0) {
- if (!tp) {
+ if (scope_number[kCdScopeWindow] >= 0) {
+ if (scope_number[kCdScopeTab] < 0) {
EMSG(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
return;
}
if (scope_number[kCdScopeWindow] > 0) {
- win = find_win_by_nr(&argvars[0], curtab);
+ win = find_win_by_nr(&argvars[0], tp);
if (!win) {
EMSG(_("E5002: Cannot find window number."));
return;
@@ -10917,6 +10930,9 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv)
// The global scope never has a local directory
rettv->vval.v_number = 0;
break;
+ case kCdScopeInvalid:
+ // We should never get here
+ assert(false);
}
}
@@ -11726,8 +11742,21 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv)
dict_T *job_opts = NULL;
ufunc_T *on_stdout = NULL, *on_stderr = NULL, *on_exit = NULL;
+ char *cwd = NULL;
if (argvars[1].v_type == VAR_DICT) {
job_opts = argvars[1].vval.v_dict;
+
+ char *new_cwd = (char *)get_dict_string(job_opts, (char_u *)"cwd", false);
+ if (new_cwd && strlen(new_cwd) > 0) {
+ cwd = new_cwd;
+ // The new cwd must be a directory.
+ if (!os_isdir((char_u *)cwd)) {
+ EMSG2(_(e_invarg2), "expected valid directory");
+ shell_free_argv(argv);
+ return;
+ }
+ }
+
if (!common_job_callbacks(job_opts, &on_stdout, &on_stderr, &on_exit)) {
shell_free_argv(argv);
return;
@@ -11737,7 +11766,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv)
bool pty = job_opts && get_dict_number(job_opts, (uint8_t *)"pty") != 0;
bool detach = job_opts && get_dict_number(job_opts, (uint8_t *)"detach") != 0;
TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit,
- job_opts, pty, detach);
+ job_opts, pty, detach, cwd);
Process *proc = (Process *)&data->proc;
if (pty) {
@@ -11812,7 +11841,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
list_T *rv = list_alloc();
ui_busy_start();
- Queue *waiting_jobs = queue_new_parent(loop_on_put, &loop);
+ Queue *waiting_jobs = queue_new_parent(loop_on_put, &main_loop);
// For each item in the input list append an integer to the output list. -3
// is used to represent an invalid job id, -2 is for a interrupted job and
// -1 for jobs that were skipped or timed out.
@@ -11890,7 +11919,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv)
}
// restore the parent queue for the job
queue_process_events(data->events);
- queue_replace_parent(data->events, loop.events);
+ queue_replace_parent(data->events, main_loop.events);
}
queue_free(waiting_jobs);
@@ -15080,13 +15109,18 @@ typedef struct {
int idx;
} sortItem_T;
-static int item_compare_ic;
-static bool item_compare_numeric;
-static bool item_compare_numbers;
-static bool item_compare_float;
-static char_u *item_compare_func;
-static dict_T *item_compare_selfdict;
-static int item_compare_func_err;
+/// struct storing information about current sort
+typedef struct {
+ int item_compare_ic;
+ bool item_compare_numeric;
+ bool item_compare_numbers;
+ bool item_compare_float;
+ char_u *item_compare_func;
+ dict_T *item_compare_selfdict;
+ int item_compare_func_err;
+} sortinfo_T;
+static sortinfo_T *sortinfo = NULL;
+
#define ITEM_COMPARE_FAIL 999
/*
@@ -15106,14 +15140,14 @@ static int item_compare(const void *s1, const void *s2, bool keep_zero)
typval_T *tv1 = &si1->item->li_tv;
typval_T *tv2 = &si2->item->li_tv;
- if (item_compare_numbers) {
+ if (sortinfo->item_compare_numbers) {
long v1 = get_tv_number(tv1);
long v2 = get_tv_number(tv2);
return v1 == v2 ? 0 : v1 > v2 ? 1 : -1;
}
- if (item_compare_float) {
+ if (sortinfo->item_compare_float) {
float_T v1 = get_tv_float(tv1);
float_T v2 = get_tv_float(tv2);
@@ -15124,7 +15158,7 @@ static int item_compare(const void *s1, const void *s2, bool keep_zero)
// do that for string variables. Use a single quote when comparing with
// a non-string to do what the docs promise.
if (tv1->v_type == VAR_STRING) {
- if (tv2->v_type != VAR_STRING || item_compare_numeric) {
+ if (tv2->v_type != VAR_STRING || sortinfo->item_compare_numeric) {
p1 = (char_u *)"'";
} else {
p1 = tv1->vval.v_string;
@@ -15133,7 +15167,7 @@ static int item_compare(const void *s1, const void *s2, bool keep_zero)
tofree1 = p1 = (char_u *) encode_tv2string(tv1, NULL);
}
if (tv2->v_type == VAR_STRING) {
- if (tv1->v_type != VAR_STRING || item_compare_numeric) {
+ if (tv1->v_type != VAR_STRING || sortinfo->item_compare_numeric) {
p2 = (char_u *)"'";
} else {
p2 = tv2->vval.v_string;
@@ -15141,12 +15175,14 @@ static int item_compare(const void *s1, const void *s2, bool keep_zero)
} else {
tofree2 = p2 = (char_u *) encode_tv2string(tv2, NULL);
}
- if (p1 == NULL)
+ if (p1 == NULL) {
p1 = (char_u *)"";
- if (p2 == NULL)
+ }
+ if (p2 == NULL) {
p2 = (char_u *)"";
- if (!item_compare_numeric) {
- if (item_compare_ic) {
+ }
+ if (!sortinfo->item_compare_numeric) {
+ if (sortinfo->item_compare_ic) {
res = STRICMP(p1, p2);
} else {
res = STRCMP(p1, p2);
@@ -15187,9 +15223,10 @@ static int item_compare2(const void *s1, const void *s2, bool keep_zero)
typval_T argv[3];
int dummy;
- /* shortcut after failure in previous call; compare all items equal */
- if (item_compare_func_err)
+ // shortcut after failure in previous call; compare all items equal
+ if (sortinfo->item_compare_func_err) {
return 0;
+ }
si1 = (sortItem_T *)s1;
si2 = (sortItem_T *)s2;
@@ -15199,19 +15236,22 @@ static int item_compare2(const void *s1, const void *s2, bool keep_zero)
copy_tv(&si1->item->li_tv, &argv[0]);
copy_tv(&si2->item->li_tv, &argv[1]);
- rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
- res = call_func(item_compare_func, (int)STRLEN(item_compare_func),
- &rettv, 2, argv, 0L, 0L, &dummy, TRUE,
- item_compare_selfdict);
+ rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
+ res = call_func(sortinfo->item_compare_func,
+ (int)STRLEN(sortinfo->item_compare_func),
+ &rettv, 2, argv, 0L, 0L, &dummy, true,
+ sortinfo->item_compare_selfdict);
clear_tv(&argv[0]);
clear_tv(&argv[1]);
- if (res == FAIL)
+ if (res == FAIL) {
res = ITEM_COMPARE_FAIL;
- else
- res = get_tv_number_chk(&rettv, &item_compare_func_err);
- if (item_compare_func_err)
- res = ITEM_COMPARE_FAIL; /* return value has wrong type */
+ } else {
+ res = get_tv_number_chk(&rettv, &sortinfo->item_compare_func_err);
+ }
+ if (sortinfo->item_compare_func_err) {
+ res = ITEM_COMPARE_FAIL; // return value has wrong type
+ }
clear_tv(&rettv);
// When the result would be zero, compare the pointers themselves. Makes
@@ -15244,6 +15284,12 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
long len;
long i;
+ // Pointer to current info struct used in compare function. Save and restore
+ // the current one for nested calls.
+ sortinfo_T info;
+ sortinfo_T *old_sortinfo = sortinfo;
+ sortinfo = &info;
+
if (argvars[0].v_type != VAR_LIST) {
EMSG2(_(e_listarg), sort ? "sort()" : "uniq()");
} else {
@@ -15254,61 +15300,70 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
? N_("sort() argument")
: N_("uniq() argument")),
true)) {
- return;
+ goto theend;
}
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
len = list_len(l);
- if (len <= 1)
- return; /* short list sorts pretty quickly */
+ if (len <= 1) {
+ goto theend; // short list sorts pretty quickly
+ }
- item_compare_ic = FALSE;
- item_compare_numeric = false;
- item_compare_numbers = false;
- item_compare_float = false;
- item_compare_func = NULL;
- item_compare_selfdict = NULL;
+ info.item_compare_ic = false;
+ info.item_compare_numeric = false;
+ info.item_compare_numbers = false;
+ info.item_compare_float = false;
+ info.item_compare_func = NULL;
+ info.item_compare_selfdict = NULL;
if (argvars[1].v_type != VAR_UNKNOWN) {
/* optional second argument: {func} */
if (argvars[1].v_type == VAR_FUNC) {
- item_compare_func = argvars[1].vval.v_string;
+ info.item_compare_func = argvars[1].vval.v_string;
} else {
int error = FALSE;
i = get_tv_number_chk(&argvars[1], &error);
- if (error)
- return; /* type error; errmsg already given */
- if (i == 1)
- item_compare_ic = TRUE;
- else
- item_compare_func = get_tv_string(&argvars[1]);
- if (item_compare_func != NULL) {
- if (STRCMP(item_compare_func, "n") == 0) {
- item_compare_func = NULL;
- item_compare_numeric = true;
- } else if (STRCMP(item_compare_func, "N") == 0) {
- item_compare_func = NULL;
- item_compare_numbers = true;
- } else if (STRCMP(item_compare_func, "f") == 0) {
- item_compare_func = NULL;
- item_compare_float = true;
- } else if (STRCMP(item_compare_func, "i") == 0) {
- item_compare_func = NULL;
- item_compare_ic = TRUE;
+ if (error) {
+ goto theend; // type error; errmsg already given
+ }
+ if (i == 1) {
+ info.item_compare_ic = true;
+ } else if (argvars[1].v_type != VAR_NUMBER) {
+ info.item_compare_func = get_tv_string(&argvars[1]);
+ } else if (i != 0) {
+ EMSG(_(e_invarg));
+ goto theend;
+ }
+ if (info.item_compare_func != NULL) {
+ if (*info.item_compare_func == NUL) {
+ // empty string means default sort
+ info.item_compare_func = NULL;
+ } else if (STRCMP(info.item_compare_func, "n") == 0) {
+ info.item_compare_func = NULL;
+ info.item_compare_numeric = true;
+ } else if (STRCMP(info.item_compare_func, "N") == 0) {
+ info.item_compare_func = NULL;
+ info.item_compare_numbers = true;
+ } else if (STRCMP(info.item_compare_func, "f") == 0) {
+ info.item_compare_func = NULL;
+ info.item_compare_float = true;
+ } else if (STRCMP(info.item_compare_func, "i") == 0) {
+ info.item_compare_func = NULL;
+ info.item_compare_ic = true;
}
}
}
if (argvars[2].v_type != VAR_UNKNOWN) {
- /* optional third argument: {dict} */
+ // optional third argument: {dict}
if (argvars[2].v_type != VAR_DICT) {
EMSG(_(e_dictreq));
- return;
+ goto theend;
}
- item_compare_selfdict = argvars[2].vval.v_dict;
+ info.item_compare_selfdict = argvars[2].vval.v_dict;
}
}
@@ -15324,19 +15379,20 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
i++;
}
- item_compare_func_err = FALSE;
+ info.item_compare_func_err = false;
// Test the compare function.
- if (item_compare_func != NULL
+ if (info.item_compare_func != NULL
&& item_compare2_not_keeping_zero(&ptrs[0], &ptrs[1])
== ITEM_COMPARE_FAIL) {
EMSG(_("E702: Sort compare function failed"));
} else {
// Sort the array with item pointers.
qsort(ptrs, (size_t)len, sizeof (sortItem_T),
- item_compare_func == NULL ? item_compare_not_keeping_zero :
- item_compare2_not_keeping_zero);
+ (info.item_compare_func == NULL ?
+ item_compare_not_keeping_zero :
+ item_compare2_not_keeping_zero));
- if (!item_compare_func_err) {
+ if (!info.item_compare_func_err) {
// Clear the list and append the items in the sorted order.
l->lv_first = NULL;
l->lv_last = NULL;
@@ -15352,21 +15408,24 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
int (*item_compare_func_ptr)(const void *, const void *);
// f_uniq(): ptrs will be a stack of items to remove.
- item_compare_func_err = FALSE;
- item_compare_func_ptr = item_compare_func ? item_compare2_keeping_zero :
- item_compare_keeping_zero;
+ info.item_compare_func_err = false;
+ if (info.item_compare_func != NULL) {
+ item_compare_func_ptr = item_compare2_keeping_zero;
+ } else {
+ item_compare_func_ptr = item_compare_keeping_zero;
+ }
for (li = l->lv_first; li != NULL && li->li_next != NULL; li = li->li_next) {
if (item_compare_func_ptr(&li, &li->li_next) == 0) {
ptrs[i++].item = li;
}
- if (item_compare_func_err) {
+ if (info.item_compare_func_err) {
EMSG(_("E882: Uniq compare function failed"));
break;
}
}
- if (!item_compare_func_err) {
+ if (!info.item_compare_func_err) {
while (--i >= 0) {
assert(ptrs[i].item->li_next);
li = ptrs[i].item->li_next;
@@ -15385,6 +15444,9 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
xfree(ptrs);
}
+
+theend:
+ sortinfo = old_sortinfo;
}
/// "sort"({list})" function
@@ -16421,8 +16483,21 @@ static void f_termopen(typval_T *argvars, typval_T *rettv)
ufunc_T *on_stdout = NULL, *on_stderr = NULL, *on_exit = NULL;
dict_T *job_opts = NULL;
+ char *cwd = ".";
if (argvars[1].v_type == VAR_DICT) {
job_opts = argvars[1].vval.v_dict;
+
+ char *new_cwd = (char *)get_dict_string(job_opts, (char_u *)"cwd", false);
+ if (new_cwd && strlen(new_cwd) > 0) {
+ cwd = new_cwd;
+ // The new cwd must be a directory.
+ if (!os_isdir((char_u *)cwd)) {
+ EMSG2(_(e_invarg2), "expected valid directory");
+ shell_free_argv(argv);
+ return;
+ }
+ }
+
if (!common_job_callbacks(job_opts, &on_stdout, &on_stderr, &on_exit)) {
shell_free_argv(argv);
return;
@@ -16430,7 +16505,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv)
}
TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit,
- job_opts, true, false);
+ job_opts, true, false, cwd);
data->proc.pty.width = curwin->w_width;
data->proc.pty.height = curwin->w_height;
data->proc.pty.term_name = xstrdup("xterm-256color");
@@ -16445,11 +16520,6 @@ static void f_termopen(typval_T *argvars, typval_T *rettv)
topts.resize_cb = term_resize;
topts.close_cb = term_close;
- char *cwd = ".";
- if (argvars[1].v_type == VAR_STRING
- && os_isdir(argvars[1].vval.v_string)) {
- cwd = (char *)argvars[1].vval.v_string;
- }
int pid = data->proc.pty.process.pid;
char buf[1024];
@@ -16536,8 +16606,8 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv)
timer->timer_id = last_timer_id++;
timer->callback = func;
- time_watcher_init(&loop, &timer->tw, timer);
- timer->tw.events = queue_new_child(loop.events);
+ time_watcher_init(&main_loop, &timer->tw, timer);
+ timer->tw.events = queue_new_child(main_loop.events);
// if main loop is blocked, don't queue up multiple events
timer->tw.blockable = true;
time_watcher_start(&timer->tw, timer_due_cb, timeout,
@@ -16570,7 +16640,7 @@ static void timer_due_cb(TimeWatcher *tw, void *data)
{
timer_T *timer = (timer_T *)data;
if (timer->stopped) {
- return;
+ return;
}
// if repeat was negative repeat forever
if (timer->repeat_count >= 0 && --timer->repeat_count == 0) {
@@ -16610,6 +16680,14 @@ static void timer_free_cb(TimeWatcher *tw, void *data)
xfree(timer);
}
+void timer_teardown(void)
+{
+ timer_T *timer;
+ map_foreach_value(timers, timer, {
+ timer_stop(timer);
+ })
+}
+
/*
* "tolower(string)" function
*/
@@ -17709,7 +17787,8 @@ void set_vim_var_special(const VimVarIndex idx, const SpecialVarValue val)
void set_vim_var_string(const VimVarIndex idx, const char *const val,
const ptrdiff_t len)
{
- xfree(vimvars[idx].vv_str);
+ clear_tv(&vimvars[idx].vv_di.di_tv);
+ vimvars[idx].vv_type = VAR_STRING;
if (val == NULL) {
vimvars[idx].vv_str = NULL;
} else if (len == -1) {
@@ -17725,7 +17804,8 @@ void set_vim_var_string(const VimVarIndex idx, const char *const val,
/// @param[in,out] val Value to set to. Reference count will be incremented.
void set_vim_var_list(const VimVarIndex idx, list_T *const val)
{
- list_unref(vimvars[idx].vv_list);
+ clear_tv(&vimvars[idx].vv_di.di_tv);
+ vimvars[idx].vv_type = VAR_LIST;
vimvars[idx].vv_list = val;
if (val != NULL) {
val->lv_refcount++;
@@ -17739,7 +17819,8 @@ void set_vim_var_list(const VimVarIndex idx, list_T *const val)
/// Also keys of the dictionary will be made read-only.
void set_vim_var_dict(const VimVarIndex idx, dict_T *const val)
{
- dict_unref(vimvars[idx].vv_dict);
+ clear_tv(&vimvars[idx].vv_di.di_tv);
+ vimvars[idx].vv_type = VAR_DICT;
vimvars[idx].vv_dict = val;
if (val != NULL) {
@@ -21706,7 +21787,8 @@ static inline TerminalJobData *common_job_init(char **argv,
ufunc_T *on_exit,
dict_T *self,
bool pty,
- bool detach)
+ bool detach,
+ char *cwd)
{
TerminalJobData *data = xcalloc(1, sizeof(TerminalJobData));
data->stopped = false;
@@ -21714,11 +21796,11 @@ static inline TerminalJobData *common_job_init(char **argv,
data->on_stderr = on_stderr;
data->on_exit = on_exit;
data->self = self;
- data->events = queue_new_child(loop.events);
+ data->events = queue_new_child(main_loop.events);
if (pty) {
- data->proc.pty = pty_process_init(&loop, data);
+ data->proc.pty = pty_process_init(&main_loop, data);
} else {
- data->proc.uv = libuv_process_init(&loop, data);
+ data->proc.uv = libuv_process_init(&main_loop, data);
}
Process *proc = (Process *)&data->proc;
proc->argv = argv;
@@ -21730,6 +21812,7 @@ static inline TerminalJobData *common_job_init(char **argv,
proc->cb = on_process_exit;
proc->events = data->events;
proc->detach = detach;
+ proc->cwd = cwd;
return data;
}
@@ -21816,7 +21899,7 @@ static inline void free_term_job_data(TerminalJobData *data)
{
// data->queue may still be used after this function returns(process_wait), so
// only free in the next event loop iteration
- queue_put(loop.fast_events, free_term_job_data_event, 1, data);
+ queue_put(main_loop.fast_events, free_term_job_data_event, 1, data);
}
// vimscript job callbacks must be executed on Nvim main loop
@@ -22078,14 +22161,13 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments)
bool eval_has_provider(char *name)
{
-
-#define check_provider(name) \
- if (has_##name == -1) { \
- has_##name = !!find_func((uint8_t *)"provider#" #name "#Call"); \
- if (!has_##name) { \
- script_autoload((uint8_t *)"provider#" #name "#Call", false); \
- has_##name = !!find_func((uint8_t *)"provider#" #name "#Call"); \
- } \
+#define check_provider(name) \
+ if (has_##name == -1) { \
+ has_##name = !!find_func((uint8_t *)"provider#" #name "#Call"); \
+ if (!has_##name) { \
+ script_autoload((uint8_t *)"provider#" #name "#Call", false); \
+ has_##name = !!find_func((uint8_t *)"provider#" #name "#Call"); \
+ } \
}
static int has_clipboard = -1, has_python = -1, has_python3 = -1;
@@ -22104,9 +22186,8 @@ bool eval_has_provider(char *name)
return false;
}
-// Compute the `DictWatcher` address from a QUEUE node. This only exists because
-// ASAN doesn't handle `QUEUE_DATA` pointer arithmetic, and we blacklist this
-// function on .asan-blacklist.
+// Compute the `DictWatcher` address from a QUEUE node. This only exists for
+// .asan-blacklist (ASAN doesn't handle QUEUE_DATA pointer arithmetic).
static DictWatcher *dictwatcher_node_data(QUEUE *q)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
{
diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c
index 0774ef515f..43e9f76c0f 100644
--- a/src/nvim/eval/decode.c
+++ b/src/nvim/eval/decode.c
@@ -101,7 +101,7 @@ static inline int json_decoder_pop(ValuesStackItem obj,
FUNC_ATTR_NONNULL_ALL
{
if (kv_size(*container_stack) == 0) {
- kv_push(ValuesStackItem, *stack, obj);
+ kv_push(*stack, obj);
return OK;
}
ContainerStackItem last_container = kv_last(*container_stack);
@@ -190,7 +190,7 @@ static inline int json_decoder_pop(ValuesStackItem obj,
*next_map_special = true;
return OK;
}
- kv_push(ValuesStackItem, *stack, obj);
+ kv_push(*stack, obj);
}
return OK;
}
@@ -628,10 +628,8 @@ int json_decode_string(const char *const buf, const size_t buf_len,
convert_setup(&conv, (char_u *) "utf-8", p_enc);
conv.vc_fail = true;
int ret = OK;
- ValuesStack stack;
- kv_init(stack);
- ContainerStack container_stack;
- kv_init(container_stack);
+ ValuesStack stack = KV_INITIAL_VALUE;
+ ContainerStack container_stack = KV_INITIAL_VALUE;
rettv->v_type = VAR_UNKNOWN;
bool didcomma = false;
bool didcolon = false;
@@ -815,13 +813,13 @@ json_decode_string_cycle_start:
.v_lock = VAR_UNLOCKED,
.vval = { .v_list = list },
};
- kv_push(ContainerStackItem, container_stack, ((ContainerStackItem) {
+ kv_push(container_stack, ((ContainerStackItem) {
.stack_index = kv_size(stack),
.s = p,
.container = tv,
.special_val = NULL,
}));
- kv_push(ValuesStackItem, stack, OBJ(tv, false, didcomma, didcolon));
+ kv_push(stack, OBJ(tv, false, didcomma, didcolon));
break;
}
case '{': {
@@ -845,13 +843,13 @@ json_decode_string_cycle_start:
.vval = { .v_dict = dict },
};
}
- kv_push(ContainerStackItem, container_stack, ((ContainerStackItem) {
+ kv_push(container_stack, ((ContainerStackItem) {
.stack_index = kv_size(stack),
.s = p,
.container = tv,
.special_val = val_list,
}));
- kv_push(ValuesStackItem, stack, OBJ(tv, false, didcomma, didcolon));
+ kv_push(stack, OBJ(tv, false, didcomma, didcolon));
break;
}
default: {
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index c651a50be9..54daf7557e 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -6,6 +6,7 @@
#include <msgpack.h>
#include <inttypes.h>
+#include <stddef.h>
#include <assert.h>
#include <math.h>
@@ -22,6 +23,7 @@
#include "nvim/ascii.h"
#include "nvim/vim.h" // For _()
#include "nvim/lib/kvec.h"
+#include "nvim/eval/typval_encode.h"
#define ga_concat(a, b) ga_concat(a, (char_u *)b)
#define utf_ptr2char(b) utf_ptr2char((char_u *)b)
@@ -32,29 +34,6 @@
#define convert_setup(vcp, from, to) \
(convert_setup(vcp, (char_u *)from, (char_u *)to))
-/// Structure representing current VimL to messagepack conversion state
-typedef struct {
- enum {
- kMPConvDict, ///< Convert dict_T *dictionary.
- kMPConvList, ///< Convert list_T *list.
- kMPConvPairs, ///< Convert mapping represented as a list_T* of pairs.
- } type;
- union {
- struct {
- dict_T *dict; ///< Currently converted dictionary.
- hashitem_T *hi; ///< Currently converted dictionary item.
- size_t todo; ///< Amount of items left to process.
- } d; ///< State of dictionary conversion.
- struct {
- list_T *list; ///< Currently converted list.
- listitem_T *li; ///< Currently converted list item.
- } l; ///< State of list or generic mapping conversion.
- } data; ///< Data to convert.
-} MPConvStackVal;
-
-/// Stack used to convert VimL values to messagepack.
-typedef kvec_t(MPConvStackVal) MPConvStack;
-
const char *const encode_special_var_names[] = {
[kSpecialVarNull] = "null",
[kSpecialVarTrue] = "true",
@@ -275,368 +254,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
: OK);
}
-/// Code for checking whether container references itself
-///
-/// @param[in,out] val Container to check.
-/// @param copyID_attr Name of the container attribute that holds copyID.
-/// After checking whether value of this attribute is
-/// copyID (variable) it is set to copyID.
-#define CHECK_SELF_REFERENCE(val, copyID_attr, conv_type) \
- do { \
- if ((val)->copyID_attr == copyID) { \
- CONV_RECURSE((val), conv_type); \
- } \
- (val)->copyID_attr = copyID; \
- } while (0)
-
-#define TV_STRLEN(tv) \
- (tv->vval.v_string == NULL ? 0 : STRLEN(tv->vval.v_string))
-
-/// Define functions which convert VimL value to something else
-///
-/// Creates function `vim_to_{name}(firstargtype firstargname, typval_T *const
-/// tv)` which returns OK or FAIL and helper functions.
-///
-/// @param firstargtype Type of the first argument. It will be used to return
-/// the results.
-/// @param firstargname Name of the first argument.
-/// @param name Name of the target converter.
-#define DEFINE_VIML_CONV_FUNCTIONS(scope, name, firstargtype, firstargname) \
-static int name##_convert_one_value(firstargtype firstargname, \
- MPConvStack *const mpstack, \
- typval_T *const tv, \
- const int copyID, \
- const char *const objname) \
- FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT \
-{ \
- switch (tv->v_type) { \
- case VAR_STRING: { \
- CONV_STRING(tv->vval.v_string, TV_STRLEN(tv)); \
- break; \
- } \
- case VAR_NUMBER: { \
- CONV_NUMBER(tv->vval.v_number); \
- break; \
- } \
- case VAR_FLOAT: { \
- CONV_FLOAT(tv->vval.v_float); \
- break; \
- } \
- case VAR_FUNC: { \
- CONV_FUNC(tv->vval.v_string); \
- break; \
- } \
- case VAR_LIST: { \
- if (tv->vval.v_list == NULL || tv->vval.v_list->lv_len == 0) { \
- CONV_EMPTY_LIST(); \
- break; \
- } \
- CHECK_SELF_REFERENCE(tv->vval.v_list, lv_copyID, kMPConvList); \
- CONV_LIST_START(tv->vval.v_list); \
- kv_push(MPConvStackVal, *mpstack, ((MPConvStackVal) { \
- .type = kMPConvList, \
- .data = { \
- .l = { \
- .list = tv->vval.v_list, \
- .li = tv->vval.v_list->lv_first, \
- }, \
- }, \
- })); \
- break; \
- } \
- case VAR_SPECIAL: { \
- switch (tv->vval.v_special) { \
- case kSpecialVarNull: { \
- CONV_NIL(); \
- break; \
- } \
- case kSpecialVarTrue: \
- case kSpecialVarFalse: { \
- CONV_BOOL(tv->vval.v_special == kSpecialVarTrue); \
- break; \
- } \
- } \
- break; \
- } \
- case VAR_DICT: { \
- if (tv->vval.v_dict == NULL \
- || tv->vval.v_dict->dv_hashtab.ht_used == 0) { \
- CONV_EMPTY_DICT(); \
- break; \
- } \
- const dictitem_T *type_di; \
- const dictitem_T *val_di; \
- if (CONV_ALLOW_SPECIAL \
- && tv->vval.v_dict->dv_hashtab.ht_used == 2 \
- && (type_di = dict_find((dict_T *) tv->vval.v_dict, \
- (char_u *) "_TYPE", -1)) != NULL \
- && type_di->di_tv.v_type == VAR_LIST \
- && (val_di = dict_find((dict_T *) tv->vval.v_dict, \
- (char_u *) "_VAL", -1)) != NULL) { \
- size_t i; \
- for (i = 0; i < ARRAY_SIZE(eval_msgpack_type_lists); i++) { \
- if (type_di->di_tv.vval.v_list == eval_msgpack_type_lists[i]) { \
- break; \
- } \
- } \
- if (i == ARRAY_SIZE(eval_msgpack_type_lists)) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- switch ((MessagePackType) i) { \
- case kMPNil: { \
- CONV_NIL(); \
- break; \
- } \
- case kMPBoolean: { \
- if (val_di->di_tv.v_type != VAR_NUMBER) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- CONV_BOOL(val_di->di_tv.vval.v_number); \
- break; \
- } \
- case kMPInteger: { \
- const list_T *val_list; \
- varnumber_T sign; \
- varnumber_T highest_bits; \
- varnumber_T high_bits; \
- varnumber_T low_bits; \
- /* List of 4 integers; first is signed (should be 1 or -1, but */ \
- /* this is not checked), second is unsigned and have at most */ \
- /* one (sign is -1) or two (sign is 1) non-zero bits (number of */ \
- /* bits is not checked), other unsigned and have at most 31 */ \
- /* non-zero bits (number of bits is not checked).*/ \
- if (val_di->di_tv.v_type != VAR_LIST \
- || (val_list = val_di->di_tv.vval.v_list) == NULL \
- || val_list->lv_len != 4 \
- || val_list->lv_first->li_tv.v_type != VAR_NUMBER \
- || (sign = val_list->lv_first->li_tv.vval.v_number) == 0 \
- || val_list->lv_first->li_next->li_tv.v_type != VAR_NUMBER \
- || (highest_bits = \
- val_list->lv_first->li_next->li_tv.vval.v_number) < 0 \
- || val_list->lv_last->li_prev->li_tv.v_type != VAR_NUMBER \
- || (high_bits = \
- val_list->lv_last->li_prev->li_tv.vval.v_number) < 0 \
- || val_list->lv_last->li_tv.v_type != VAR_NUMBER \
- || (low_bits = val_list->lv_last->li_tv.vval.v_number) < 0) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- uint64_t number = ((uint64_t) (((uint64_t) highest_bits) << 62) \
- | (uint64_t) (((uint64_t) high_bits) << 31) \
- | (uint64_t) low_bits); \
- if (sign > 0) { \
- CONV_UNSIGNED_NUMBER(number); \
- } else { \
- CONV_NUMBER(-number); \
- } \
- break; \
- } \
- case kMPFloat: { \
- if (val_di->di_tv.v_type != VAR_FLOAT) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- CONV_FLOAT(val_di->di_tv.vval.v_float); \
- break; \
- } \
- case kMPString: \
- case kMPBinary: { \
- const bool is_string = ((MessagePackType) i == kMPString); \
- if (val_di->di_tv.v_type != VAR_LIST) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- size_t len; \
- char *buf; \
- if (!encode_vim_list_to_buf(val_di->di_tv.vval.v_list, &len, \
- &buf)) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- if (is_string) { \
- CONV_STR_STRING(buf, len); \
- } else { \
- CONV_STRING(buf, len); \
- } \
- xfree(buf); \
- break; \
- } \
- case kMPArray: { \
- if (val_di->di_tv.v_type != VAR_LIST) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- CHECK_SELF_REFERENCE(val_di->di_tv.vval.v_list, lv_copyID, \
- kMPConvList); \
- CONV_LIST_START(val_di->di_tv.vval.v_list); \
- kv_push(MPConvStackVal, *mpstack, ((MPConvStackVal) { \
- .type = kMPConvList, \
- .data = { \
- .l = { \
- .list = val_di->di_tv.vval.v_list, \
- .li = val_di->di_tv.vval.v_list->lv_first, \
- }, \
- }, \
- })); \
- break; \
- } \
- case kMPMap: { \
- if (val_di->di_tv.v_type != VAR_LIST) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- list_T *const val_list = val_di->di_tv.vval.v_list; \
- if (val_list == NULL || val_list->lv_len == 0) { \
- CONV_EMPTY_DICT(); \
- break; \
- } \
- for (const listitem_T *li = val_list->lv_first; li != NULL; \
- li = li->li_next) { \
- if (li->li_tv.v_type != VAR_LIST \
- || li->li_tv.vval.v_list->lv_len != 2) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- } \
- CHECK_SELF_REFERENCE(val_list, lv_copyID, kMPConvPairs); \
- CONV_DICT_START(val_list->lv_len); \
- kv_push(MPConvStackVal, *mpstack, ((MPConvStackVal) { \
- .type = kMPConvPairs, \
- .data = { \
- .l = { \
- .list = val_list, \
- .li = val_list->lv_first, \
- }, \
- }, \
- })); \
- break; \
- } \
- case kMPExt: { \
- const list_T *val_list; \
- varnumber_T type; \
- if (val_di->di_tv.v_type != VAR_LIST \
- || (val_list = val_di->di_tv.vval.v_list) == NULL \
- || val_list->lv_len != 2 \
- || (val_list->lv_first->li_tv.v_type != VAR_NUMBER) \
- || (type = val_list->lv_first->li_tv.vval.v_number) > INT8_MAX \
- || type < INT8_MIN \
- || (val_list->lv_last->li_tv.v_type != VAR_LIST)) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- size_t len; \
- char *buf; \
- if (!encode_vim_list_to_buf(val_list->lv_last->li_tv.vval.v_list, \
- &len, &buf)) { \
- goto name##_convert_one_value_regular_dict; \
- } \
- CONV_EXT_STRING(buf, len, type); \
- xfree(buf); \
- break; \
- } \
- } \
- break; \
- } \
-name##_convert_one_value_regular_dict: \
- CHECK_SELF_REFERENCE(tv->vval.v_dict, dv_copyID, kMPConvDict); \
- CONV_DICT_START(tv->vval.v_dict->dv_hashtab.ht_used); \
- kv_push(MPConvStackVal, *mpstack, ((MPConvStackVal) { \
- .type = kMPConvDict, \
- .data = { \
- .d = { \
- .dict = tv->vval.v_dict, \
- .hi = tv->vval.v_dict->dv_hashtab.ht_array, \
- .todo = tv->vval.v_dict->dv_hashtab.ht_used, \
- }, \
- }, \
- })); \
- break; \
- } \
- case VAR_UNKNOWN: { \
- EMSG2(_(e_intern2), #name "_convert_one_value()"); \
- return FAIL; \
- } \
- } \
- return OK; \
-} \
-\
-scope int encode_vim_to_##name(firstargtype firstargname, typval_T *const tv, \
- const char *const objname) \
- FUNC_ATTR_WARN_UNUSED_RESULT \
-{ \
- const int copyID = get_copyID(); \
- MPConvStack mpstack; \
- kv_init(mpstack); \
- if (name##_convert_one_value(firstargname, &mpstack, tv, copyID, objname) \
- == FAIL) { \
- goto encode_vim_to_##name##_error_ret; \
- } \
- while (kv_size(mpstack)) { \
- MPConvStackVal *cur_mpsv = &kv_A(mpstack, kv_size(mpstack) - 1); \
- typval_T *cur_tv = NULL; \
- switch (cur_mpsv->type) { \
- case kMPConvDict: { \
- if (!cur_mpsv->data.d.todo) { \
- (void) kv_pop(mpstack); \
- cur_mpsv->data.d.dict->dv_copyID = copyID - 1; \
- CONV_DICT_END(); \
- continue; \
- } else if (cur_mpsv->data.d.todo \
- != cur_mpsv->data.d.dict->dv_hashtab.ht_used) { \
- CONV_DICT_BETWEEN_ITEMS(); \
- } \
- while (HASHITEM_EMPTY(cur_mpsv->data.d.hi)) { \
- cur_mpsv->data.d.hi++; \
- } \
- dictitem_T *const di = HI2DI(cur_mpsv->data.d.hi); \
- cur_mpsv->data.d.todo--; \
- cur_mpsv->data.d.hi++; \
- CONV_STR_STRING(&di->di_key[0], STRLEN(&di->di_key[0])); \
- CONV_DICT_AFTER_KEY(); \
- cur_tv = &di->di_tv; \
- break; \
- } \
- case kMPConvList: { \
- if (cur_mpsv->data.l.li == NULL) { \
- (void) kv_pop(mpstack); \
- cur_mpsv->data.l.list->lv_copyID = copyID - 1; \
- CONV_LIST_END(cur_mpsv->data.l.list); \
- continue; \
- } else if (cur_mpsv->data.l.li != cur_mpsv->data.l.list->lv_first) { \
- CONV_LIST_BETWEEN_ITEMS(); \
- } \
- cur_tv = &cur_mpsv->data.l.li->li_tv; \
- cur_mpsv->data.l.li = cur_mpsv->data.l.li->li_next; \
- break; \
- } \
- case kMPConvPairs: { \
- if (cur_mpsv->data.l.li == NULL) { \
- (void) kv_pop(mpstack); \
- cur_mpsv->data.l.list->lv_copyID = copyID - 1; \
- CONV_DICT_END(); \
- continue; \
- } else if (cur_mpsv->data.l.li != cur_mpsv->data.l.list->lv_first) { \
- CONV_DICT_BETWEEN_ITEMS(); \
- } \
- const list_T *const kv_pair = cur_mpsv->data.l.li->li_tv.vval.v_list; \
- CONV_SPECIAL_DICT_KEY_CHECK(name, kv_pair); \
- if (name##_convert_one_value(firstargname, &mpstack, \
- &kv_pair->lv_first->li_tv, copyID, \
- objname) == FAIL) { \
- goto encode_vim_to_##name##_error_ret; \
- } \
- CONV_DICT_AFTER_KEY(); \
- cur_tv = &kv_pair->lv_last->li_tv; \
- cur_mpsv->data.l.li = cur_mpsv->data.l.li->li_next; \
- break; \
- } \
- } \
- assert(cur_tv != NULL); \
- if (name##_convert_one_value(firstargname, &mpstack, cur_tv, copyID, \
- objname) == FAIL) { \
- goto encode_vim_to_##name##_error_ret; \
- } \
- } \
- kv_destroy(mpstack); \
- return OK; \
-encode_vim_to_##name##_error_ret: \
- kv_destroy(mpstack); \
- return FAIL; \
-}
-
-#define CONV_STRING(buf, len) \
+#define TYPVAL_ENCODE_CONV_STRING(buf, len) \
do { \
const char *const buf_ = (const char *) buf; \
if (buf == NULL) { \
@@ -655,19 +273,19 @@ encode_vim_to_##name##_error_ret: \
} \
} while (0)
-#define CONV_STR_STRING(buf, len) \
- CONV_STRING(buf, len)
+#define TYPVAL_ENCODE_CONV_STR_STRING(buf, len) \
+ TYPVAL_ENCODE_CONV_STRING(buf, len)
-#define CONV_EXT_STRING(buf, len, type)
+#define TYPVAL_ENCODE_CONV_EXT_STRING(buf, len, type)
-#define CONV_NUMBER(num) \
+#define TYPVAL_ENCODE_CONV_NUMBER(num) \
do { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%" PRId64, (int64_t) (num)); \
ga_concat(gap, numbuf); \
} while (0)
-#define CONV_FLOAT(flt) \
+#define TYPVAL_ENCODE_CONV_FLOAT(flt) \
do { \
const float_T flt_ = (flt); \
switch (fpclassify(flt_)) { \
@@ -690,51 +308,51 @@ encode_vim_to_##name##_error_ret: \
} \
} while (0)
-#define CONV_FUNC(fun) \
+#define TYPVAL_ENCODE_CONV_FUNC(fun) \
do { \
ga_concat(gap, "function("); \
- CONV_STRING(fun, STRLEN(fun)); \
+ TYPVAL_ENCODE_CONV_STRING(fun, STRLEN(fun)); \
ga_append(gap, ')'); \
} while (0)
-#define CONV_EMPTY_LIST() \
+#define TYPVAL_ENCODE_CONV_EMPTY_LIST() \
ga_concat(gap, "[]")
-#define CONV_LIST_START(lst) \
+#define TYPVAL_ENCODE_CONV_LIST_START(len) \
ga_append(gap, '[')
-#define CONV_EMPTY_DICT() \
+#define TYPVAL_ENCODE_CONV_EMPTY_DICT() \
ga_concat(gap, "{}")
-#define CONV_NIL() \
+#define TYPVAL_ENCODE_CONV_NIL() \
ga_concat(gap, "v:null")
-#define CONV_BOOL(num) \
+#define TYPVAL_ENCODE_CONV_BOOL(num) \
ga_concat(gap, ((num)? "v:true": "v:false"))
-#define CONV_UNSIGNED_NUMBER(num)
+#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(num)
-#define CONV_DICT_START(len) \
+#define TYPVAL_ENCODE_CONV_DICT_START(len) \
ga_append(gap, '{')
-#define CONV_DICT_END() \
+#define TYPVAL_ENCODE_CONV_DICT_END() \
ga_append(gap, '}')
-#define CONV_DICT_AFTER_KEY() \
+#define TYPVAL_ENCODE_CONV_DICT_AFTER_KEY() \
ga_concat(gap, ": ")
-#define CONV_DICT_BETWEEN_ITEMS() \
+#define TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS() \
ga_concat(gap, ", ")
-#define CONV_SPECIAL_DICT_KEY_CHECK(name, kv_pair)
+#define TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK(label, kv_pair)
-#define CONV_LIST_END(lst) \
+#define TYPVAL_ENCODE_CONV_LIST_END() \
ga_append(gap, ']')
-#define CONV_LIST_BETWEEN_ITEMS() \
- CONV_DICT_BETWEEN_ITEMS()
+#define TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS() \
+ TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS()
-#define CONV_RECURSE(val, conv_type) \
+#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
do { \
if (!did_echo_string_emsg) { \
/* Only give this message once for a recursive call to avoid */ \
@@ -764,12 +382,12 @@ encode_vim_to_##name##_error_ret: \
return OK; \
} while (0)
-#define CONV_ALLOW_SPECIAL false
+#define TYPVAL_ENCODE_ALLOW_SPECIALS false
-DEFINE_VIML_CONV_FUNCTIONS(static, string, garray_T *const, gap)
+TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, string, garray_T *const, gap)
-#undef CONV_RECURSE
-#define CONV_RECURSE(val, conv_type) \
+#undef TYPVAL_ENCODE_CONV_RECURSE
+#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
do { \
char ebuf[NUMBUFLEN + 7]; \
size_t backref = 0; \
@@ -796,10 +414,10 @@ DEFINE_VIML_CONV_FUNCTIONS(static, string, garray_T *const, gap)
return OK; \
} while (0)
-DEFINE_VIML_CONV_FUNCTIONS(, echo, garray_T *const, gap)
+TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, echo, garray_T *const, gap)
-#undef CONV_RECURSE
-#define CONV_RECURSE(val, conv_type) \
+#undef TYPVAL_ENCODE_CONV_RECURSE
+#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
do { \
if (!did_echo_string_emsg) { \
/* Only give this message once for a recursive call to avoid */ \
@@ -811,27 +429,27 @@ DEFINE_VIML_CONV_FUNCTIONS(, echo, garray_T *const, gap)
return OK; \
} while (0)
-#undef CONV_ALLOW_SPECIAL
-#define CONV_ALLOW_SPECIAL true
+#undef TYPVAL_ENCODE_ALLOW_SPECIALS
+#define TYPVAL_ENCODE_ALLOW_SPECIALS true
-#undef CONV_NIL
-#define CONV_NIL() \
+#undef TYPVAL_ENCODE_CONV_NIL
+#define TYPVAL_ENCODE_CONV_NIL() \
ga_concat(gap, "null")
-#undef CONV_BOOL
-#define CONV_BOOL(num) \
+#undef TYPVAL_ENCODE_CONV_BOOL
+#define TYPVAL_ENCODE_CONV_BOOL(num) \
ga_concat(gap, ((num)? "true": "false"))
-#undef CONV_UNSIGNED_NUMBER
-#define CONV_UNSIGNED_NUMBER(num) \
+#undef TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
+#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(num) \
do { \
char numbuf[NUMBUFLEN]; \
vim_snprintf(numbuf, ARRAY_SIZE(numbuf), "%" PRIu64, (num)); \
ga_concat(gap, numbuf); \
} while (0)
-#undef CONV_FLOAT
-#define CONV_FLOAT(flt) \
+#undef TYPVAL_ENCODE_CONV_FLOAT
+#define TYPVAL_ENCODE_CONV_FLOAT(flt) \
do { \
const float_T flt_ = (flt); \
switch (fpclassify(flt_)) { \
@@ -1019,24 +637,24 @@ static inline int convert_to_json_string(garray_T *const gap,
return OK;
}
-#undef CONV_STRING
-#define CONV_STRING(buf, len) \
+#undef TYPVAL_ENCODE_CONV_STRING
+#define TYPVAL_ENCODE_CONV_STRING(buf, len) \
do { \
if (convert_to_json_string(gap, (const char *) (buf), (len)) != OK) { \
return FAIL; \
} \
} while (0)
-#undef CONV_EXT_STRING
-#define CONV_EXT_STRING(buf, len, type) \
+#undef TYPVAL_ENCODE_CONV_EXT_STRING
+#define TYPVAL_ENCODE_CONV_EXT_STRING(buf, len, type) \
do { \
xfree(buf); \
EMSG(_("E474: Unable to convert EXT string to JSON")); \
return FAIL; \
} while (0)
-#undef CONV_FUNC
-#define CONV_FUNC(fun) \
+#undef TYPVAL_ENCODE_CONV_FUNC
+#define TYPVAL_ENCODE_CONV_FUNC(fun) \
return conv_error(_("E474: Error while dumping %s, %s: " \
"attempt to dump function reference"), \
mpstack, objname)
@@ -1080,38 +698,38 @@ static inline bool check_json_key(const typval_T *const tv)
return true;
}
-#undef CONV_SPECIAL_DICT_KEY_CHECK
-#define CONV_SPECIAL_DICT_KEY_CHECK(name, kv_pair) \
+#undef TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK
+#define TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK(label, kv_pair) \
do { \
if (!check_json_key(&kv_pair->lv_first->li_tv)) { \
EMSG(_("E474: Invalid key in special dictionary")); \
- goto encode_vim_to_##name##_error_ret; \
+ goto label; \
} \
} while (0)
-DEFINE_VIML_CONV_FUNCTIONS(static, json, garray_T *const, gap)
-
-#undef CONV_STRING
-#undef CONV_STR_STRING
-#undef CONV_EXT_STRING
-#undef CONV_NUMBER
-#undef CONV_FLOAT
-#undef CONV_FUNC
-#undef CONV_EMPTY_LIST
-#undef CONV_LIST_START
-#undef CONV_EMPTY_DICT
-#undef CONV_NIL
-#undef CONV_BOOL
-#undef CONV_UNSIGNED_NUMBER
-#undef CONV_DICT_START
-#undef CONV_DICT_END
-#undef CONV_DICT_AFTER_KEY
-#undef CONV_DICT_BETWEEN_ITEMS
-#undef CONV_SPECIAL_DICT_KEY_CHECK
-#undef CONV_LIST_END
-#undef CONV_LIST_BETWEEN_ITEMS
-#undef CONV_RECURSE
-#undef CONV_ALLOW_SPECIAL
+TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, json, garray_T *const, gap)
+
+#undef TYPVAL_ENCODE_CONV_STRING
+#undef TYPVAL_ENCODE_CONV_STR_STRING
+#undef TYPVAL_ENCODE_CONV_EXT_STRING
+#undef TYPVAL_ENCODE_CONV_NUMBER
+#undef TYPVAL_ENCODE_CONV_FLOAT
+#undef TYPVAL_ENCODE_CONV_FUNC
+#undef TYPVAL_ENCODE_CONV_EMPTY_LIST
+#undef TYPVAL_ENCODE_CONV_LIST_START
+#undef TYPVAL_ENCODE_CONV_EMPTY_DICT
+#undef TYPVAL_ENCODE_CONV_NIL
+#undef TYPVAL_ENCODE_CONV_BOOL
+#undef TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
+#undef TYPVAL_ENCODE_CONV_DICT_START
+#undef TYPVAL_ENCODE_CONV_DICT_END
+#undef TYPVAL_ENCODE_CONV_DICT_AFTER_KEY
+#undef TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS
+#undef TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK
+#undef TYPVAL_ENCODE_CONV_LIST_END
+#undef TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS
+#undef TYPVAL_ENCODE_CONV_RECURSE
+#undef TYPVAL_ENCODE_ALLOW_SPECIALS
/// Return a string with the string representation of a variable.
/// Puts quotes around strings, so that they can be parsed back by eval().
@@ -1181,7 +799,7 @@ char *encode_tv2json(typval_T *tv, size_t *len)
return (char *) ga.ga_data;
}
-#define CONV_STRING(buf, len) \
+#define TYPVAL_ENCODE_CONV_STRING(buf, len) \
do { \
if (buf == NULL) { \
msgpack_pack_bin(packer, 0); \
@@ -1192,7 +810,7 @@ char *encode_tv2json(typval_T *tv, size_t *len)
} \
} while (0)
-#define CONV_STR_STRING(buf, len) \
+#define TYPVAL_ENCODE_CONV_STR_STRING(buf, len) \
do { \
if (buf == NULL) { \
msgpack_pack_str(packer, 0); \
@@ -1203,7 +821,7 @@ char *encode_tv2json(typval_T *tv, size_t *len)
} \
} while (0)
-#define CONV_EXT_STRING(buf, len, type) \
+#define TYPVAL_ENCODE_CONV_EXT_STRING(buf, len, type) \
do { \
if (buf == NULL) { \
msgpack_pack_ext(packer, 0, (int8_t) type); \
@@ -1214,30 +832,30 @@ char *encode_tv2json(typval_T *tv, size_t *len)
} \
} while (0)
-#define CONV_NUMBER(num) \
+#define TYPVAL_ENCODE_CONV_NUMBER(num) \
msgpack_pack_int64(packer, (int64_t) (num))
-#define CONV_FLOAT(flt) \
+#define TYPVAL_ENCODE_CONV_FLOAT(flt) \
msgpack_pack_double(packer, (double) (flt))
-#define CONV_FUNC(fun) \
+#define TYPVAL_ENCODE_CONV_FUNC(fun) \
return conv_error(_("E951: Error while dumping %s, %s: " \
"attempt to dump function reference"), \
mpstack, objname)
-#define CONV_EMPTY_LIST() \
+#define TYPVAL_ENCODE_CONV_EMPTY_LIST() \
msgpack_pack_array(packer, 0)
-#define CONV_LIST_START(lst) \
- msgpack_pack_array(packer, (size_t) (lst)->lv_len)
+#define TYPVAL_ENCODE_CONV_LIST_START(len) \
+ msgpack_pack_array(packer, (size_t) (len))
-#define CONV_EMPTY_DICT() \
+#define TYPVAL_ENCODE_CONV_EMPTY_DICT() \
msgpack_pack_map(packer, 0)
-#define CONV_NIL() \
+#define TYPVAL_ENCODE_CONV_NIL() \
msgpack_pack_nil(packer)
-#define CONV_BOOL(num) \
+#define TYPVAL_ENCODE_CONV_BOOL(num) \
do { \
if ((num)) { \
msgpack_pack_true(packer); \
@@ -1246,51 +864,51 @@ char *encode_tv2json(typval_T *tv, size_t *len)
} \
} while (0)
-#define CONV_UNSIGNED_NUMBER(num) \
+#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(num) \
msgpack_pack_uint64(packer, (num))
-#define CONV_DICT_START(len) \
+#define TYPVAL_ENCODE_CONV_DICT_START(len) \
msgpack_pack_map(packer, (size_t) (len))
-#define CONV_DICT_END()
+#define TYPVAL_ENCODE_CONV_DICT_END()
-#define CONV_DICT_AFTER_KEY()
+#define TYPVAL_ENCODE_CONV_DICT_AFTER_KEY()
-#define CONV_DICT_BETWEEN_ITEMS()
+#define TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS()
-#define CONV_SPECIAL_DICT_KEY_CHECK(name, kv_pair)
+#define TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK(label, kv_pair)
-#define CONV_LIST_END(lst)
+#define TYPVAL_ENCODE_CONV_LIST_END()
-#define CONV_LIST_BETWEEN_ITEMS()
+#define TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS()
-#define CONV_RECURSE(val, conv_type) \
+#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
return conv_error(_("E952: Unable to dump %s: " \
"container references itself in %s"), \
mpstack, objname)
-#define CONV_ALLOW_SPECIAL true
-
-DEFINE_VIML_CONV_FUNCTIONS(, msgpack, msgpack_packer *const, packer)
-
-#undef CONV_STRING
-#undef CONV_STR_STRING
-#undef CONV_EXT_STRING
-#undef CONV_NUMBER
-#undef CONV_FLOAT
-#undef CONV_FUNC
-#undef CONV_EMPTY_LIST
-#undef CONV_LIST_START
-#undef CONV_EMPTY_DICT
-#undef CONV_NIL
-#undef CONV_BOOL
-#undef CONV_UNSIGNED_NUMBER
-#undef CONV_DICT_START
-#undef CONV_DICT_END
-#undef CONV_DICT_AFTER_KEY
-#undef CONV_DICT_BETWEEN_ITEMS
-#undef CONV_SPECIAL_DICT_KEY_CHECK
-#undef CONV_LIST_END
-#undef CONV_LIST_BETWEEN_ITEMS
-#undef CONV_RECURSE
-#undef CONV_ALLOW_SPECIAL
+#define TYPVAL_ENCODE_ALLOW_SPECIALS true
+
+TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, msgpack, msgpack_packer *const, packer)
+
+#undef TYPVAL_ENCODE_CONV_STRING
+#undef TYPVAL_ENCODE_CONV_STR_STRING
+#undef TYPVAL_ENCODE_CONV_EXT_STRING
+#undef TYPVAL_ENCODE_CONV_NUMBER
+#undef TYPVAL_ENCODE_CONV_FLOAT
+#undef TYPVAL_ENCODE_CONV_FUNC
+#undef TYPVAL_ENCODE_CONV_EMPTY_LIST
+#undef TYPVAL_ENCODE_CONV_LIST_START
+#undef TYPVAL_ENCODE_CONV_EMPTY_DICT
+#undef TYPVAL_ENCODE_CONV_NIL
+#undef TYPVAL_ENCODE_CONV_BOOL
+#undef TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
+#undef TYPVAL_ENCODE_CONV_DICT_START
+#undef TYPVAL_ENCODE_CONV_DICT_END
+#undef TYPVAL_ENCODE_CONV_DICT_AFTER_KEY
+#undef TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS
+#undef TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK
+#undef TYPVAL_ENCODE_CONV_LIST_END
+#undef TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS
+#undef TYPVAL_ENCODE_CONV_RECURSE
+#undef TYPVAL_ENCODE_ALLOW_SPECIALS
diff --git a/src/nvim/eval/typval_encode.h b/src/nvim/eval/typval_encode.h
new file mode 100644
index 0000000000..f70a6c9e94
--- /dev/null
+++ b/src/nvim/eval/typval_encode.h
@@ -0,0 +1,563 @@
+/// @file eval/typval_convert.h
+///
+/// Contains set of macros used to convert (possibly recursive) typval_T into
+/// something else. For these macros to work the following macros must be
+/// defined:
+
+/// @def TYPVAL_ENCODE_CONV_NIL
+/// @brief Macros used to convert NIL value
+///
+/// Is called both for special dictionary (unless #TYPVAL_ENCODE_ALLOW_SPECIALS
+/// is false) and `v:null`. Accepts no arguments, but still must be
+/// a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_BOOL
+/// @brief Macros used to convert boolean value
+///
+/// Is called both for special dictionary (unless #TYPVAL_ENCODE_ALLOW_SPECIALS
+/// is false) and `v:true`/`v:false`.
+///
+/// @param num Boolean value to convert. Value is an expression which
+/// evaluates to some integer.
+
+/// @def TYPVAL_ENCODE_CONV_NUMBER
+/// @brief Macros used to convert integer
+///
+/// @param num Integer to convert, must accept both varnumber_T and int64_t.
+
+/// @def TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
+/// @brief Macros used to convert unsigned integer
+///
+/// Not used if #TYPVAL_ENCODE_ALLOW_SPECIALS is false, but still must be
+/// defined.
+///
+/// @param num Integer to convert, must accept uint64_t.
+
+/// @def TYPVAL_ENCODE_CONV_FLOAT
+/// @brief Macros used to convert floating-point number
+///
+/// @param flt Number to convert, must accept float_T.
+
+/// @def TYPVAL_ENCODE_CONV_STRING
+/// @brief Macros used to convert plain string
+///
+/// Is used to convert VAR_STRING objects as well as BIN strings represented as
+/// special dictionary.
+///
+/// @param buf String to convert. Is a char[] buffer, not NUL-terminated.
+/// @param len String length.
+
+/// @def TYPVAL_ENCODE_CONV_STR_STRING
+/// @brief Like #TYPVAL_ENCODE_CONV_STRING, but for STR strings
+///
+/// Is used to convert dictionary keys and STR strings represented as special
+/// dictionaries.
+
+/// @def TYPVAL_ENCODE_CONV_EXT_STRING
+/// @brief Macros used to convert EXT string
+///
+/// Is used to convert EXT strings represented as special dictionaries. Never
+/// actually used if #TYPVAL_ENCODE_ALLOW_SPECIALS is false, but still must be
+/// defined.
+///
+/// @param buf String to convert. Is a char[] buffer, not NUL-terminated.
+/// @param len String length.
+/// @param type EXT type.
+
+/// @def TYPVAL_ENCODE_CONV_FUNC
+/// @brief Macros used to convert a function reference
+///
+/// @param fun Function name.
+
+/// @def TYPVAL_ENCODE_CONV_EMPTY_LIST
+/// @brief Macros used to convert an empty list
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_EMPTY_DICT
+/// @brief Macros used to convert an empty dictionary
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_LIST_START
+/// @brief Macros used before starting to convert non-empty list
+///
+/// @param len List length. Is an expression which evaluates to an integer.
+
+/// @def TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS
+/// @brief Macros used after finishing converting non-last list item
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_LIST_END
+/// @brief Macros used after converting non-empty list
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_DICT_START
+/// @brief Macros used before starting to convert non-empty dictionary
+///
+/// @param len Dictionary length. Is an expression which evaluates to an
+/// integer.
+
+/// @def TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK
+/// @brief Macros used to check special dictionary key
+///
+/// @param label Label for goto in case check was not successfull.
+/// @param kv_pair List with two elements: key and value.
+
+/// @def TYPVAL_ENCODE_CONV_DICT_AFTER_KEY
+/// @brief Macros used after finishing converting dictionary key
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS
+/// @brief Macros used after finishing converting non-last dictionary value
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_DICT_END
+/// @brief Macros used after converting non-empty dictionary
+///
+/// Accepts no arguments, but still must be a function-like macros.
+
+/// @def TYPVAL_ENCODE_CONV_RECURSE
+/// @brief Macros used when self-containing container is detected
+///
+/// @param val Container for which this situation was detected.
+/// @param conv_type Type of the stack entry, @see MPConvStackValType.
+
+/// @def TYPVAL_ENCODE_ALLOW_SPECIALS
+/// @brief Macros that specifies whether special dictionaries are special
+///
+/// Must be something that evaluates to boolean, most likely `true` or `false`.
+/// If it is false then special dictionaries are not treated specially.
+#ifndef NVIM_EVAL_TYPVAL_ENCODE_H
+#define NVIM_EVAL_TYPVAL_ENCODE_H
+
+#include <stddef.h>
+#include <inttypes.h>
+#include <assert.h>
+
+#include "nvim/lib/kvec.h"
+#include "nvim/eval_defs.h"
+#include "nvim/eval/encode.h"
+#include "nvim/func_attr.h"
+
+/// Type of the stack entry
+typedef enum {
+ kMPConvDict, ///< Convert dict_T *dictionary.
+ kMPConvList, ///< Convert list_T *list.
+ kMPConvPairs, ///< Convert mapping represented as a list_T* of pairs.
+} MPConvStackValType;
+
+/// Structure representing current VimL to messagepack conversion state
+typedef struct {
+ MPConvStackValType type; ///< Type of the stack entry.
+ union {
+ struct {
+ dict_T *dict; ///< Currently converted dictionary.
+ hashitem_T *hi; ///< Currently converted dictionary item.
+ size_t todo; ///< Amount of items left to process.
+ } d; ///< State of dictionary conversion.
+ struct {
+ list_T *list; ///< Currently converted list.
+ listitem_T *li; ///< Currently converted list item.
+ } l; ///< State of list or generic mapping conversion.
+ } data; ///< Data to convert.
+} MPConvStackVal;
+
+/// Stack used to convert VimL values to messagepack.
+typedef kvec_t(MPConvStackVal) MPConvStack;
+
+// Defines for MPConvStack
+#define _mp_size kv_size
+#define _mp_init kv_init
+#define _mp_destroy kv_destroy
+#define _mp_push kv_push
+#define _mp_pop kv_pop
+#define _mp_last kv_last
+
+/// Code for checking whether container references itself
+///
+/// @param[in,out] val Container to check.
+/// @param copyID_attr Name of the container attribute that holds copyID.
+/// After checking whether value of this attribute is
+/// copyID (variable) it is set to copyID.
+#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(val, copyID_attr, conv_type) \
+ do { \
+ if ((val)->copyID_attr == copyID) { \
+ TYPVAL_ENCODE_CONV_RECURSE((val), conv_type); \
+ } \
+ (val)->copyID_attr = copyID; \
+ } while (0)
+
+/// Length of the string stored in typval_T
+///
+/// @param[in] tv String for which to compute length for. Must be typval_T
+/// with VAR_STRING.
+///
+/// @return Length of the string stored in typval_T, including 0 for NULL
+/// string.
+static inline size_t tv_strlen(const typval_T *const tv)
+ FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+ FUNC_ATTR_NONNULL_ALL
+{
+ assert(tv->v_type == VAR_STRING);
+ return (tv->vval.v_string == NULL
+ ? 0
+ : strlen((char *) tv->vval.v_string));
+}
+
+/// Define functions which convert VimL value to something else
+///
+/// Creates function `vim_to_{name}(firstargtype firstargname, typval_T *const
+/// tv)` which returns OK or FAIL and helper functions.
+///
+/// @param scope Scope of the main function: either nothing or `static`.
+/// @param firstargtype Type of the first argument. It will be used to return
+/// the results.
+/// @param firstargname Name of the first argument.
+/// @param name Name of the target converter.
+#define TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(scope, name, firstargtype, \
+ firstargname) \
+static int name##_convert_one_value(firstargtype firstargname, \
+ MPConvStack *const mpstack, \
+ typval_T *const tv, \
+ const int copyID, \
+ const char *const objname) \
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT \
+{ \
+ switch (tv->v_type) { \
+ case VAR_STRING: { \
+ TYPVAL_ENCODE_CONV_STRING(tv->vval.v_string, tv_strlen(tv)); \
+ break; \
+ } \
+ case VAR_NUMBER: { \
+ TYPVAL_ENCODE_CONV_NUMBER(tv->vval.v_number); \
+ break; \
+ } \
+ case VAR_FLOAT: { \
+ TYPVAL_ENCODE_CONV_FLOAT(tv->vval.v_float); \
+ break; \
+ } \
+ case VAR_FUNC: { \
+ TYPVAL_ENCODE_CONV_FUNC(tv->vval.v_string); \
+ break; \
+ } \
+ case VAR_LIST: { \
+ if (tv->vval.v_list == NULL || tv->vval.v_list->lv_len == 0) { \
+ TYPVAL_ENCODE_CONV_EMPTY_LIST(); \
+ break; \
+ } \
+ _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(tv->vval.v_list, lv_copyID, \
+ kMPConvList); \
+ TYPVAL_ENCODE_CONV_LIST_START(tv->vval.v_list->lv_len); \
+ _mp_push(*mpstack, ((MPConvStackVal) { \
+ .type = kMPConvList, \
+ .data = { \
+ .l = { \
+ .list = tv->vval.v_list, \
+ .li = tv->vval.v_list->lv_first, \
+ }, \
+ }, \
+ })); \
+ break; \
+ } \
+ case VAR_SPECIAL: { \
+ switch (tv->vval.v_special) { \
+ case kSpecialVarNull: { \
+ TYPVAL_ENCODE_CONV_NIL(); \
+ break; \
+ } \
+ case kSpecialVarTrue: \
+ case kSpecialVarFalse: { \
+ TYPVAL_ENCODE_CONV_BOOL(tv->vval.v_special == kSpecialVarTrue); \
+ break; \
+ } \
+ } \
+ break; \
+ } \
+ case VAR_DICT: { \
+ if (tv->vval.v_dict == NULL \
+ || tv->vval.v_dict->dv_hashtab.ht_used == 0) { \
+ TYPVAL_ENCODE_CONV_EMPTY_DICT(); \
+ break; \
+ } \
+ const dictitem_T *type_di; \
+ const dictitem_T *val_di; \
+ if (TYPVAL_ENCODE_ALLOW_SPECIALS \
+ && tv->vval.v_dict->dv_hashtab.ht_used == 2 \
+ && (type_di = dict_find((dict_T *) tv->vval.v_dict, \
+ (char_u *) "_TYPE", -1)) != NULL \
+ && type_di->di_tv.v_type == VAR_LIST \
+ && (val_di = dict_find((dict_T *) tv->vval.v_dict, \
+ (char_u *) "_VAL", -1)) != NULL) { \
+ size_t i; \
+ for (i = 0; i < ARRAY_SIZE(eval_msgpack_type_lists); i++) { \
+ if (type_di->di_tv.vval.v_list == eval_msgpack_type_lists[i]) { \
+ break; \
+ } \
+ } \
+ if (i == ARRAY_SIZE(eval_msgpack_type_lists)) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ switch ((MessagePackType) i) { \
+ case kMPNil: { \
+ TYPVAL_ENCODE_CONV_NIL(); \
+ break; \
+ } \
+ case kMPBoolean: { \
+ if (val_di->di_tv.v_type != VAR_NUMBER) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ TYPVAL_ENCODE_CONV_BOOL(val_di->di_tv.vval.v_number); \
+ break; \
+ } \
+ case kMPInteger: { \
+ const list_T *val_list; \
+ varnumber_T sign; \
+ varnumber_T highest_bits; \
+ varnumber_T high_bits; \
+ varnumber_T low_bits; \
+ /* List of 4 integers; first is signed (should be 1 or -1, but */ \
+ /* this is not checked), second is unsigned and have at most */ \
+ /* one (sign is -1) or two (sign is 1) non-zero bits (number of */ \
+ /* bits is not checked), other unsigned and have at most 31 */ \
+ /* non-zero bits (number of bits is not checked).*/ \
+ if (val_di->di_tv.v_type != VAR_LIST \
+ || (val_list = val_di->di_tv.vval.v_list) == NULL \
+ || val_list->lv_len != 4 \
+ || val_list->lv_first->li_tv.v_type != VAR_NUMBER \
+ || (sign = val_list->lv_first->li_tv.vval.v_number) == 0 \
+ || val_list->lv_first->li_next->li_tv.v_type != VAR_NUMBER \
+ || (highest_bits = \
+ val_list->lv_first->li_next->li_tv.vval.v_number) < 0 \
+ || val_list->lv_last->li_prev->li_tv.v_type != VAR_NUMBER \
+ || (high_bits = \
+ val_list->lv_last->li_prev->li_tv.vval.v_number) < 0 \
+ || val_list->lv_last->li_tv.v_type != VAR_NUMBER \
+ || (low_bits = val_list->lv_last->li_tv.vval.v_number) < 0) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ uint64_t number = ((uint64_t) (((uint64_t) highest_bits) << 62) \
+ | (uint64_t) (((uint64_t) high_bits) << 31) \
+ | (uint64_t) low_bits); \
+ if (sign > 0) { \
+ TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER(number); \
+ } else { \
+ TYPVAL_ENCODE_CONV_NUMBER(-number); \
+ } \
+ break; \
+ } \
+ case kMPFloat: { \
+ if (val_di->di_tv.v_type != VAR_FLOAT) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ TYPVAL_ENCODE_CONV_FLOAT(val_di->di_tv.vval.v_float); \
+ break; \
+ } \
+ case kMPString: \
+ case kMPBinary: { \
+ const bool is_string = ((MessagePackType) i == kMPString); \
+ if (val_di->di_tv.v_type != VAR_LIST) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ size_t len; \
+ char *buf; \
+ if (!encode_vim_list_to_buf(val_di->di_tv.vval.v_list, &len, \
+ &buf)) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ if (is_string) { \
+ TYPVAL_ENCODE_CONV_STR_STRING(buf, len); \
+ } else { \
+ TYPVAL_ENCODE_CONV_STRING(buf, len); \
+ } \
+ xfree(buf); \
+ break; \
+ } \
+ case kMPArray: { \
+ if (val_di->di_tv.v_type != VAR_LIST) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(val_di->di_tv.vval.v_list, \
+ lv_copyID, kMPConvList); \
+ TYPVAL_ENCODE_CONV_LIST_START(val_di->di_tv.vval.v_list->lv_len); \
+ _mp_push(*mpstack, ((MPConvStackVal) { \
+ .type = kMPConvList, \
+ .data = { \
+ .l = { \
+ .list = val_di->di_tv.vval.v_list, \
+ .li = val_di->di_tv.vval.v_list->lv_first, \
+ }, \
+ }, \
+ })); \
+ break; \
+ } \
+ case kMPMap: { \
+ if (val_di->di_tv.v_type != VAR_LIST) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ list_T *const val_list = val_di->di_tv.vval.v_list; \
+ if (val_list == NULL || val_list->lv_len == 0) { \
+ TYPVAL_ENCODE_CONV_EMPTY_DICT(); \
+ break; \
+ } \
+ for (const listitem_T *li = val_list->lv_first; li != NULL; \
+ li = li->li_next) { \
+ if (li->li_tv.v_type != VAR_LIST \
+ || li->li_tv.vval.v_list->lv_len != 2) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ } \
+ _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(val_list, lv_copyID, \
+ kMPConvPairs); \
+ TYPVAL_ENCODE_CONV_DICT_START(val_list->lv_len); \
+ _mp_push(*mpstack, ((MPConvStackVal) { \
+ .type = kMPConvPairs, \
+ .data = { \
+ .l = { \
+ .list = val_list, \
+ .li = val_list->lv_first, \
+ }, \
+ }, \
+ })); \
+ break; \
+ } \
+ case kMPExt: { \
+ const list_T *val_list; \
+ varnumber_T type; \
+ if (val_di->di_tv.v_type != VAR_LIST \
+ || (val_list = val_di->di_tv.vval.v_list) == NULL \
+ || val_list->lv_len != 2 \
+ || (val_list->lv_first->li_tv.v_type != VAR_NUMBER) \
+ || (type = val_list->lv_first->li_tv.vval.v_number) > INT8_MAX \
+ || type < INT8_MIN \
+ || (val_list->lv_last->li_tv.v_type != VAR_LIST)) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ size_t len; \
+ char *buf; \
+ if (!encode_vim_list_to_buf(val_list->lv_last->li_tv.vval.v_list, \
+ &len, &buf)) { \
+ goto name##_convert_one_value_regular_dict; \
+ } \
+ TYPVAL_ENCODE_CONV_EXT_STRING(buf, len, type); \
+ xfree(buf); \
+ break; \
+ } \
+ } \
+ break; \
+ } \
+name##_convert_one_value_regular_dict: \
+ _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(tv->vval.v_dict, dv_copyID, \
+ kMPConvDict); \
+ TYPVAL_ENCODE_CONV_DICT_START(tv->vval.v_dict->dv_hashtab.ht_used); \
+ _mp_push(*mpstack, ((MPConvStackVal) { \
+ .type = kMPConvDict, \
+ .data = { \
+ .d = { \
+ .dict = tv->vval.v_dict, \
+ .hi = tv->vval.v_dict->dv_hashtab.ht_array, \
+ .todo = tv->vval.v_dict->dv_hashtab.ht_used, \
+ }, \
+ }, \
+ })); \
+ break; \
+ } \
+ case VAR_UNKNOWN: { \
+ EMSG2(_(e_intern2), #name "_convert_one_value()"); \
+ return FAIL; \
+ } \
+ } \
+ return OK; \
+} \
+\
+scope int encode_vim_to_##name(firstargtype firstargname, typval_T *const tv, \
+ const char *const objname) \
+ FUNC_ATTR_WARN_UNUSED_RESULT \
+{ \
+ const int copyID = get_copyID(); \
+ MPConvStack mpstack; \
+ _mp_init(mpstack); \
+ if (name##_convert_one_value(firstargname, &mpstack, tv, copyID, objname) \
+ == FAIL) { \
+ goto encode_vim_to_##name##_error_ret; \
+ } \
+ while (_mp_size(mpstack)) { \
+ MPConvStackVal *cur_mpsv = &_mp_last(mpstack); \
+ typval_T *cur_tv = NULL; \
+ switch (cur_mpsv->type) { \
+ case kMPConvDict: { \
+ if (!cur_mpsv->data.d.todo) { \
+ (void) _mp_pop(mpstack); \
+ cur_mpsv->data.d.dict->dv_copyID = copyID - 1; \
+ TYPVAL_ENCODE_CONV_DICT_END(); \
+ continue; \
+ } else if (cur_mpsv->data.d.todo \
+ != cur_mpsv->data.d.dict->dv_hashtab.ht_used) { \
+ TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS(); \
+ } \
+ while (HASHITEM_EMPTY(cur_mpsv->data.d.hi)) { \
+ cur_mpsv->data.d.hi++; \
+ } \
+ dictitem_T *const di = HI2DI(cur_mpsv->data.d.hi); \
+ cur_mpsv->data.d.todo--; \
+ cur_mpsv->data.d.hi++; \
+ TYPVAL_ENCODE_CONV_STR_STRING(&di->di_key[0], \
+ strlen((char *) &di->di_key[0])); \
+ TYPVAL_ENCODE_CONV_DICT_AFTER_KEY(); \
+ cur_tv = &di->di_tv; \
+ break; \
+ } \
+ case kMPConvList: { \
+ if (cur_mpsv->data.l.li == NULL) { \
+ (void) _mp_pop(mpstack); \
+ cur_mpsv->data.l.list->lv_copyID = copyID - 1; \
+ TYPVAL_ENCODE_CONV_LIST_END(); \
+ continue; \
+ } else if (cur_mpsv->data.l.li != cur_mpsv->data.l.list->lv_first) { \
+ TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS(); \
+ } \
+ cur_tv = &cur_mpsv->data.l.li->li_tv; \
+ cur_mpsv->data.l.li = cur_mpsv->data.l.li->li_next; \
+ break; \
+ } \
+ case kMPConvPairs: { \
+ if (cur_mpsv->data.l.li == NULL) { \
+ (void) _mp_pop(mpstack); \
+ cur_mpsv->data.l.list->lv_copyID = copyID - 1; \
+ TYPVAL_ENCODE_CONV_DICT_END(); \
+ continue; \
+ } else if (cur_mpsv->data.l.li != cur_mpsv->data.l.list->lv_first) { \
+ TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS(); \
+ } \
+ const list_T *const kv_pair = cur_mpsv->data.l.li->li_tv.vval.v_list; \
+ TYPVAL_ENCODE_CONV_SPECIAL_DICT_KEY_CHECK( \
+ encode_vim_to_##name##_error_ret, kv_pair); \
+ if (name##_convert_one_value(firstargname, &mpstack, \
+ &kv_pair->lv_first->li_tv, copyID, \
+ objname) == FAIL) { \
+ goto encode_vim_to_##name##_error_ret; \
+ } \
+ TYPVAL_ENCODE_CONV_DICT_AFTER_KEY(); \
+ cur_tv = &kv_pair->lv_last->li_tv; \
+ cur_mpsv->data.l.li = cur_mpsv->data.l.li->li_next; \
+ break; \
+ } \
+ } \
+ assert(cur_tv != NULL); \
+ if (name##_convert_one_value(firstargname, &mpstack, cur_tv, copyID, \
+ objname) == FAIL) { \
+ goto encode_vim_to_##name##_error_ret; \
+ } \
+ } \
+ _mp_destroy(mpstack); \
+ return OK; \
+encode_vim_to_##name##_error_ret: \
+ _mp_destroy(mpstack); \
+ return FAIL; \
+}
+
+#endif // NVIM_EVAL_TYPVAL_ENCODE_H
diff --git a/src/nvim/event/defs.h b/src/nvim/event/defs.h
index b802866a3d..e5335d9f25 100644
--- a/src/nvim/event/defs.h
+++ b/src/nvim/event/defs.h
@@ -14,19 +14,19 @@ typedef struct message {
} Event;
typedef void(*event_scheduler)(Event event, void *data);
-#define VA_EVENT_INIT(event, p, h, a) \
- do { \
- assert(a <= EVENT_HANDLER_MAX_ARGC); \
- (event)->priority = p; \
- (event)->handler = h; \
- if (a) { \
- va_list args; \
- va_start(args, a); \
- for (int i = 0; i < a; i++) { \
- (event)->argv[i] = va_arg(args, void *); \
- } \
- va_end(args); \
- } \
+#define VA_EVENT_INIT(event, p, h, a) \
+ do { \
+ assert(a <= EVENT_HANDLER_MAX_ARGC); \
+ (event)->priority = p; \
+ (event)->handler = h; \
+ if (a) { \
+ va_list args; \
+ va_start(args, a); \
+ for (int i = 0; i < a; i++) { \
+ (event)->argv[i] = va_arg(args, void *); \
+ } \
+ va_end(args); \
+ } \
} while (0)
static inline Event event_create(int priority, argv_callback cb, int argc, ...)
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c
index 9ef3468284..a68badcc8f 100644
--- a/src/nvim/event/libuv_process.c
+++ b/src/nvim/event/libuv_process.c
@@ -25,7 +25,7 @@ bool libuv_process_spawn(LibuvProcess *uvproc)
uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
}
uvproc->uvopts.exit_cb = exit_cb;
- uvproc->uvopts.cwd = NULL;
+ uvproc->uvopts.cwd = proc->cwd;
uvproc->uvopts.env = NULL;
uvproc->uvopts.stdio = uvproc->uvstdio;
uvproc->uvopts.stdio_count = 3;
diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h
index 0c1fcb5ed9..407aa4245f 100644
--- a/src/nvim/event/loop.h
+++ b/src/nvim/event/loop.h
@@ -26,43 +26,43 @@ typedef struct loop {
int recursive;
} Loop;
-#define CREATE_EVENT(queue, handler, argc, ...) \
- do { \
- if (queue) { \
- queue_put((queue), (handler), argc, __VA_ARGS__); \
- } else { \
- void *argv[argc] = {__VA_ARGS__}; \
- (handler)(argv); \
- } \
+#define CREATE_EVENT(queue, handler, argc, ...) \
+ do { \
+ if (queue) { \
+ queue_put((queue), (handler), argc, __VA_ARGS__); \
+ } else { \
+ void *argv[argc] = { __VA_ARGS__ }; \
+ (handler)(argv); \
+ } \
} while (0)
// Poll for events until a condition or timeout
-#define LOOP_PROCESS_EVENTS_UNTIL(loop, queue, timeout, condition) \
- do { \
- int remaining = timeout; \
- uint64_t before = (remaining > 0) ? os_hrtime() : 0; \
- while (!(condition)) { \
- LOOP_PROCESS_EVENTS(loop, queue, remaining); \
- if (remaining == 0) { \
- break; \
- } else if (remaining > 0) { \
- uint64_t now = os_hrtime(); \
- remaining -= (int) ((now - before) / 1000000); \
- before = now; \
- if (remaining <= 0) { \
- break; \
- } \
- } \
- } \
+#define LOOP_PROCESS_EVENTS_UNTIL(loop, queue, timeout, condition) \
+ do { \
+ int remaining = timeout; \
+ uint64_t before = (remaining > 0) ? os_hrtime() : 0; \
+ while (!(condition)) { \
+ LOOP_PROCESS_EVENTS(loop, queue, remaining); \
+ if (remaining == 0) { \
+ break; \
+ } else if (remaining > 0) { \
+ uint64_t now = os_hrtime(); \
+ remaining -= (int) ((now - before) / 1000000); \
+ before = now; \
+ if (remaining <= 0) { \
+ break; \
+ } \
+ } \
+ } \
} while (0)
-#define LOOP_PROCESS_EVENTS(loop, queue, timeout) \
- do { \
- if (queue && !queue_empty(queue)) { \
- queue_process_events(queue); \
- } else { \
- loop_poll_events(loop, timeout); \
- } \
+#define LOOP_PROCESS_EVENTS(loop, queue, timeout) \
+ do { \
+ if (queue && !queue_empty(queue)) { \
+ queue_process_events(queue); \
+ } else { \
+ loop_poll_events(loop, timeout); \
+ } \
} while (0)
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index 9bb62891c7..1fffdbf957 100644
--- a/src/nvim/event/process.c
+++ b/src/nvim/event/process.c
@@ -9,7 +9,7 @@
#include "nvim/event/wstream.h"
#include "nvim/event/process.h"
#include "nvim/event/libuv_process.h"
-#include "nvim/event/pty_process.h"
+#include "nvim/os/pty_process.h"
#include "nvim/globals.h"
#include "nvim/log.h"
@@ -22,11 +22,11 @@
#define TERM_TIMEOUT 1000000000
#define KILL_TIMEOUT (TERM_TIMEOUT * 2)
-#define CLOSE_PROC_STREAM(proc, stream) \
- do { \
- if (proc->stream && !proc->stream->closed) { \
- stream_close(proc->stream, NULL); \
- } \
+#define CLOSE_PROC_STREAM(proc, stream) \
+ do { \
+ if (proc->stream && !proc->stream->closed) { \
+ stream_close(proc->stream, NULL); \
+ } \
} while (0)
static bool process_is_tearing_down = false;
diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h
index e23c8ea60f..a4c6e7eeb2 100644
--- a/src/nvim/event/process.h
+++ b/src/nvim/event/process.h
@@ -21,6 +21,7 @@ struct process {
int pid, status, refcount;
// set to the hrtime of when process_stop was called for the process.
uint64_t stopped_time;
+ char *cwd;
char **argv;
Stream *in, *out, *err;
process_exit_cb cb;
@@ -40,6 +41,7 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data)
.status = 0,
.refcount = 0,
.stopped_time = 0,
+ .cwd = NULL,
.argv = NULL,
.in = NULL,
.out = NULL,
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 5096f17df0..6864e2b914 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6866,6 +6866,9 @@ void post_chdir(CdScope scope)
curwin->w_localdir = vim_strsave(NameBuff);
}
break;
+ case kCdScopeInvalid:
+ // We should never get here
+ assert(false);
}
shorten_fnames(TRUE);
@@ -6993,7 +6996,7 @@ void do_sleep(long msec)
ui_flush(); // flush before waiting
for (long left = msec; !got_int && left > 0; left -= 1000L) {
int next = left > 1000l ? 1000 : (int)left;
- LOOP_PROCESS_EVENTS_UNTIL(&loop, loop.events, (int)next, got_int);
+ LOOP_PROCESS_EVENTS_UNTIL(&main_loop, main_loop.events, (int)next, got_int);
os_breakcheck();
}
}
@@ -7857,19 +7860,26 @@ static void ex_stopinsert(exarg_T *eap)
*/
void exec_normal_cmd(char_u *cmd, int remap, bool silent)
{
+ // Stuff the argument into the typeahead buffer.
+ ins_typebuf(cmd, remap, 0, true, silent);
+ exec_normal(false);
+}
+
+/// Execute normal_cmd() until there is no typeahead left.
+///
+/// @param was_typed whether or not something was typed
+void exec_normal(bool was_typed)
+{
oparg_T oa;
- /*
- * Stuff the argument into the typeahead buffer.
- * Execute normal_cmd() until there is no typeahead left.
- */
clear_oparg(&oa);
- finish_op = FALSE;
- ins_typebuf(cmd, remap, 0, TRUE, silent);
- while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
+ finish_op = false;
+ while ((!stuff_empty()
+ || ((was_typed || !typebuf_typed())
+ && typebuf.tb_len > 0))
&& !got_int) {
update_topline_cursor();
- normal_cmd(&oa, TRUE); /* execute a Normal mode cmd */
+ normal_cmd(&oa, true); // execute a Normal mode cmd
}
}
diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h
index dbfc64e2f1..bafad20169 100644
--- a/src/nvim/ex_docmd.h
+++ b/src/nvim/ex_docmd.h
@@ -26,6 +26,7 @@
/// `getcwd()`. When using scopes as limits (e.g. in loops) don't use the scopes
/// directly, use `MIN_CD_SCOPE` and `MAX_CD_SCOPE` instead.
typedef enum {
+ kCdScopeInvalid = -1,
kCdScopeWindow, ///< Affects one window.
kCdScopeTab, ///< Affects one tab page.
kCdScopeGlobal, ///< Affects the entire instance of Neovim.
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index db21fddedb..65144dace8 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -358,7 +358,7 @@ static int command_line_execute(VimState *state, int key)
s->c = key;
if (s->c == K_EVENT) {
- queue_process_events(loop.events);
+ queue_process_events(main_loop.events);
redrawcmdline();
return 1;
}
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index beefc4238e..f7555c99fa 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1378,7 +1378,7 @@ find_file_in_path_option (
/* copy file name into NameBuff, expanding environment variables */
save_char = ptr[len];
ptr[len] = NUL;
- expand_env(ptr, NameBuff, MAXPATHL);
+ expand_env_esc(ptr, NameBuff, MAXPATHL, false, true, NULL);
ptr[len] = save_char;
xfree(ff_file_to_find);
diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h
index af8558d40d..ea017ab0c8 100644
--- a/src/nvim/func_attr.h
+++ b/src/nvim/func_attr.h
@@ -41,169 +41,174 @@
// $ gcc -E -dM - </dev/null
// $ echo | clang -dM -E -
+#ifndef NVIM_FUNC_ATTR_H
+#define NVIM_FUNC_ATTR_H
+#undef NVIM_FUNC_ATTR_H
+
#ifdef FUNC_ATTR_MALLOC
- #undef FUNC_ATTR_MALLOC
+# undef FUNC_ATTR_MALLOC
#endif
#ifdef FUNC_ATTR_ALLOC_SIZE
- #undef FUNC_ATTR_ALLOC_SIZE
+# undef FUNC_ATTR_ALLOC_SIZE
#endif
#ifdef FUNC_ATTR_ALLOC_SIZE_PROD
- #undef FUNC_ATTR_ALLOC_SIZE_PROD
+# undef FUNC_ATTR_ALLOC_SIZE_PROD
#endif
#ifdef FUNC_ATTR_ALLOC_ALIGN
- #undef FUNC_ATTR_ALLOC_ALIGN
+# undef FUNC_ATTR_ALLOC_ALIGN
#endif
#ifdef FUNC_ATTR_PURE
- #undef FUNC_ATTR_PURE
+# undef FUNC_ATTR_PURE
#endif
#ifdef FUNC_ATTR_CONST
- #undef FUNC_ATTR_CONST
+# undef FUNC_ATTR_CONST
#endif
#ifdef FUNC_ATTR_WARN_UNUSED_RESULT
- #undef FUNC_ATTR_WARN_UNUSED_RESULT
+# undef FUNC_ATTR_WARN_UNUSED_RESULT
#endif
#ifdef FUNC_ATTR_ALWAYS_INLINE
- #undef FUNC_ATTR_ALWAYS_INLINE
+# undef FUNC_ATTR_ALWAYS_INLINE
#endif
#ifdef FUNC_ATTR_UNUSED
- #undef FUNC_ATTR_UNUSED
+# undef FUNC_ATTR_UNUSED
#endif
#ifdef FUNC_ATTR_NONNULL_ALL
- #undef FUNC_ATTR_NONNULL_ALL
+# undef FUNC_ATTR_NONNULL_ALL
#endif
#ifdef FUNC_ATTR_NONNULL_ARG
- #undef FUNC_ATTR_NONNULL_ARG
+# undef FUNC_ATTR_NONNULL_ARG
#endif
#ifdef FUNC_ATTR_NONNULL_RET
- #undef FUNC_ATTR_NONNULL_RET
+# undef FUNC_ATTR_NONNULL_RET
#endif
#ifndef DID_REAL_ATTR
- #define DID_REAL_ATTR
- #ifdef __GNUC__
- // place defines for all gnulikes here, for now that's gcc, clang and
- // intel.
-
- // place these after the argument list of the function declaration
- // (not definition), like so:
- // void myfunc(void) REAL_FATTR_ALWAYS_INLINE;
- #define REAL_FATTR_MALLOC __attribute__((malloc))
- #define REAL_FATTR_ALLOC_ALIGN(x) __attribute__((alloc_align(x)))
- #define REAL_FATTR_PURE __attribute__ ((pure))
- #define REAL_FATTR_CONST __attribute__((const))
- #define REAL_FATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
- #define REAL_FATTR_ALWAYS_INLINE __attribute__((always_inline))
- #define REAL_FATTR_UNUSED __attribute__((unused))
- #define REAL_FATTR_NONNULL_ALL __attribute__((nonnull))
- #define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
-
- #ifdef __clang__
- // clang only
- #elif defined(__INTEL_COMPILER)
- // intel only
- #else
- #define GCC_VERSION \
+# define DID_REAL_ATTR
+# ifdef __GNUC__
+// place defines for all gnulikes here, for now that's gcc, clang and
+// intel.
+
+// place these after the argument list of the function declaration
+// (not definition), like so:
+// void myfunc(void) REAL_FATTR_ALWAYS_INLINE;
+# define REAL_FATTR_MALLOC __attribute__((malloc))
+# define REAL_FATTR_ALLOC_ALIGN(x) __attribute__((alloc_align(x)))
+# define REAL_FATTR_PURE __attribute__ ((pure))
+# define REAL_FATTR_CONST __attribute__((const))
+# define REAL_FATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+# define REAL_FATTR_ALWAYS_INLINE __attribute__((always_inline))
+# define REAL_FATTR_UNUSED __attribute__((unused))
+# define REAL_FATTR_NONNULL_ALL __attribute__((nonnull))
+# define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
+
+# ifdef __clang__
+// clang only
+# elif defined(__INTEL_COMPILER)
+// intel only
+# else
+# define GCC_VERSION \
(__GNUC__ * 10000 + \
- __GNUC_MINOR__ * 100 + \
- __GNUC_PATCHLEVEL__)
- // gcc only
- #define REAL_FATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
- #define REAL_FATTR_ALLOC_SIZE_PROD(x,y) __attribute__((alloc_size(x,y)))
- #if GCC_VERSION >= 40900
- #define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull))
- #endif
- #endif
- #endif
-
- // define function attributes that haven't been defined for this specific
- // compiler.
-
- #ifndef REAL_FATTR_MALLOC
- #define REAL_FATTR_MALLOC
- #endif
-
- #ifndef REAL_FATTR_ALLOC_SIZE
- #define REAL_FATTR_ALLOC_SIZE(x)
- #endif
-
- #ifndef REAL_FATTR_ALLOC_SIZE_PROD
- #define REAL_FATTR_ALLOC_SIZE_PROD(x,y)
- #endif
-
- #ifndef REAL_FATTR_ALLOC_ALIGN
- #define REAL_FATTR_ALLOC_ALIGN(x)
- #endif
-
- #ifndef REAL_FATTR_PURE
- #define REAL_FATTR_PURE
- #endif
-
- #ifndef REAL_FATTR_CONST
- #define REAL_FATTR_CONST
- #endif
-
- #ifndef REAL_FATTR_WARN_UNUSED_RESULT
- #define REAL_FATTR_WARN_UNUSED_RESULT
- #endif
-
- #ifndef REAL_FATTR_ALWAYS_INLINE
- #define REAL_FATTR_ALWAYS_INLINE
- #endif
-
- #ifndef REAL_FATTR_UNUSED
- #define REAL_FATTR_UNUSED
- #endif
-
- #ifndef REAL_FATTR_NONNULL_ALL
- #define REAL_FATTR_NONNULL_ALL
- #endif
-
- #ifndef REAL_FATTR_NONNULL_ARG
- #define REAL_FATTR_NONNULL_ARG(...)
- #endif
-
- #ifndef REAL_FATTR_NONNULL_RET
- #define REAL_FATTR_NONNULL_RET
- #endif
+ __GNUC_MINOR__ * 100 + \
+ __GNUC_PATCHLEVEL__)
+// gcc only
+# define REAL_FATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
+# define REAL_FATTR_ALLOC_SIZE_PROD(x, y) __attribute__((alloc_size(x, y)))
+# if GCC_VERSION >= 40900
+# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull))
+# endif
+# endif
+# endif
+
+// define function attributes that haven't been defined for this specific
+// compiler.
+
+# ifndef REAL_FATTR_MALLOC
+# define REAL_FATTR_MALLOC
+# endif
+
+# ifndef REAL_FATTR_ALLOC_SIZE
+# define REAL_FATTR_ALLOC_SIZE(x)
+# endif
+
+# ifndef REAL_FATTR_ALLOC_SIZE_PROD
+# define REAL_FATTR_ALLOC_SIZE_PROD(x, y)
+# endif
+
+# ifndef REAL_FATTR_ALLOC_ALIGN
+# define REAL_FATTR_ALLOC_ALIGN(x)
+# endif
+
+# ifndef REAL_FATTR_PURE
+# define REAL_FATTR_PURE
+# endif
+
+# ifndef REAL_FATTR_CONST
+# define REAL_FATTR_CONST
+# endif
+
+# ifndef REAL_FATTR_WARN_UNUSED_RESULT
+# define REAL_FATTR_WARN_UNUSED_RESULT
+# endif
+
+# ifndef REAL_FATTR_ALWAYS_INLINE
+# define REAL_FATTR_ALWAYS_INLINE
+# endif
+
+# ifndef REAL_FATTR_UNUSED
+# define REAL_FATTR_UNUSED
+# endif
+
+# ifndef REAL_FATTR_NONNULL_ALL
+# define REAL_FATTR_NONNULL_ALL
+# endif
+
+# ifndef REAL_FATTR_NONNULL_ARG
+# define REAL_FATTR_NONNULL_ARG(...)
+# endif
+
+# ifndef REAL_FATTR_NONNULL_RET
+# define REAL_FATTR_NONNULL_RET
+# endif
#endif
#ifdef DEFINE_FUNC_ATTRIBUTES
- #define FUNC_API_ASYNC
- #define FUNC_API_NOEXPORT
- #define FUNC_ATTR_MALLOC REAL_FATTR_MALLOC
- #define FUNC_ATTR_ALLOC_SIZE(x) REAL_FATTR_ALLOC_SIZE(x)
- #define FUNC_ATTR_ALLOC_SIZE_PROD(x,y) REAL_FATTR_ALLOC_SIZE_PROD(x,y)
- #define FUNC_ATTR_ALLOC_ALIGN(x) REAL_FATTR_ALLOC_ALIGN(x)
- #define FUNC_ATTR_PURE REAL_FATTR_PURE
- #define FUNC_ATTR_CONST REAL_FATTR_CONST
- #define FUNC_ATTR_WARN_UNUSED_RESULT REAL_FATTR_WARN_UNUSED_RESULT
- #define FUNC_ATTR_ALWAYS_INLINE REAL_FATTR_ALWAYS_INLINE
- #define FUNC_ATTR_UNUSED REAL_FATTR_UNUSED
- #define FUNC_ATTR_NONNULL_ALL REAL_FATTR_NONNULL_ALL
- #define FUNC_ATTR_NONNULL_ARG(...) REAL_FATTR_NONNULL_ARG(__VA_ARGS__)
- #define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
+# define FUNC_API_ASYNC
+# define FUNC_API_NOEXPORT
+# define FUNC_ATTR_MALLOC REAL_FATTR_MALLOC
+# define FUNC_ATTR_ALLOC_SIZE(x) REAL_FATTR_ALLOC_SIZE(x)
+# define FUNC_ATTR_ALLOC_SIZE_PROD(x, y) REAL_FATTR_ALLOC_SIZE_PROD(x, y)
+# define FUNC_ATTR_ALLOC_ALIGN(x) REAL_FATTR_ALLOC_ALIGN(x)
+# define FUNC_ATTR_PURE REAL_FATTR_PURE
+# define FUNC_ATTR_CONST REAL_FATTR_CONST
+# define FUNC_ATTR_WARN_UNUSED_RESULT REAL_FATTR_WARN_UNUSED_RESULT
+# define FUNC_ATTR_ALWAYS_INLINE REAL_FATTR_ALWAYS_INLINE
+# define FUNC_ATTR_UNUSED REAL_FATTR_UNUSED
+# define FUNC_ATTR_NONNULL_ALL REAL_FATTR_NONNULL_ALL
+# define FUNC_ATTR_NONNULL_ARG(...) REAL_FATTR_NONNULL_ARG(__VA_ARGS__)
+# define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
- #define FUNC_ATTR_MALLOC
- #define FUNC_ATTR_ALLOC_SIZE(x)
- #define FUNC_ATTR_ALLOC_SIZE_PROD(x,y)
- #define FUNC_ATTR_ALLOC_ALIGN(x)
- #define FUNC_ATTR_PURE
- #define FUNC_ATTR_CONST
- #define FUNC_ATTR_WARN_UNUSED_RESULT
- #define FUNC_ATTR_ALWAYS_INLINE
- #define FUNC_ATTR_UNUSED
- #define FUNC_ATTR_NONNULL_ALL
- #define FUNC_ATTR_NONNULL_ARG(...)
- #define FUNC_ATTR_NONNULL_RET
+# define FUNC_ATTR_MALLOC
+# define FUNC_ATTR_ALLOC_SIZE(x)
+# define FUNC_ATTR_ALLOC_SIZE_PROD(x, y)
+# define FUNC_ATTR_ALLOC_ALIGN(x)
+# define FUNC_ATTR_PURE
+# define FUNC_ATTR_CONST
+# define FUNC_ATTR_WARN_UNUSED_RESULT
+# define FUNC_ATTR_ALWAYS_INLINE
+# define FUNC_ATTR_UNUSED
+# define FUNC_ATTR_NONNULL_ALL
+# define FUNC_ATTR_NONNULL_ARG(...)
+# define FUNC_ATTR_NONNULL_RET
#endif
+#endif // NVIM_FUNC_ATTR_H
diff --git a/src/nvim/garray.h b/src/nvim/garray.h
index 642eaf54f0..5d7806bbfa 100644
--- a/src/nvim/garray.h
+++ b/src/nvim/garray.h
@@ -21,10 +21,10 @@ typedef struct growarray {
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)
-#define GA_APPEND(item_type, gap, item) \
- do { \
- ga_grow(gap, 1); \
- ((item_type *)(gap)->ga_data)[(gap)->ga_len++] = (item); \
+#define GA_APPEND(item_type, gap, item) \
+ do { \
+ ga_grow(gap, 1); \
+ ((item_type *)(gap)->ga_data)[(gap)->ga_len++] = (item); \
} while (0)
#define GA_APPEND_VIA_PTR(item_type, gap) \
@@ -49,16 +49,16 @@ static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size)
/// @param gap the garray to be freed
/// @param item_type type of the item in the garray
/// @param free_item_fn free function that takes (*item_type) as parameter
-#define GA_DEEP_CLEAR(gap, item_type, free_item_fn) \
- do { \
- garray_T *_gap = (gap); \
- if (_gap->ga_data != NULL) { \
- for (int i = 0; i < _gap->ga_len; i++) { \
- item_type *_item = &(((item_type *)_gap->ga_data)[i]); \
- free_item_fn(_item); \
- } \
- } \
- ga_clear(_gap); \
+#define GA_DEEP_CLEAR(gap, item_type, free_item_fn) \
+ do { \
+ garray_T *_gap = (gap); \
+ if (_gap->ga_data != NULL) { \
+ for (int i = 0; i < _gap->ga_len; i++) { \
+ item_type *_item = &(((item_type *)_gap->ga_data)[i]); \
+ free_item_fn(_item); \
+ } \
+ } \
+ ga_clear(_gap); \
} while (false)
#define FREE_PTR_PTR(ptr) xfree(*(ptr))
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index dbf0322d78..ae1857f318 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1754,10 +1754,11 @@ static int vgetorpeek(int advance)
|| ((compl_cont_status & CONT_LOCAL)
&& (c1 == Ctrl_N || c1 == Ctrl_P)))
) {
- if (c1 == K_SPECIAL)
+ if (c1 == K_SPECIAL) {
nolmaplen = 2;
- else {
- LANGMAP_ADJUST(c1, (State & (CMDLINE | INSERT)) == 0);
+ } else {
+ LANGMAP_ADJUST(c1, (State & (CMDLINE | INSERT)) == 0
+ && get_real_state() != SELECTMODE);
nolmaplen = 0;
}
/* First try buffer-local mappings. */
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 9cef1feb35..4ac687fa4f 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1243,7 +1243,6 @@ EXTERN char *ignoredp;
// If a msgpack-rpc channel should be started over stdin/stdout
EXTERN bool embedded_mode INIT(= false);
-EXTERN Loop loop;
/// Used to track the status of external functions.
/// Currently only used for iconv().
diff --git a/src/nvim/lib/klist.h b/src/nvim/lib/klist.h
index 1280a927e8..7ee100ab8c 100644
--- a/src/nvim/lib/klist.h
+++ b/src/nvim/lib/klist.h
@@ -33,35 +33,37 @@
#include "nvim/func_attr.h"
-#define KMEMPOOL_INIT(name, kmptype_t, kmpfree_f) \
- typedef struct { \
- size_t cnt, n, max; \
- kmptype_t **buf; \
- } kmp_##name##_t; \
- static inline kmp_##name##_t *kmp_init_##name(void) { \
- return xcalloc(1, sizeof(kmp_##name##_t)); \
- } \
- static inline void kmp_destroy_##name(kmp_##name##_t *mp) \
- REAL_FATTR_UNUSED; \
- static inline void kmp_destroy_##name(kmp_##name##_t *mp) { \
- size_t k; \
- for (k = 0; k < mp->n; ++k) { \
- kmpfree_f(mp->buf[k]); xfree(mp->buf[k]); \
- } \
- xfree(mp->buf); xfree(mp); \
- } \
- static inline kmptype_t *kmp_alloc_##name(kmp_##name##_t *mp) { \
- ++mp->cnt; \
- if (mp->n == 0) return xcalloc(1, sizeof(kmptype_t)); \
- return mp->buf[--mp->n]; \
- } \
+#define KMEMPOOL_INIT(name, kmptype_t, kmpfree_f) \
+ typedef struct { \
+ size_t cnt, n, max; \
+ kmptype_t **buf; \
+ } kmp_##name##_t; \
+ static inline kmp_##name##_t *kmp_init_##name(void) { \
+ return xcalloc(1, sizeof(kmp_##name##_t)); \
+ } \
+ static inline void kmp_destroy_##name(kmp_##name##_t *mp) \
+ REAL_FATTR_UNUSED; \
+ static inline void kmp_destroy_##name(kmp_##name##_t *mp) { \
+ size_t k; \
+ for (k = 0; k < mp->n; k++) { \
+ kmpfree_f(mp->buf[k]); xfree(mp->buf[k]); \
+ } \
+ xfree(mp->buf); xfree(mp); \
+ } \
+ static inline kmptype_t *kmp_alloc_##name(kmp_##name##_t *mp) { \
+ mp->cnt++; \
+ if (mp->n == 0) { \
+ return xcalloc(1, sizeof(kmptype_t)); \
+ } \
+ return mp->buf[--mp->n]; \
+ } \
static inline void kmp_free_##name(kmp_##name##_t *mp, kmptype_t *p) { \
- --mp->cnt; \
- if (mp->n == mp->max) { \
- mp->max = mp->max? mp->max<<1 : 16; \
+ mp->cnt--; \
+ if (mp->n == mp->max) { \
+ mp->max = mp->max ? (mp->max << 1) : 16; \
mp->buf = xrealloc(mp->buf, sizeof(kmptype_t *) * mp->max); \
- } \
- mp->buf[mp->n++] = p; \
+ } \
+ mp->buf[mp->n++] = p; \
}
#define kmempool_t(name) kmp_##name##_t
@@ -70,54 +72,56 @@
#define kmp_alloc(name, mp) kmp_alloc_##name(mp)
#define kmp_free(name, mp, p) kmp_free_##name(mp, p)
-#define KLIST_INIT(name, kltype_t, kmpfree_t) \
- struct __kl1_##name { \
- kltype_t data; \
- struct __kl1_##name *next; \
- }; \
- typedef struct __kl1_##name kl1_##name; \
- KMEMPOOL_INIT(name, kl1_##name, kmpfree_t) \
- typedef struct { \
- kl1_##name *head, *tail; \
- kmp_##name##_t *mp; \
- size_t size; \
- } kl_##name##_t; \
- static inline kl_##name##_t *kl_init_##name(void) { \
- kl_##name##_t *kl = xcalloc(1, sizeof(kl_##name##_t)); \
- kl->mp = kmp_init(name); \
- kl->head = kl->tail = kmp_alloc(name, kl->mp); \
- kl->head->next = 0; \
- return kl; \
- } \
- static inline void kl_destroy_##name(kl_##name##_t *kl) \
- REAL_FATTR_UNUSED; \
- static inline void kl_destroy_##name(kl_##name##_t *kl) { \
- kl1_##name *p; \
- for (p = kl->head; p != kl->tail; p = p->next) \
- kmp_free(name, kl->mp, p); \
- kmp_free(name, kl->mp, p); \
- kmp_destroy(name, kl->mp); \
- xfree(kl); \
- } \
- static inline void kl_push_##name(kl_##name##_t *kl, kltype_t d) { \
- kl1_##name *q, *p = kmp_alloc(name, kl->mp); \
- q = kl->tail; p->next = 0; kl->tail->next = p; kl->tail = p; \
- ++kl->size; \
- q->data = d; \
- } \
- static inline kltype_t kl_shift_at_##name(kl_##name##_t *kl, \
- kl1_##name **n) { \
- assert((*n)->next); \
- kl1_##name *p; \
- --kl->size; \
- p = *n; \
- *n = (*n)->next; \
- if (p == kl->head) kl->head = *n; \
- kltype_t d = p->data; \
- kmp_free(name, kl->mp, p); \
- return d; \
- } \
-
+#define KLIST_INIT(name, kltype_t, kmpfree_t) \
+ struct __kl1_##name { \
+ kltype_t data; \
+ struct __kl1_##name *next; \
+ }; \
+ typedef struct __kl1_##name kl1_##name; \
+ KMEMPOOL_INIT(name, kl1_##name, kmpfree_t) \
+ typedef struct { \
+ kl1_##name *head, *tail; \
+ kmp_##name##_t *mp; \
+ size_t size; \
+ } kl_##name##_t; \
+ static inline kl_##name##_t *kl_init_##name(void) { \
+ kl_##name##_t *kl = xcalloc(1, sizeof(kl_##name##_t)); \
+ kl->mp = kmp_init(name); \
+ kl->head = kl->tail = kmp_alloc(name, kl->mp); \
+ kl->head->next = 0; \
+ return kl; \
+ } \
+ static inline void kl_destroy_##name(kl_##name##_t *kl) \
+ REAL_FATTR_UNUSED; \
+ static inline void kl_destroy_##name(kl_##name##_t *kl) { \
+ kl1_##name *p; \
+ for (p = kl->head; p != kl->tail; p = p->next) { \
+ kmp_free(name, kl->mp, p); \
+ } \
+ kmp_free(name, kl->mp, p); \
+ kmp_destroy(name, kl->mp); \
+ xfree(kl); \
+ } \
+ static inline void kl_push_##name(kl_##name##_t *kl, kltype_t d) { \
+ kl1_##name *q, *p = kmp_alloc(name, kl->mp); \
+ q = kl->tail; p->next = 0; kl->tail->next = p; kl->tail = p; \
+ kl->size++; \
+ q->data = d; \
+ } \
+ static inline kltype_t kl_shift_at_##name(kl_##name##_t *kl, \
+ kl1_##name **n) { \
+ assert((*n)->next); \
+ kl1_##name *p; \
+ kl->size--; \
+ p = *n; \
+ *n = (*n)->next; \
+ if (p == kl->head) { \
+ kl->head = *n; \
+ } \
+ kltype_t d = p->data; \
+ kmp_free(name, kl->mp, p); \
+ return d; \
+ }
#define kliter_t(name) kl1_##name
#define klist_t(name) kl_##name##_t
diff --git a/src/nvim/lib/kvec.h b/src/nvim/lib/kvec.h
index b41ef0cc9f..36c91c86b2 100644
--- a/src/nvim/lib/kvec.h
+++ b/src/nvim/lib/kvec.h
@@ -1,59 +1,61 @@
-/* The MIT License
-
- Copyright (c) 2008, by Attractive Chaos <attractor@live.co.uk>
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-*/
-
-/*
- An example:
-
-#include "kvec.h"
-int main() {
- kvec_t(int) array;
- kv_init(array);
- kv_push(int, array, 10); // append
- kv_a(int, array, 20) = 5; // dynamic
- kv_A(array, 20) = 4; // static
- kv_destroy(array);
- return 0;
-}
-*/
-
-/*
- 2008-09-22 (0.1.0):
+// The MIT License
+//
+// Copyright (c) 2008, by Attractive Chaos <attractor@live.co.uk>
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+// An example:
+//
+// #include "kvec.h"
+// int main() {
+// kvec_t(int) array = KV_INITIAL_VALUE;
+// kv_push(array, 10); // append
+// kv_a(array, 20) = 5; // dynamic
+// kv_A(array, 20) = 4; // static
+// kv_destroy(array);
+// return 0;
+// }
+
+#ifndef NVIM_LIB_KVEC_H
+#define NVIM_LIB_KVEC_H
- * The initial version.
+#include <stdlib.h>
+#include <string.h>
-*/
+#include "nvim/memory.h"
-#ifndef AC_KVEC_H
-#define AC_KVEC_H
+#define kv_roundup32(x) \
+ ((--(x)), \
+ ((x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16), \
+ (++(x)))
-#include <stdlib.h>
-#include "nvim/memory.h"
+#define KV_INITIAL_VALUE { .size = 0, .capacity = 0, .items = NULL }
-#define kv_roundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
+#define kvec_t(type) \
+ struct { \
+ size_t size; \
+ size_t capacity; \
+ type *items; \
+ }
-#define kvec_t(type) struct { size_t size, capacity; type *items; }
#define kv_init(v) ((v).size = (v).capacity = 0, (v).items = 0)
#define kv_destroy(v) xfree((v).items)
#define kv_A(v, i) ((v).items[(i)])
@@ -62,31 +64,130 @@ int main() {
#define kv_max(v) ((v).capacity)
#define kv_last(v) kv_A(v, kv_size(v) - 1)
-#define kv_resize(type, v, s) ((v).capacity = (s), (v).items = (type*)xrealloc((v).items, sizeof(type) * (v).capacity))
-
-#define kv_copy(type, v1, v0) do { \
- if ((v1).capacity < (v0).size) kv_resize(type, v1, (v0).size); \
- (v1).size = (v0).size; \
- memcpy((v1).items, (v0).items, sizeof(type) * (v0).size); \
- } while (0) \
-
-#define kv_push(type, v, x) do { \
- if ((v).size == (v).capacity) { \
- (v).capacity = (v).capacity? (v).capacity<<1 : 8; \
- (v).items = (type*)xrealloc((v).items, sizeof(type) * (v).capacity); \
- } \
- (v).items[(v).size++] = (x); \
- } while (0)
-
-#define kv_pushp(type, v) ((((v).size == (v).capacity)? \
- ((v).capacity = ((v).capacity? (v).capacity<<1 : 8), \
- (v).items = (type*)xrealloc((v).items, sizeof(type) * (v).capacity), 0) \
- : 0), ((v).items + ((v).size++)))
-
-#define kv_a(type, v, i) (((v).capacity <= (size_t)(i)? \
- ((v).capacity = (v).size = (i) + 1, kv_roundup32((v).capacity), \
- (v).items = (type*)xrealloc((v).items, sizeof(type) * (v).capacity), 0) \
- : (v).size <= (size_t)(i)? (v).size = (i) + 1 \
- : 0), (v).items[(i)])
-
-#endif
+#define kv_resize(v, s) \
+ ((v).capacity = (s), \
+ (v).items = xrealloc((v).items, sizeof((v).items[0]) * (v).capacity))
+
+#define kv_resize_full(v) \
+ kv_resize(v, (v).capacity ? (v).capacity << 1 : 8)
+
+#define kv_copy(v1, v0) \
+ do { \
+ if ((v1).capacity < (v0).size) { \
+ kv_resize(v1, (v0).size); \
+ } \
+ (v1).size = (v0).size; \
+ memcpy((v1).items, (v0).items, sizeof((v1).items[0]) * (v0).size); \
+ } while (0) \
+
+#define kv_pushp(v) \
+ ((((v).size == (v).capacity) ? (kv_resize_full(v), 0) : 0), \
+ ((v).items + ((v).size++)))
+
+#define kv_push(v, x) \
+ (*kv_pushp(v) = (x))
+
+#define kv_a(v, i) \
+ (((v).capacity <= (size_t) (i) \
+ ? ((v).capacity = (v).size = (i) + 1, \
+ kv_roundup32((v).capacity), \
+ kv_resize((v), (v).capacity), 0) \
+ : ((v).size <= (size_t) (i) \
+ ? (v).size = (i) + 1 \
+ : 0)), \
+ (v).items[(i)])
+
+/// Type of a vector with a few first members allocated on stack
+///
+/// Is compatible with #kv_A, #kv_pop, #kv_size, #kv_max, #kv_last.
+/// Is not compatible with #kv_resize, #kv_resize_full, #kv_copy, #kv_push,
+/// #kv_pushp, #kv_a, #kv_destroy.
+///
+/// @param[in] type Type of vector elements.
+/// @param[in] init_size Number of the elements in the initial array.
+#define kvec_withinit_t(type, INIT_SIZE) \
+ struct { \
+ size_t size; \
+ size_t capacity; \
+ type *items; \
+ type init_array[INIT_SIZE]; \
+ }
+
+/// Initialize vector with preallocated array
+///
+/// @param[out] v Vector to initialize.
+#define kvi_init(v) \
+ ((v).capacity = ARRAY_SIZE((v).init_array), \
+ (v).size = 0, \
+ (v).items = (v).init_array)
+
+/// Move data to a new destination and free source
+static inline void *_memcpy_free(void *const restrict dest,
+ void *const restrict src,
+ const size_t size)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET FUNC_ATTR_ALWAYS_INLINE
+{
+ memcpy(dest, src, size);
+ xfree(src);
+ return dest;
+}
+
+/// Resize vector with preallocated array
+///
+/// @param[out] v Vector to resize.
+/// @param[in] s New size.
+#define kvi_resize(v, s) \
+ ((v).capacity = ((s) > ARRAY_SIZE((v).init_array) \
+ ? (s) \
+ : ARRAY_SIZE((v).init_array)), \
+ (v).items = ((v).capacity == ARRAY_SIZE((v).init_array) \
+ ? ((v).items == (v).init_array \
+ ? (v).items \
+ : _memcpy_free((v).init_array, (v).items, \
+ (v).size * sizeof((v).items[0]))) \
+ : ((v).items == (v).init_array \
+ ? memcpy(xmalloc((v).capacity * sizeof((v).items[0])), \
+ (v).items, \
+ (v).size * sizeof((v).items[0])) \
+ : xrealloc((v).items, \
+ (v).capacity * sizeof((v).items[0])))))
+
+/// Resize vector with preallocated array when it is full
+///
+/// @param[out] v Vector to resize.
+#define kvi_resize_full(v) \
+ /* ARRAY_SIZE((v).init_array) is the minimal capacity of this vector. */ \
+ /* Thus when vector is full capacity may not be zero and it is safe */ \
+ /* not to bother with checking whether (v).capacity is 0. But now */ \
+ /* capacity is not guaranteed to have size that is a power of 2. */ \
+ kvi_resize(v, ((v).capacity == ARRAY_SIZE((v).init_array) \
+ ? ((v).capacity++, kv_roundup32((v).capacity)) \
+ : (v).capacity << 1))
+
+/// Get location where to store new element to a vector with preallocated array
+///
+/// @param[in,out] v Vector to push to.
+///
+/// @return Pointer to the place where new value should be stored.
+#define kvi_pushp(v) \
+ ((((v).size == (v).capacity) ? (kvi_resize_full(v), 0) : 0), \
+ ((v).items + ((v).size++)))
+
+/// Push value to a vector with preallocated array
+///
+/// @param[out] v Vector to push to.
+/// @param[in] x Value to push.
+#define kvi_push(v, x) \
+ (*kvi_pushp(v) = (x))
+
+/// Free array of elements of a vector with preallocated array if needed
+///
+/// @param[out] v Vector to free.
+#define kvi_destroy(v) \
+ do { \
+ if ((v).items != (v).init_array) { \
+ xfree((v).items); \
+ } \
+ } while (0)
+
+#endif // NVIM_LIB_KVEC_H
diff --git a/src/nvim/lib/queue.h b/src/nvim/lib/queue.h
index fe02b454ea..9fcedf298f 100644
--- a/src/nvim/lib/queue.h
+++ b/src/nvim/lib/queue.h
@@ -1,92 +1,94 @@
-/* Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
+// Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#ifndef QUEUE_H_
-#define QUEUE_H_
+#ifndef NVIM_LIB_QUEUE_H
+#define NVIM_LIB_QUEUE_H
-typedef void *QUEUE[2];
+#include <stddef.h>
-/* Private macros. */
-#define QUEUE_NEXT(q) (*(QUEUE **) &((*(q))[0]))
-#define QUEUE_PREV(q) (*(QUEUE **) &((*(q))[1]))
-#define QUEUE_PREV_NEXT(q) (QUEUE_NEXT(QUEUE_PREV(q)))
-#define QUEUE_NEXT_PREV(q) (QUEUE_PREV(QUEUE_NEXT(q)))
+#include "nvim/func_attr.h"
-/* Public macros. */
-#define QUEUE_DATA(ptr, type, field) \
- ((type *) ((char *) (ptr) - ((char *) &((type *) 0)->field)))
+typedef struct _queue {
+ struct _queue *next;
+ struct _queue *prev;
+} QUEUE;
-#define QUEUE_FOREACH(q, h) \
- for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))
+// Public macros.
+#define QUEUE_DATA(ptr, type, field) \
+ ((type *)((char *)(ptr) - offsetof(type, field)))
-#define QUEUE_EMPTY(q) \
- ((const QUEUE *) (q) == (const QUEUE *) QUEUE_NEXT(q))
+#define QUEUE_FOREACH(q, h) \
+ for ( /* NOLINT(readability/braces) */ \
+ (q) = (h)->next; (q) != (h); (q) = (q)->next)
-#define QUEUE_HEAD(q) \
- (QUEUE_NEXT(q))
+// ffi.cdef is unable to swallow `bool` in place of `int` here.
+static inline int QUEUE_EMPTY(const QUEUE *const q)
+ FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ return q == q->next;
+}
-#define QUEUE_INIT(q) \
- do { \
- QUEUE_NEXT(q) = (q); \
- QUEUE_PREV(q) = (q); \
- } \
- while (0)
+#define QUEUE_HEAD(q) (q)->next
-#define QUEUE_ADD(h, n) \
- do { \
- QUEUE_PREV_NEXT(h) = QUEUE_NEXT(n); \
- QUEUE_NEXT_PREV(n) = QUEUE_PREV(h); \
- QUEUE_PREV(h) = QUEUE_PREV(n); \
- QUEUE_PREV_NEXT(h) = (h); \
- } \
- while (0)
+static inline void QUEUE_INIT(QUEUE *const q) FUNC_ATTR_ALWAYS_INLINE
+{
+ q->next = q;
+ q->prev = q;
+}
-#define QUEUE_SPLIT(h, q, n) \
- do { \
- QUEUE_PREV(n) = QUEUE_PREV(h); \
- QUEUE_PREV_NEXT(n) = (n); \
- QUEUE_NEXT(n) = (q); \
- QUEUE_PREV(h) = QUEUE_PREV(q); \
- QUEUE_PREV_NEXT(h) = (h); \
- QUEUE_PREV(q) = (n); \
- } \
- while (0)
+static inline void QUEUE_ADD(QUEUE *const h, QUEUE *const n)
+ FUNC_ATTR_ALWAYS_INLINE
+{
+ h->prev->next = n->next;
+ n->next->prev = h->prev;
+ h->prev = n->prev;
+ h->prev->next = h;
+}
-#define QUEUE_INSERT_HEAD(h, q) \
- do { \
- QUEUE_NEXT(q) = QUEUE_NEXT(h); \
- QUEUE_PREV(q) = (h); \
- QUEUE_NEXT_PREV(q) = (q); \
- QUEUE_NEXT(h) = (q); \
- } \
- while (0)
+static inline void QUEUE_SPLIT(QUEUE *const h, QUEUE *const q, QUEUE *const n)
+ FUNC_ATTR_ALWAYS_INLINE
+{
+ n->prev = h->prev;
+ n->prev->next = n;
+ n->next = q;
+ h->prev = q->prev;
+ h->prev->next = h;
+ q->prev = n;
+}
-#define QUEUE_INSERT_TAIL(h, q) \
- do { \
- QUEUE_NEXT(q) = (h); \
- QUEUE_PREV(q) = QUEUE_PREV(h); \
- QUEUE_PREV_NEXT(q) = (q); \
- QUEUE_PREV(h) = (q); \
- } \
- while (0)
+static inline void QUEUE_INSERT_HEAD(QUEUE *const h, QUEUE *const q)
+ FUNC_ATTR_ALWAYS_INLINE
+{
+ q->next = h->next;
+ q->prev = h;
+ q->next->prev = q;
+ h->next = q;
+}
-#define QUEUE_REMOVE(q) \
- do { \
- QUEUE_PREV_NEXT(q) = QUEUE_NEXT(q); \
- QUEUE_NEXT_PREV(q) = QUEUE_PREV(q); \
- } \
- while (0)
+static inline void QUEUE_INSERT_TAIL(QUEUE *const h, QUEUE *const q)
+ FUNC_ATTR_ALWAYS_INLINE
+{
+ q->next = h;
+ q->prev = h->prev;
+ q->prev->next = q;
+ h->prev = q;
+}
-#endif /* QUEUE_H_ */
+static inline void QUEUE_REMOVE(QUEUE *const q) FUNC_ATTR_ALWAYS_INLINE
+{
+ q->prev->next = q->next;
+ q->next->prev = q->prev;
+}
+
+#endif // NVIM_LIB_QUEUE_H
diff --git a/src/nvim/lib/ringbuf.h b/src/nvim/lib/ringbuf.h
index cb71500bb7..12b75ec65a 100644
--- a/src/nvim/lib/ringbuf.h
+++ b/src/nvim/lib/ringbuf.h
@@ -65,12 +65,12 @@
/// @param TypeName Ring buffer type name. Actual type name will be
/// `{TypeName}RingBuffer`.
/// @param RBType Type of the single ring buffer element.
-#define RINGBUF_TYPEDEF(TypeName, RBType) \
-typedef struct { \
- RBType *buf; \
- RBType *next; \
- RBType *first; \
- RBType *buf_end; \
+#define RINGBUF_TYPEDEF(TypeName, RBType) \
+typedef struct { \
+ RBType *buf; \
+ RBType *next; \
+ RBType *first; \
+ RBType *buf_end; \
} TypeName##RingBuffer;
/// Initialize a new ring buffer
@@ -84,198 +84,196 @@ typedef struct { \
/// a macros like `#define RBFREE(item)` (to skip freeing).
///
/// Intended function signature: `void *rbfree(RBType *)`;
-#define RINGBUF_INIT(TypeName, funcprefix, RBType, rbfree) \
- \
- \
-static inline TypeName##RingBuffer funcprefix##_rb_new(const size_t size) \
- REAL_FATTR_WARN_UNUSED_RESULT; \
-static inline TypeName##RingBuffer funcprefix##_rb_new(const size_t size) \
-{ \
- assert(size != 0); \
- RBType *buf = xmalloc(size * sizeof(RBType)); \
- return (TypeName##RingBuffer) { \
- .buf = buf, \
- .next = buf, \
- .first = NULL, \
- .buf_end = buf + size - 1, \
- }; \
-} \
- \
-static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
- REAL_FATTR_UNUSED; \
-static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
-{ \
- if (rb == NULL) { \
- return; \
- } \
- RINGBUF_FORALL(rb, RBType, rbitem) { \
- rbfree(rbitem); \
- } \
- xfree(rb->buf); \
-} \
- \
-static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
- REAL_FATTR_UNUSED; \
-static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
-{ \
- xfree(rb->buf); \
-} \
- \
-static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
- RBType item) \
- REAL_FATTR_NONNULL_ARG(1); \
-static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
- RBType item) \
-{ \
- if (rb->next == rb->first) { \
- rbfree(rb->first); \
- rb->first = _RINGBUF_NEXT(rb, rb->first); \
- } else if (rb->first == NULL) { \
- rb->first = rb->next; \
- } \
- *rb->next = item; \
- rb->next = _RINGBUF_NEXT(rb, rb->next); \
-} \
- \
-static inline ptrdiff_t funcprefix##_rb_find_idx( \
- const TypeName##RingBuffer *const rb, const RBType *const item_p) \
- REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
-static inline ptrdiff_t funcprefix##_rb_find_idx( \
- const TypeName##RingBuffer *const rb, const RBType *const item_p) \
-{ \
- assert(rb->buf <= item_p); \
- assert(rb->buf_end >= item_p); \
- if (rb->first == NULL) { \
- return -1; \
- } else if (item_p >= rb->first) { \
- return item_p - rb->first; \
- } else { \
- return item_p - rb->buf + rb->buf_end - rb->first + 1; \
- } \
-} \
- \
-static inline size_t funcprefix##_rb_size( \
- const TypeName##RingBuffer *const rb) \
- REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
-static inline size_t funcprefix##_rb_size( \
- const TypeName##RingBuffer *const rb) \
-{ \
- return (size_t) (rb->buf_end - rb->buf) + 1; \
-} \
- \
-static inline size_t funcprefix##_rb_length( \
- const TypeName##RingBuffer *const rb) \
- REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
-static inline size_t funcprefix##_rb_length( \
- const TypeName##RingBuffer *const rb) \
-{ \
- return _RINGBUF_LENGTH(rb); \
-} \
- \
-static inline RBType *funcprefix##_rb_idx_p( \
- const TypeName##RingBuffer *const rb, const size_t idx) \
- REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
-static inline RBType *funcprefix##_rb_idx_p( \
- const TypeName##RingBuffer *const rb, const size_t idx) \
-{ \
- assert(idx <= funcprefix##_rb_size(rb)); \
- assert(idx <= funcprefix##_rb_length(rb)); \
- if (rb->first + idx > rb->buf_end) { \
- return rb->buf + ((rb->first + idx) - (rb->buf_end + 1)); \
- } else { \
- return rb->first + idx; \
- } \
-} \
- \
+#define RINGBUF_INIT(TypeName, funcprefix, RBType, rbfree) \
+static inline TypeName##RingBuffer funcprefix##_rb_new(const size_t size) \
+ REAL_FATTR_WARN_UNUSED_RESULT; \
+static inline TypeName##RingBuffer funcprefix##_rb_new(const size_t size) \
+{ \
+ assert(size != 0); \
+ RBType *buf = xmalloc(size * sizeof(RBType)); \
+ return (TypeName##RingBuffer) { \
+ .buf = buf, \
+ .next = buf, \
+ .first = NULL, \
+ .buf_end = buf + size - 1, \
+ }; \
+} \
+\
+static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
+ REAL_FATTR_UNUSED; \
+static inline void funcprefix##_rb_free(TypeName##RingBuffer *const rb) \
+{ \
+ if (rb == NULL) { \
+ return; \
+ } \
+ RINGBUF_FORALL(rb, RBType, rbitem) { \
+ rbfree(rbitem); \
+ } \
+ xfree(rb->buf); \
+} \
+\
+static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
+ REAL_FATTR_UNUSED; \
+static inline void funcprefix##_rb_dealloc(TypeName##RingBuffer *const rb) \
+{ \
+ xfree(rb->buf); \
+} \
+\
+static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
+ RBType item) \
+ REAL_FATTR_NONNULL_ARG(1); \
+static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
+ RBType item) \
+{ \
+ if (rb->next == rb->first) { \
+ rbfree(rb->first); \
+ rb->first = _RINGBUF_NEXT(rb, rb->first); \
+ } else if (rb->first == NULL) { \
+ rb->first = rb->next; \
+ } \
+ *rb->next = item; \
+ rb->next = _RINGBUF_NEXT(rb, rb->next); \
+} \
+\
+static inline ptrdiff_t funcprefix##_rb_find_idx( \
+ const TypeName##RingBuffer *const rb, const RBType *const item_p) \
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
+static inline ptrdiff_t funcprefix##_rb_find_idx( \
+ const TypeName##RingBuffer *const rb, const RBType *const item_p) \
+{ \
+ assert(rb->buf <= item_p); \
+ assert(rb->buf_end >= item_p); \
+ if (rb->first == NULL) { \
+ return -1; \
+ } else if (item_p >= rb->first) { \
+ return item_p - rb->first; \
+ } else { \
+ return item_p - rb->buf + rb->buf_end - rb->first + 1; \
+ } \
+} \
+\
+static inline size_t funcprefix##_rb_size( \
+ const TypeName##RingBuffer *const rb) \
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
+static inline size_t funcprefix##_rb_size( \
+ const TypeName##RingBuffer *const rb) \
+{ \
+ return (size_t) (rb->buf_end - rb->buf) + 1; \
+} \
+\
+static inline size_t funcprefix##_rb_length( \
+ const TypeName##RingBuffer *const rb) \
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
+static inline size_t funcprefix##_rb_length( \
+ const TypeName##RingBuffer *const rb) \
+{ \
+ return _RINGBUF_LENGTH(rb); \
+} \
+\
+static inline RBType *funcprefix##_rb_idx_p( \
+ const TypeName##RingBuffer *const rb, const size_t idx) \
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
+static inline RBType *funcprefix##_rb_idx_p( \
+ const TypeName##RingBuffer *const rb, const size_t idx) \
+{ \
+ assert(idx <= funcprefix##_rb_size(rb)); \
+ assert(idx <= funcprefix##_rb_length(rb)); \
+ if (rb->first + idx > rb->buf_end) { \
+ return rb->buf + ((rb->first + idx) - (rb->buf_end + 1)); \
+ } else { \
+ return rb->first + idx; \
+ } \
+} \
+\
static inline RBType funcprefix##_rb_idx(const TypeName##RingBuffer *const rb, \
- const size_t idx) \
- REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
+ const size_t idx) \
+ REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
static inline RBType funcprefix##_rb_idx(const TypeName##RingBuffer *const rb, \
- const size_t idx) \
-{ \
- return *funcprefix##_rb_idx_p(rb, idx); \
-} \
- \
-static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
- const size_t idx, \
- RBType item) \
- REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \
-static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
- const size_t idx, \
- RBType item) \
-{ \
- assert(idx <= funcprefix##_rb_size(rb)); \
- assert(idx <= funcprefix##_rb_length(rb)); \
- const size_t length = funcprefix##_rb_length(rb); \
- if (idx == length) { \
- funcprefix##_rb_push(rb, item); \
- return; \
- } \
- RBType *const insertpos = funcprefix##_rb_idx_p(rb, idx); \
- if (insertpos == rb->next) { \
- funcprefix##_rb_push(rb, item); \
- return; \
- } \
- if (length == funcprefix##_rb_size(rb)) { \
- rbfree(rb->first); \
- } \
- if (insertpos < rb->next) { \
- memmove(insertpos + 1, insertpos, \
- (size_t) ((uintptr_t) rb->next - (uintptr_t) insertpos)); \
- } else { \
- assert(insertpos > rb->first); \
- assert(rb->next <= rb->first); \
- memmove(rb->buf + 1, rb->buf, \
- (size_t) ((uintptr_t) rb->next - (uintptr_t) rb->buf)); \
- *rb->buf = *rb->buf_end; \
- memmove(insertpos + 1, insertpos, \
+ const size_t idx) \
+{ \
+ return *funcprefix##_rb_idx_p(rb, idx); \
+} \
+\
+static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
+ const size_t idx, \
+ RBType item) \
+ REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \
+static inline void funcprefix##_rb_insert(TypeName##RingBuffer *const rb, \
+ const size_t idx, \
+ RBType item) \
+{ \
+ assert(idx <= funcprefix##_rb_size(rb)); \
+ assert(idx <= funcprefix##_rb_length(rb)); \
+ const size_t length = funcprefix##_rb_length(rb); \
+ if (idx == length) { \
+ funcprefix##_rb_push(rb, item); \
+ return; \
+ } \
+ RBType *const insertpos = funcprefix##_rb_idx_p(rb, idx); \
+ if (insertpos == rb->next) { \
+ funcprefix##_rb_push(rb, item); \
+ return; \
+ } \
+ if (length == funcprefix##_rb_size(rb)) { \
+ rbfree(rb->first); \
+ } \
+ if (insertpos < rb->next) { \
+ memmove(insertpos + 1, insertpos, \
+ (size_t) ((uintptr_t) rb->next - (uintptr_t) insertpos)); \
+ } else { \
+ assert(insertpos > rb->first); \
+ assert(rb->next <= rb->first); \
+ memmove(rb->buf + 1, rb->buf, \
+ (size_t) ((uintptr_t) rb->next - (uintptr_t) rb->buf)); \
+ *rb->buf = *rb->buf_end; \
+ memmove(insertpos + 1, insertpos, \
(size_t) ((uintptr_t) (rb->buf_end + 1) - (uintptr_t) insertpos)); \
- } \
- *insertpos = item; \
- if (length == funcprefix##_rb_size(rb)) { \
- rb->first = _RINGBUF_NEXT(rb, rb->first); \
- } \
- rb->next = _RINGBUF_NEXT(rb, rb->next); \
-} \
- \
-static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
- const size_t idx) \
- REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \
-static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
- const size_t idx) \
-{ \
- assert(idx < funcprefix##_rb_size(rb)); \
- assert(idx < funcprefix##_rb_length(rb)); \
- RBType *const rmpos = funcprefix##_rb_idx_p(rb, idx); \
- rbfree(rmpos); \
- if (rmpos == rb->next - 1) { \
- rb->next--; \
- if (rb->first == rb->next) { \
- rb->first = NULL; \
- rb->next = rb->buf; \
- } \
- } else if (rmpos == rb->first) { \
- rb->first = _RINGBUF_NEXT(rb, rb->first); \
- if (rb->first == rb->next) { \
- rb->first = NULL; \
- rb->next = rb->buf; \
- } \
- } else if (rb->first < rb->next || rb->next == rb->buf) { \
- assert(rmpos > rb->first); \
- assert(rmpos <= _RINGBUF_PREV(rb, rb->next)); \
- memmove(rb->first + 1, rb->first, \
- (size_t) ((uintptr_t) rmpos - (uintptr_t) rb->first)); \
- rb->first = _RINGBUF_NEXT(rb, rb->first); \
- } else if (rmpos < rb->next) { \
- memmove(rmpos, rmpos + 1, \
- (size_t) ((uintptr_t) rb->next - (uintptr_t) rmpos)); \
- rb->next = _RINGBUF_PREV(rb, rb->next); \
- } else { \
- assert(rb->first < rb->buf_end); \
- memmove(rb->first + 1, rb->first, \
- (size_t) ((uintptr_t) rmpos - (uintptr_t) rb->first)); \
- rb->first = _RINGBUF_NEXT(rb, rb->first); \
- } \
+ } \
+ *insertpos = item; \
+ if (length == funcprefix##_rb_size(rb)) { \
+ rb->first = _RINGBUF_NEXT(rb, rb->first); \
+ } \
+ rb->next = _RINGBUF_NEXT(rb, rb->next); \
+} \
+\
+static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
+ const size_t idx) \
+ REAL_FATTR_NONNULL_ARG(1) REAL_FATTR_UNUSED; \
+static inline void funcprefix##_rb_remove(TypeName##RingBuffer *const rb, \
+ const size_t idx) \
+{ \
+ assert(idx < funcprefix##_rb_size(rb)); \
+ assert(idx < funcprefix##_rb_length(rb)); \
+ RBType *const rmpos = funcprefix##_rb_idx_p(rb, idx); \
+ rbfree(rmpos); \
+ if (rmpos == rb->next - 1) { \
+ rb->next--; \
+ if (rb->first == rb->next) { \
+ rb->first = NULL; \
+ rb->next = rb->buf; \
+ } \
+ } else if (rmpos == rb->first) { \
+ rb->first = _RINGBUF_NEXT(rb, rb->first); \
+ if (rb->first == rb->next) { \
+ rb->first = NULL; \
+ rb->next = rb->buf; \
+ } \
+ } else if (rb->first < rb->next || rb->next == rb->buf) { \
+ assert(rmpos > rb->first); \
+ assert(rmpos <= _RINGBUF_PREV(rb, rb->next)); \
+ memmove(rb->first + 1, rb->first, \
+ (size_t) ((uintptr_t) rmpos - (uintptr_t) rb->first)); \
+ rb->first = _RINGBUF_NEXT(rb, rb->first); \
+ } else if (rmpos < rb->next) { \
+ memmove(rmpos, rmpos + 1, \
+ (size_t) ((uintptr_t) rb->next - (uintptr_t) rmpos)); \
+ rb->next = _RINGBUF_PREV(rb, rb->next); \
+ } else { \
+ assert(rb->first < rb->buf_end); \
+ memmove(rb->first + 1, rb->first, \
+ (size_t) ((uintptr_t) rmpos - (uintptr_t) rb->first)); \
+ rb->first = _RINGBUF_NEXT(rb, rb->first); \
+ } \
}
#endif // NVIM_LIB_RINGBUF_H
diff --git a/src/nvim/log.c b/src/nvim/log.c
index 773d497881..c31af6b287 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -10,7 +10,14 @@
#include "nvim/os/os.h"
#include "nvim/os/time.h"
-#define USR_LOG_FILE "$HOME" _PATHSEPSTR ".nvimlog"
+/// First location of the log file used by log_path_init()
+#define USR_LOG_FILE "$NVIM_LOG_FILE"
+
+/// Fall back location of the log file used by log_path_init()
+#define USR_LOG_FILE_2 "$HOME" _PATHSEPSTR ".nvimlog"
+
+/// Cached location of the log file set by log_path_init()
+static char expanded_log_file_path[MAXPATHL + 1] = { 0 };
static uv_mutex_t mutex;
@@ -18,6 +25,35 @@ static uv_mutex_t mutex;
# include "log.c.generated.h"
#endif
+/// Initialize path to log file
+///
+/// Tries to use #USR_LOG_FILE, then falls back #USR_LOG_FILE_2. Path to log
+/// file is cached, so only the first call has effect, unless first call was not
+/// successful. To make initialization not succeed either a bug in expand_env()
+/// is needed or both `$NVIM_LOG_FILE` and `$HOME` environment variables
+/// undefined.
+///
+/// @return true if path was initialized, false otherwise.
+static bool log_path_init(void)
+{
+ if (expanded_log_file_path[0]) {
+ return true;
+ }
+ expand_env((char_u *)USR_LOG_FILE, (char_u *)expanded_log_file_path,
+ sizeof(expanded_log_file_path) - 1);
+ // if the log file path expansion failed then fall back to stderr
+ if (strcmp(USR_LOG_FILE, expanded_log_file_path) == 0) {
+ memset(expanded_log_file_path, 0, sizeof(expanded_log_file_path));
+ expand_env((char_u *)USR_LOG_FILE_2, (char_u *)expanded_log_file_path,
+ sizeof(expanded_log_file_path) - 1);
+ if (strcmp(USR_LOG_FILE_2, expanded_log_file_path) == 0) {
+ memset(expanded_log_file_path, 0, sizeof(expanded_log_file_path));
+ return false;
+ }
+ }
+ return true;
+}
+
void log_init(void)
{
uv_mutex_init(&mutex);
@@ -73,30 +109,17 @@ FILE *open_log_file(void)
return stderr;
}
- // expand USR_LOG_FILE and open the file
- FILE *log_file;
+ // expand USR_LOG_FILE if needed and open the file
+ FILE *log_file = NULL;
opening_log_file = true;
- {
- static char expanded_log_file_path[MAXPATHL + 1];
-
- expand_env((char_u *)USR_LOG_FILE, (char_u *)expanded_log_file_path,
- MAXPATHL);
- // if the log file path expansion failed then fall back to stderr
- if (strcmp(USR_LOG_FILE, expanded_log_file_path) == 0) {
- goto open_log_file_error;
- }
-
+ if (log_path_init()) {
log_file = fopen(expanded_log_file_path, "a");
- if (log_file == NULL) {
- goto open_log_file_error;
- }
}
opening_log_file = false;
- return log_file;
-
-open_log_file_error:
- opening_log_file = false;
+ if (log_file != NULL) {
+ return log_file;
+ }
do_log_to_file(stderr, ERROR_LOG_LEVEL, __func__, __LINE__, true,
"Couldn't open USR_LOG_FILE, logging to stderr! This may be "
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 71a972e8f6..ba545c0815 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -120,6 +120,8 @@ typedef struct {
# include "main.c.generated.h"
#endif
+Loop main_loop;
+
static char *argv0;
// Error messages
@@ -133,7 +135,7 @@ static const char *err_extra_cmd =
void event_init(void)
{
- loop_init(&loop, NULL);
+ loop_init(&main_loop, NULL);
// early msgpack-rpc initialization
msgpack_rpc_init_method_table();
msgpack_rpc_helpers_init();
@@ -151,19 +153,20 @@ void event_init(void)
void event_teardown(void)
{
- if (!loop.events) {
+ if (!main_loop.events) {
return;
}
- queue_process_events(loop.events);
+ queue_process_events(main_loop.events);
input_stop();
channel_teardown();
- process_teardown(&loop);
+ process_teardown(&main_loop);
+ timer_teardown();
server_teardown();
signal_teardown();
terminal_teardown();
- loop_close(&loop);
+ loop_close(&main_loop);
}
/// Performs early initialization.
diff --git a/src/nvim/main.h b/src/nvim/main.h
index 084e247b7e..86d25fe657 100644
--- a/src/nvim/main.h
+++ b/src/nvim/main.h
@@ -2,6 +2,9 @@
#define NVIM_MAIN_H
#include "nvim/normal.h"
+#include "nvim/event/loop.h"
+
+extern Loop main_loop;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "main.h.generated.h"
diff --git a/src/nvim/map.c b/src/nvim/map.c
index d4262ae9a8..03439e7a9c 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -34,88 +34,88 @@
#define INITIALIZER_DECLARE(T, U, ...) const U INITIALIZER(T, U) = __VA_ARGS__
#define DEFAULT_INITIALIZER {0}
-#define MAP_IMPL(T, U, ...) \
- INITIALIZER_DECLARE(T, U, __VA_ARGS__); \
- __KHASH_IMPL(T##_##U##_map,, T, U, 1, T##_hash, T##_eq) \
- \
- Map(T, U) *map_##T##_##U##_new() \
- { \
- Map(T, U) *rv = xmalloc(sizeof(Map(T, U))); \
- rv->table = kh_init(T##_##U##_map); \
- return rv; \
- } \
- \
- void map_##T##_##U##_free(Map(T, U) *map) \
- { \
- kh_destroy(T##_##U##_map, map->table); \
- xfree(map); \
- } \
- \
- U map_##T##_##U##_get(Map(T, U) *map, T key) \
- { \
- khiter_t k; \
- \
+#define MAP_IMPL(T, U, ...) \
+ INITIALIZER_DECLARE(T, U, __VA_ARGS__); \
+ __KHASH_IMPL(T##_##U##_map,, T, U, 1, T##_hash, T##_eq) \
+ \
+ Map(T, U) *map_##T##_##U##_new() \
+ { \
+ Map(T, U) *rv = xmalloc(sizeof(Map(T, U))); \
+ rv->table = kh_init(T##_##U##_map); \
+ return rv; \
+ } \
+ \
+ void map_##T##_##U##_free(Map(T, U) *map) \
+ { \
+ kh_destroy(T##_##U##_map, map->table); \
+ xfree(map); \
+ } \
+ \
+ U map_##T##_##U##_get(Map(T, U) *map, T key) \
+ { \
+ khiter_t k; \
+ \
if ((k = kh_get(T##_##U##_map, map->table, key)) == kh_end(map->table)) { \
- return INITIALIZER(T, U); \
- } \
- \
- return kh_val(map->table, k); \
- } \
- \
- bool map_##T##_##U##_has(Map(T, U) *map, T key) \
- { \
- return kh_get(T##_##U##_map, map->table, key) != kh_end(map->table); \
- } \
- \
- U map_##T##_##U##_put(Map(T, U) *map, T key, U value) \
- { \
- int ret; \
- U rv = INITIALIZER(T, U); \
- khiter_t k = kh_put(T##_##U##_map, map->table, key, &ret); \
- \
- if (!ret) { \
- rv = kh_val(map->table, k); \
- } \
- \
- kh_val(map->table, k) = value; \
- return rv; \
- } \
- \
- U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put) \
- { \
- int ret; \
- khiter_t k; \
- if (put) { \
- k = kh_put(T##_##U##_map, map->table, key, &ret); \
- if (ret) { \
- kh_val(map->table, k) = INITIALIZER(T, U); \
- } \
- } else { \
- k = kh_get(T##_##U##_map, map->table, key); \
- if (k == kh_end(map->table)) { \
- return NULL; \
- } \
- } \
- \
- return &kh_val(map->table, k); \
- } \
- \
- U map_##T##_##U##_del(Map(T, U) *map, T key) \
- { \
- U rv = INITIALIZER(T, U); \
- khiter_t k; \
- \
+ return INITIALIZER(T, U); \
+ } \
+ \
+ return kh_val(map->table, k); \
+ } \
+ \
+ bool map_##T##_##U##_has(Map(T, U) *map, T key) \
+ { \
+ return kh_get(T##_##U##_map, map->table, key) != kh_end(map->table); \
+ } \
+ \
+ U map_##T##_##U##_put(Map(T, U) *map, T key, U value) \
+ { \
+ int ret; \
+ U rv = INITIALIZER(T, U); \
+ khiter_t k = kh_put(T##_##U##_map, map->table, key, &ret); \
+ \
+ if (!ret) { \
+ rv = kh_val(map->table, k); \
+ } \
+ \
+ kh_val(map->table, k) = value; \
+ return rv; \
+ } \
+ \
+ U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put) \
+ { \
+ int ret; \
+ khiter_t k; \
+ if (put) { \
+ k = kh_put(T##_##U##_map, map->table, key, &ret); \
+ if (ret) { \
+ kh_val(map->table, k) = INITIALIZER(T, U); \
+ } \
+ } else { \
+ k = kh_get(T##_##U##_map, map->table, key); \
+ if (k == kh_end(map->table)) { \
+ return NULL; \
+ } \
+ } \
+ \
+ return &kh_val(map->table, k); \
+ } \
+ \
+ U map_##T##_##U##_del(Map(T, U) *map, T key) \
+ { \
+ U rv = INITIALIZER(T, U); \
+ khiter_t k; \
+ \
if ((k = kh_get(T##_##U##_map, map->table, key)) != kh_end(map->table)) { \
- rv = kh_val(map->table, k); \
- kh_del(T##_##U##_map, map->table, k); \
- } \
- \
- return rv; \
- } \
- \
- void map_##T##_##U##_clear(Map(T, U) *map) \
- { \
- kh_clear(T##_##U##_map, map->table); \
+ rv = kh_val(map->table, k); \
+ kh_del(T##_##U##_map, map->table, k); \
+ } \
+ \
+ return rv; \
+ } \
+ \
+ void map_##T##_##U##_clear(Map(T, U) *map) \
+ { \
+ kh_clear(T##_##U##_map, map->table); \
}
static inline khint_t String_hash(String s)
diff --git a/src/nvim/map.h b/src/nvim/map.h
index e90cc360ce..c7d9894bd1 100644
--- a/src/nvim/map.h
+++ b/src/nvim/map.h
@@ -8,20 +8,20 @@
#include "nvim/msgpack_rpc/defs.h"
#include "nvim/bufhl_defs.h"
-#define MAP_DECLS(T, U) \
- KHASH_DECLARE(T##_##U##_map, T, U) \
- \
- typedef struct { \
- khash_t(T##_##U##_map) *table; \
- } Map(T, U); \
- \
- Map(T, U) *map_##T##_##U##_new(void); \
- void map_##T##_##U##_free(Map(T, U) *map); \
- U map_##T##_##U##_get(Map(T, U) *map, T key); \
- bool map_##T##_##U##_has(Map(T, U) *map, T key); \
- U map_##T##_##U##_put(Map(T, U) *map, T key, U value); \
- U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put); \
- U map_##T##_##U##_del(Map(T, U) *map, T key); \
+#define MAP_DECLS(T, U) \
+ KHASH_DECLARE(T##_##U##_map, T, U) \
+ \
+ typedef struct { \
+ khash_t(T##_##U##_map) *table; \
+ } Map(T, U); \
+ \
+ Map(T, U) *map_##T##_##U##_new(void); \
+ void map_##T##_##U##_free(Map(T, U) *map); \
+ U map_##T##_##U##_get(Map(T, U) *map, T key); \
+ bool map_##T##_##U##_has(Map(T, U) *map, T key); \
+ U map_##T##_##U##_put(Map(T, U) *map, T key, U value); \
+ U *map_##T##_##U##_ref(Map(T, U) *map, T key, bool put); \
+ U map_##T##_##U##_del(Map(T, U) *map, T key); \
void map_##T##_##U##_clear(Map(T, U) *map);
MAP_DECLS(int, int)
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 3495203c43..0ba9f8b076 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1304,7 +1304,7 @@ int utfc_ptr2char(const char_u *p, int *pcc)
*/
int utfc_ptr2char_len(const char_u *p, int *pcc, int maxlen)
{
-#define IS_COMPOSING(s1, s2, s3) \
+#define IS_COMPOSING(s1, s2, s3) \
(i == 0 ? UTF_COMPOSINGLIKE((s1), (s2)) : utf_iscomposing((s3)))
assert(maxlen > 0);
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 3a6d7c1434..0d7d5a247e 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -16,6 +16,7 @@
#include "nvim/event/socket.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/vim.h"
+#include "nvim/main.h"
#include "nvim/ascii.h"
#include "nvim/memory.h"
#include "nvim/os_unix.h"
@@ -119,7 +120,7 @@ void channel_teardown(void)
uint64_t channel_from_process(char **argv)
{
Channel *channel = register_channel(kChannelTypeProc);
- channel->data.process.uvproc = libuv_process_init(&loop, channel);
+ channel->data.process.uvproc = libuv_process_init(&main_loop, channel);
Process *proc = &channel->data.process.uvproc.process;
proc->argv = argv;
proc->in = &channel->data.process.in;
@@ -127,7 +128,7 @@ uint64_t channel_from_process(char **argv)
proc->err = &channel->data.process.err;
proc->cb = process_exit;
if (!process_spawn(proc)) {
- loop_poll_events(&loop, 0);
+ loop_poll_events(&main_loop, 0);
decref(channel);
return 0;
}
@@ -179,7 +180,7 @@ bool channel_send_event(uint64_t id, char *name, Array args)
// Pending request, queue the notification for later sending.
String method = cstr_as_string(name);
WBuffer *buffer = serialize_request(id, 0, method, args, &out_buffer, 1);
- kv_push(WBuffer *, channel->delayed_notifications, buffer);
+ kv_push(channel->delayed_notifications, buffer);
} else {
send_event(channel, name, args);
}
@@ -217,10 +218,10 @@ Object channel_send_call(uint64_t id,
send_request(channel, request_id, method_name, args);
// Push the frame
- ChannelCallFrame frame = {request_id, false, false, NIL};
- kv_push(ChannelCallFrame *, channel->call_stack, &frame);
+ ChannelCallFrame frame = { request_id, false, false, NIL };
+ kv_push(channel->call_stack, &frame);
channel->pending_requests++;
- LOOP_PROCESS_EVENTS_UNTIL(&loop, channel->events, -1, frame.returned);
+ LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, frame.returned);
(void)kv_pop(channel->call_stack);
channel->pending_requests--;
@@ -316,11 +317,11 @@ void channel_from_stdio(void)
Channel *channel = register_channel(kChannelTypeStdio);
incref(channel); // stdio channels are only closed on exit
// read stream
- rstream_init_fd(&loop, &channel->data.std.in, 0, CHANNEL_BUFFER_SIZE,
- channel);
+ rstream_init_fd(&main_loop, &channel->data.std.in, 0, CHANNEL_BUFFER_SIZE,
+ channel);
rstream_start(&channel->data.std.in, parse_msgpack);
// write stream
- wstream_init_fd(&loop, &channel->data.std.out, 1, 0, NULL);
+ wstream_init_fd(&main_loop, &channel->data.std.out, 1, 0, NULL);
}
static void forward_stderr(Stream *stream, RBuffer *rbuf, size_t count,
@@ -574,13 +575,12 @@ static void send_event(Channel *channel,
static void broadcast_event(char *name, Array args)
{
- kvec_t(Channel *) subscribed;
- kv_init(subscribed);
+ kvec_t(Channel *) subscribed = KV_INITIAL_VALUE;
Channel *channel;
map_foreach_value(channels, channel, {
if (pmap_has(cstr_t)(channel->subscribed_events, name)) {
- kv_push(Channel *, subscribed, channel);
+ kv_push(subscribed, channel);
}
});
@@ -600,7 +600,7 @@ static void broadcast_event(char *name, Array args)
for (size_t i = 0; i < kv_size(subscribed); i++) {
Channel *channel = kv_A(subscribed, i);
if (channel->pending_requests) {
- kv_push(WBuffer *, channel->delayed_notifications, buffer);
+ kv_push(channel->delayed_notifications, buffer);
} else {
channel_write(channel, buffer);
}
@@ -647,7 +647,7 @@ static void close_channel(Channel *channel)
case kChannelTypeStdio:
stream_close(&channel->data.std.in, NULL);
stream_close(&channel->data.std.out, NULL);
- queue_put(loop.fast_events, exit_event, 1, channel);
+ queue_put(main_loop.fast_events, exit_event, 1, channel);
return;
default:
abort();
@@ -692,7 +692,7 @@ static void close_cb(Stream *stream, void *data)
static Channel *register_channel(ChannelType type)
{
Channel *rv = xmalloc(sizeof(Channel));
- rv->events = queue_new_child(loop.events);
+ rv->events = queue_new_child(main_loop.events);
rv->type = type;
rv->refcount = 1;
rv->closed = false;
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index 0049ae6b95..c643bae0e8 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -18,39 +18,39 @@
static msgpack_zone zone;
static msgpack_sbuffer sbuffer;
-#define HANDLE_TYPE_CONVERSION_IMPL(t, lt) \
- bool msgpack_rpc_to_##lt(msgpack_object *obj, t *arg) \
- FUNC_ATTR_NONNULL_ALL \
- { \
- if (obj->type != MSGPACK_OBJECT_EXT \
- || obj->via.ext.type != kObjectType##t) { \
- return false; \
- } \
- \
- msgpack_object data; \
- msgpack_unpack_return ret = msgpack_unpack(obj->via.ext.ptr, \
- obj->via.ext.size, \
- NULL, \
- &zone, \
- &data); \
- \
- if (ret != MSGPACK_UNPACK_SUCCESS) { \
- return false; \
- } \
- \
- *arg = data.via.u64; \
- return true; \
- } \
- \
- void msgpack_rpc_from_##lt(t o, msgpack_packer *res) \
- FUNC_ATTR_NONNULL_ARG(2) \
- { \
- msgpack_packer pac; \
- msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \
- msgpack_pack_uint64(&pac, o); \
- msgpack_pack_ext(res, sbuffer.size, kObjectType##t); \
- msgpack_pack_ext_body(res, sbuffer.data, sbuffer.size); \
- msgpack_sbuffer_clear(&sbuffer); \
+#define HANDLE_TYPE_CONVERSION_IMPL(t, lt) \
+ bool msgpack_rpc_to_##lt(msgpack_object *obj, t *arg) \
+ FUNC_ATTR_NONNULL_ALL \
+ { \
+ if (obj->type != MSGPACK_OBJECT_EXT \
+ || obj->via.ext.type != kObjectType##t) { \
+ return false; \
+ } \
+ \
+ msgpack_object data; \
+ msgpack_unpack_return ret = msgpack_unpack(obj->via.ext.ptr, \
+ obj->via.ext.size, \
+ NULL, \
+ &zone, \
+ &data); \
+ \
+ if (ret != MSGPACK_UNPACK_SUCCESS) { \
+ return false; \
+ } \
+ \
+ *arg = data.via.u64; \
+ return true; \
+ } \
+ \
+ void msgpack_rpc_from_##lt(t o, msgpack_packer *res) \
+ FUNC_ATTR_NONNULL_ARG(2) \
+ { \
+ msgpack_packer pac; \
+ msgpack_packer_init(&pac, &sbuffer, msgpack_sbuffer_write); \
+ msgpack_pack_uint64(&pac, o); \
+ msgpack_pack_ext(res, sbuffer.size, kObjectType##t); \
+ msgpack_pack_ext_body(res, sbuffer.data, sbuffer.size); \
+ msgpack_sbuffer_clear(&sbuffer); \
}
void msgpack_rpc_helpers_init(void)
diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c
index 6cc56ba3dd..abbd3e8aff 100644
--- a/src/nvim/msgpack_rpc/server.c
+++ b/src/nvim/msgpack_rpc/server.c
@@ -12,6 +12,7 @@
#include "nvim/eval.h"
#include "nvim/garray.h"
#include "nvim/vim.h"
+#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/log.h"
#include "nvim/fileio.h"
@@ -108,7 +109,7 @@ int server_start(const char *endpoint)
}
SocketWatcher *watcher = xmalloc(sizeof(SocketWatcher));
- socket_watcher_init(&loop, watcher, endpoint, NULL);
+ socket_watcher_init(&main_loop, watcher, endpoint, NULL);
// Check if a watcher for the endpoint already exists
for (int i = 0; i < watchers.ga_len; i++) {
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 6baf95739d..c95e5e1a15 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -974,7 +974,7 @@ static int normal_execute(VimState *state, int key)
s->old_col = curwin->w_curswant;
s->c = key;
- LANGMAP_ADJUST(s->c, true);
+ LANGMAP_ADJUST(s->c, get_real_state() != SELECTMODE);
// If a mapping was started in Visual or Select mode, remember the length
// of the mapping. This is used below to not return to Insert mode for as
@@ -7880,7 +7880,7 @@ static void nv_event(cmdarg_T *cap)
// not safe to perform garbage collection because there could be unreferenced
// lists or dicts being used.
may_garbage_collect = false;
- queue_process_events(loop.events);
+ queue_process_events(main_loop.events);
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index ba4f390828..ac906d82ad 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2129,6 +2129,7 @@ void check_buf_options(buf_T *buf)
check_string_option(&buf->b_p_nf);
check_string_option(&buf->b_p_qe);
check_string_option(&buf->b_p_syn);
+ check_string_option(&buf->b_s.b_syn_isk);
check_string_option(&buf->b_s.b_p_spc);
check_string_option(&buf->b_s.b_p_spf);
check_string_option(&buf->b_s.b_p_spl);
@@ -5607,6 +5608,7 @@ void buf_copy_options(buf_T *buf, int flags)
/* Don't copy 'syntax', it must be set */
buf->b_p_syn = empty_option;
buf->b_p_smc = p_smc;
+ buf->b_s.b_syn_isk = empty_option;
buf->b_s.b_p_spc = vim_strsave(p_spc);
(void)compile_cap_prog(&buf->b_s);
buf->b_s.b_p_spf = vim_strsave(p_spf);
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 143a7160b0..08122828bd 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -398,7 +398,6 @@ int os_setperm(const char_u *name, int perm)
/// @note If the `owner` or `group` is specified as `-1`, then that ID is not
/// changed.
int os_fchown(int file_descriptor, uv_uid_t owner, uv_gid_t group)
- FUNC_ATTR_NONNULL_ALL
{
uv_fs_t request;
int result = uv_fs_fchown(&fs_loop, &request, file_descriptor,
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 7687b14f02..0c46dc96ee 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -60,7 +60,7 @@ void input_start(int fd)
}
global_fd = fd;
- rstream_init_fd(&loop, &read_stream, fd, READ_BUFFER_SIZE, NULL);
+ rstream_init_fd(&main_loop, &read_stream, fd, READ_BUFFER_SIZE, NULL);
rstream_start(&read_stream, read_cb);
}
@@ -87,8 +87,8 @@ static void create_cursorhold_event(void)
// have been called(inbuf_poll would return kInputAvail)
// TODO(tarruda): Cursorhold should be implemented as a timer set during the
// `state_check` callback for the states where it can be triggered.
- assert(!events_enabled || queue_empty(loop.events));
- queue_put(loop.events, cursorhold_event, 0);
+ assert(!events_enabled || queue_empty(main_loop.events));
+ queue_put(main_loop.events, cursorhold_event, 0);
}
// Low level input function
@@ -147,7 +147,7 @@ bool os_char_avail(void)
void os_breakcheck(void)
{
if (!got_int) {
- loop_poll_events(&loop, 0);
+ loop_poll_events(&main_loop, 0);
}
}
@@ -322,7 +322,7 @@ static bool input_poll(int ms)
prof_inchar_enter();
}
- LOOP_PROCESS_EVENTS_UNTIL(&loop, NULL, ms, input_ready() || input_eof);
+ LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, ms, input_ready() || input_eof);
if (do_profiling == PROF_YES && ms) {
prof_inchar_exit();
@@ -419,5 +419,5 @@ static void read_error_exit(void)
static bool pending_events(void)
{
- return events_enabled && !queue_empty(loop.events);
+ return events_enabled && !queue_empty(main_loop.events);
}
diff --git a/src/nvim/os/pty_process.h b/src/nvim/os/pty_process.h
new file mode 100644
index 0000000000..94923499ca
--- /dev/null
+++ b/src/nvim/os/pty_process.h
@@ -0,0 +1,9 @@
+#ifndef NVIM_OS_PTY_PROCESS_H
+#define NVIM_OS_PTY_PROCESS_H
+
+#ifdef WIN32
+# include "nvim/os/pty_process_win.h"
+#else
+# include "nvim/os/pty_process_unix.h"
+#endif
+#endif // NVIM_OS_PTY_PROCESS_H
diff --git a/src/nvim/event/pty_process.c b/src/nvim/os/pty_process_unix.c
index 8eef72f12f..436de030ba 100644
--- a/src/nvim/event/pty_process.c
+++ b/src/nvim/os/pty_process_unix.c
@@ -26,11 +26,12 @@
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/process.h"
-#include "nvim/event/pty_process.h"
+#include "nvim/os/pty_process_unix.h"
#include "nvim/log.h"
+#include "nvim/os/os.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "event/pty_process.c.generated.h"
+# include "os/pty_process_unix.c.generated.h"
#endif
bool pty_process_spawn(PtyProcess *ptyproc)
@@ -44,7 +45,7 @@ bool pty_process_spawn(PtyProcess *ptyproc)
Process *proc = (Process *)ptyproc;
assert(!proc->err);
uv_signal_start(&proc->loop->children_watcher, chld_handler, SIGCHLD);
- ptyproc->winsize = (struct winsize){ptyproc->height, ptyproc->width, 0, 0};
+ ptyproc->winsize = (struct winsize){ ptyproc->height, ptyproc->width, 0, 0 };
uv_disable_stdio_inheritance();
int master;
int pid = forkpty(&master, NULL, &termios, &ptyproc->winsize);
@@ -86,11 +87,10 @@ error:
return false;
}
-void pty_process_resize(PtyProcess *ptyproc, uint16_t width,
- uint16_t height)
+void pty_process_resize(PtyProcess *ptyproc, uint16_t width, uint16_t height)
FUNC_ATTR_NONNULL_ALL
{
- ptyproc->winsize = (struct winsize){height, width, 0, 0};
+ ptyproc->winsize = (struct winsize){ height, width, 0, 0 };
ioctl(ptyproc->tty_fd, TIOCSWINSZ, &ptyproc->winsize);
}
@@ -132,6 +132,12 @@ static void init_child(PtyProcess *ptyproc) FUNC_ATTR_NONNULL_ALL
signal(SIGTERM, SIG_DFL);
signal(SIGALRM, SIG_DFL);
+ Process *proc = (Process *)ptyproc;
+ if (proc->cwd && os_chdir(proc->cwd) != 0) {
+ fprintf(stderr, "chdir failed: %s\n", strerror(errno));
+ return;
+ }
+
setenv("TERM", ptyproc->term_name ? ptyproc->term_name : "ansi", 1);
execvp(ptyproc->process.argv[0], ptyproc->process.argv);
fprintf(stderr, "execvp failed: %s\n", strerror(errno));
diff --git a/src/nvim/event/pty_process.h b/src/nvim/os/pty_process_unix.h
index 446d7fd3c8..f7c57b3839 100644
--- a/src/nvim/event/pty_process.h
+++ b/src/nvim/os/pty_process_unix.h
@@ -1,5 +1,5 @@
-#ifndef NVIM_EVENT_PTY_PROCESS_H
-#define NVIM_EVENT_PTY_PROCESS_H
+#ifndef NVIM_OS_PTY_PROCESS_UNIX_H
+#define NVIM_OS_PTY_PROCESS_UNIX_H
#include <sys/ioctl.h>
@@ -25,6 +25,7 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data)
}
#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "event/pty_process.h.generated.h"
+# include "os/pty_process_unix.h.generated.h"
#endif
-#endif // NVIM_EVENT_PTY_PROCESS_H
+
+#endif // NVIM_OS_PTY_PROCESS_UNIX_H
diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h
new file mode 100644
index 0000000000..20cc589925
--- /dev/null
+++ b/src/nvim/os/pty_process_win.h
@@ -0,0 +1,28 @@
+#ifndef NVIM_OS_PTY_PROCESS_WIN_H
+#define NVIM_OS_PTY_PROCESS_WIN_H
+
+#include "nvim/event/libuv_process.h"
+
+typedef struct pty_process {
+ Process process;
+ char *term_name;
+ uint16_t width, height;
+} PtyProcess;
+
+#define pty_process_spawn(job) libuv_process_spawn((LibuvProcess *)job)
+#define pty_process_close(job) libuv_process_close((LibuvProcess *)job)
+#define pty_process_close_master(job) libuv_process_close((LibuvProcess *)job)
+#define pty_process_resize(job, width, height)
+#define pty_process_teardown(loop)
+
+static inline PtyProcess pty_process_init(Loop *loop, void *data)
+{
+ PtyProcess rv;
+ rv.process = process_init(loop, kProcessTypePty, data);
+ rv.term_name = NULL;
+ rv.width = 80;
+ rv.height = 24;
+ return rv;
+}
+
+#endif // NVIM_OS_PTY_PROCESS_WIN_H
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index f5a1637c94..988620b145 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -14,6 +14,7 @@
#include "nvim/os/shell.h"
#include "nvim/os/signal.h"
#include "nvim/types.h"
+#include "nvim/main.h"
#include "nvim/vim.h"
#include "nvim/message.h"
#include "nvim/memory.h"
@@ -205,16 +206,16 @@ static int do_os_system(char **argv,
xstrlcpy(prog, argv[0], MAXPATHL);
Stream in, out, err;
- LibuvProcess uvproc = libuv_process_init(&loop, &buf);
+ LibuvProcess uvproc = libuv_process_init(&main_loop, &buf);
Process *proc = &uvproc.process;
- Queue *events = queue_new_child(loop.events);
+ Queue *events = queue_new_child(main_loop.events);
proc->events = events;
proc->argv = argv;
proc->in = input != NULL ? &in : NULL;
proc->out = &out;
proc->err = &err;
if (!process_spawn(proc)) {
- loop_poll_events(&loop, 0);
+ loop_poll_events(&main_loop, 0);
// Failed, probably due to `sh` not being executable
if (!silent) {
MSG_PUTS(_("\nCannot execute "));
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 0ff6016e32..4abc9cfc36 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -8,6 +8,7 @@
#include "nvim/globals.h"
#include "nvim/memline.h"
#include "nvim/eval.h"
+#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/misc1.h"
#include "nvim/misc2.h"
@@ -28,10 +29,10 @@ static bool rejecting_deadly;
void signal_init(void)
{
- signal_watcher_init(&loop, &spipe, NULL);
- signal_watcher_init(&loop, &shup, NULL);
- signal_watcher_init(&loop, &squit, NULL);
- signal_watcher_init(&loop, &sterm, NULL);
+ signal_watcher_init(&main_loop, &spipe, NULL);
+ signal_watcher_init(&main_loop, &shup, NULL);
+ signal_watcher_init(&main_loop, &squit, NULL);
+ signal_watcher_init(&main_loop, &sterm, NULL);
#ifdef SIGPIPE
signal_watcher_start(&spipe, on_signal, SIGPIPE);
#endif
@@ -41,7 +42,7 @@ void signal_init(void)
#endif
signal_watcher_start(&sterm, on_signal, SIGTERM);
#ifdef SIGPWR
- signal_watcher_init(&loop, &spwr, NULL);
+ signal_watcher_init(&main_loop, &spwr, NULL);
signal_watcher_start(&spwr, on_signal, SIGPWR);
#endif
}
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c
index 188f0802c9..2205ad0958 100644
--- a/src/nvim/os/time.c
+++ b/src/nvim/os/time.c
@@ -9,6 +9,7 @@
#include "nvim/os/time.h"
#include "nvim/event/loop.h"
#include "nvim/vim.h"
+#include "nvim/main.h"
static uv_mutex_t delay_mutex;
static uv_cond_t delay_cond;
@@ -43,7 +44,7 @@ void os_delay(uint64_t milliseconds, bool ignoreinput)
if (milliseconds > INT_MAX) {
milliseconds = INT_MAX;
}
- LOOP_PROCESS_EVENTS_UNTIL(&loop, NULL, (int)milliseconds, got_int);
+ LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, (int)milliseconds, got_int);
} else {
os_microdelay(milliseconds * 1000);
}
diff --git a/src/nvim/po/eo.po b/src/nvim/po/eo.po
index 5b0cb2260b..6bc76506ae 100644
--- a/src/nvim/po/eo.po
+++ b/src/nvim/po/eo.po
@@ -23,8 +23,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim(Esperanto)\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-07-30 17:54+0200\n"
-"PO-Revision-Date: 2015-07-30 18:00+0200\n"
+"POT-Creation-Date: 2016-02-13 23:42+0100\n"
+"PO-Revision-Date: 2016-02-13 23:45+0100\n"
"Last-Translator: Dominique PELLÉ <dominique.pelle@gmail.com>\n"
"Language-Team: \n"
"Language: eo\n"
@@ -504,10 +504,6 @@ msgstr "E686: Argumento de %s devas esti Listo"
msgid "E712: Argument of %s must be a List or Dictionary"
msgstr "E712: Argumento de %s devas esti Listo aÅ­ Vortaro"
-#: ../eval.c:144
-msgid "E713: Cannot use empty key for Dictionary"
-msgstr "E713: Ne eblas uzi malplenan Ålosilon de Vortaro"
-
#: ../eval.c:145
msgid "E714: List required"
msgstr "E714: Listo bezonata"
@@ -657,6 +653,9 @@ msgstr "E110: Mankas ')'"
msgid "E695: Cannot index a Funcref"
msgstr "E695: Ne eblas indeksi Funcref"
+msgid "E909: Cannot index a special variable"
+msgstr "E909: Ne eblas indeksi specialan variablon"
+
#: ../eval.c:4839
#, c-format
msgid "E112: Option name missing: %s"
@@ -689,7 +688,7 @@ msgstr "E697: Mankas fino de Listo ']': %s"
#: ../eval.c:5750
msgid "Not enough memory to set references, garbage collection aborted!"
-msgstr "Ne sufiĉa memory por valorigi referencojn, senrubigado ĉesigita!"
+msgstr "Ne sufiĉa memoro por valorigi referencojn, senrubigado ĉesigita!"
#: ../eval.c:6475
#, c-format
@@ -874,6 +873,18 @@ msgstr "E745: Uzo de Listo kiel Nombro"
msgid "E728: Using a Dictionary as a Number"
msgstr "E728: Uzo de Vortaro kiel Nombro"
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: Uzo de Funcref kiel Glitpunktnombro"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: Uzo de Ĉeno kiel Glitpunktnombro"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: Uzo de Listo kiel Glitpunktnombro"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: Uzo de Vortaro kiel Glitpunktnombro"
+
#: ../eval.c:16259
msgid "E729: using Funcref as a String"
msgstr "E729: uzo de Funcref kiel Ĉeno"
@@ -886,6 +897,9 @@ msgstr "E730: uzo de Listo kiel Ĉeno"
msgid "E731: using Dictionary as a String"
msgstr "E731: uzo de Vortaro kiel Ĉeno"
+msgid "E908: using an invalid value as a String"
+msgstr "E908: uzo de nevalida valoro kiel Ĉeno"
+
#: ../eval.c:16619
#, c-format
msgid "E706: Variable type mismatch for: %s"
@@ -1391,6 +1405,13 @@ msgstr "linio %<PRId64>: %s"
msgid "cmd: %s"
msgstr "kmd: %s"
+msgid "frame is zero"
+msgstr "kadro estas nul"
+
+#, c-format
+msgid "frame at highest level: %d"
+msgstr "kadro je la plej alta nivelo: %d"
+
#: ../ex_cmds2.c:322
#, c-format
msgid "Breakpoint in \"%s%s\" line %<PRId64>"
@@ -2861,6 +2882,9 @@ msgstr "E46: Ne eblas ÅanÄi nurlegeblan variablon \"%s\""
msgid "E794: Cannot set variable in the sandbox: \"%s\""
msgstr "E794: Ne eblas agordi variablon en la sabloludejo: \"%s\""
+msgid "E713: Cannot use empty key for Dictionary"
+msgstr "E713: Ne eblas uzi malplenan Ålosilon de Vortaro"
+
#: ../globals.h:1076
msgid "E47: Error while reading errorfile"
msgstr "E47: Eraro dum legado de erardosiero"
@@ -4090,12 +4114,12 @@ msgid ""
"\n"
"(1) Another program may be editing the same file. If this is the case,\n"
" be careful not to end up with two different instances of the same\n"
-" file when making changes."
+" file when making changes. Quit, or continue with caution.\n"
msgstr ""
"\n"
-"(1) Alia programo eble redaktas la saman dosieron.\n"
-" Se jes, estu singarda por ne havi du malsamajn\n"
-" aperojn de la sama dosiero, kiam vi faros ÅanÄojn."
+"(1) Alia programo eble redaktas la saman dosieron. Se jes, estu singarda\n"
+" por ne havi du malsamajn aperojn de la sama dosiero, kiam vi faros\n"
+" ÅanÄojn. Eliru aÅ­ daÅ­rigu singarde.\n"
#: ../memline.c:3245
msgid " Quit, or continue with caution.\n"
@@ -4792,6 +4816,15 @@ msgstr ""
"\n"
"Ne povis Åalti kuntekston de sekureco por "
+#, c-format
+msgid "Could not set security context %s for %s"
+msgstr "Ne povis Åalti kuntekston de sekureco %s por %s"
+
+#, c-format
+msgid "Could not get security context %s for %s. Removing it!"
+msgstr ""
+"Ne povis akiri kuntekston de sekureco %s por %s. Gi nun estas forigata!"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -5717,6 +5750,9 @@ msgstr "Neniu sintaksa elemento difinita por tiu bufro"
msgid "E390: Illegal argument: %s"
msgstr "E390: Nevalida argumento: %s"
+msgid "syntax iskeyword "
+msgstr "sintakso iskeyword "
+
#: ../syntax.c:3299
#, c-format
msgid "E391: No such syntax cluster: %s"
@@ -5813,6 +5849,10 @@ msgstr "E847: Tro da sintaksaj inkluzivoj"
msgid "E789: Missing ']': %s"
msgstr "E789: Mankas ']': %s"
+#, c-format
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: vosta signo post ']': %s]%s"
+
#: ../syntax.c:4531
#, c-format
msgid "E398: Missing '=': %s"
diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po
index 171e155689..084102da60 100644
--- a/src/nvim/po/it.po
+++ b/src/nvim/po/it.po
@@ -13,13 +13,13 @@ msgid ""
msgstr ""
"Project-Id-Version: vim 7.4\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-08-11 20:58+0200\n"
-"PO-Revision-Date: 2015-08-11 22:02+0200\n"
-"Last-Translator: Vlad Sandrini <vlad.gently@gmail.com>\n"
-"Language-Team: Italian Antonio Colombo <azc100@gmail."
-"com> Vlad Sandrini <vlad.gently@gmail."
-"com> Luciano Montanaro <mikelima@cirulla.net>\n"
-"Language: \n"
+"POT-Creation-Date: 2016-02-11 12:10+0100\n"
+"PO-Revision-Date: 2016-02-11 14:42+0200\n"
+"Last-Translator: Antonio Colombo <azc100@gmail.com>\n"
+"Language-Team: Antonio Colombo <azc100@gmail.com>"
+" Vlad Sandrini <vlad.gently@gmail.com"
+" Luciano Montanaro <mikelima@cirulla.net>\n"
+"Language: Italian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO_8859-1\n"
"Content-Transfer-Encoding: 8-bit\n"
@@ -491,10 +491,6 @@ msgstr "E686: L'argomento di %s deve essere una Lista"
msgid "E712: Argument of %s must be a List or Dictionary"
msgstr "E712: L'argomento di %s deve essere una Lista o un Dizionario"
-#: ../eval.c:144
-msgid "E713: Cannot use empty key for Dictionary"
-msgstr "E713: Non posso usare una chiave nulla per il Dizionario"
-
#: ../eval.c:145
msgid "E714: List required"
msgstr "E714: È necessaria una Lista"
@@ -548,7 +544,7 @@ msgstr "E461: Nome di variabile non ammesso: %s"
# nuovo
#: ../eval.c:157
msgid "E806: using Float as a String"
-msgstr "E806: uso di un numero con virgola come stringa"
+msgstr "E806: uso di un Numero-a-virgola-mobile come Stringa"
#: ../eval.c:1830
msgid "E687: Less targets than List items"
@@ -635,7 +631,7 @@ msgstr "E694: Operazione non valida per Funcref"
#: ../eval.c:4277
msgid "E804: Cannot use '%' with Float"
-msgstr "E804: Non si può usare '%' con un numero con virgola"
+msgstr "E804: Non si può usare '%' con un Numero-a-virgola-mobile"
#: ../eval.c:4478
msgid "E110: Missing ')'"
@@ -645,6 +641,9 @@ msgstr "E110: Manca ')'"
msgid "E695: Cannot index a Funcref"
msgstr "E695: Non posso indicizzare un Funcref"
+msgid "E909: Cannot index a special variable"
+msgstr "E909: Non posso indicizzare una variabile speciale"
+
#: ../eval.c:4839
#, c-format
msgid "E112: Option name missing: %s"
@@ -736,7 +735,7 @@ msgstr "E725: Chiamata di funzione dict in assenza di Dizionario: %s"
#: ../eval.c:7453
msgid "E808: Number or Float required"
-msgstr "E808: Ci vuole un numero intero o con virgola"
+msgstr "E808: Ci vuole un Numero o un Numero-a-virgola-mobile"
#: ../eval.c:7503
msgid "add() argument"
@@ -847,7 +846,7 @@ msgstr "E677: Errore in scrittura su file temporaneo"
#: ../eval.c:16159
msgid "E805: Using a Float as a Number"
-msgstr "E805: Uso di un numero con virgola come intero"
+msgstr "E805: Uso di un Numero-a-virgola-mobile come Numero"
#: ../eval.c:16162
msgid "E703: Using a Funcref as a Number"
@@ -861,6 +860,18 @@ msgstr "E745: Uso di Lista come Numero"
msgid "E728: Using a Dictionary as a Number"
msgstr "E728: Uso di Dizionario come Numero"
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: Uso di Funcref come Numero-a-virgola-mobile"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: Uso di Stringa come Numero-a-virgola-mobile"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: Uso di Lista come Numero-a-virgola-mobile"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: Uso di Dizionario come Numero-a-virgola-mobile"
+
#: ../eval.c:16259
msgid "E729: using Funcref as a String"
msgstr "E729: uso di Funcref come Stringa"
@@ -873,6 +884,10 @@ msgstr "E730: uso di Lista come Stringa"
msgid "E731: using Dictionary as a String"
msgstr "E731: uso di Dizionario come Stringa"
+# nuovo
+msgid "E908: using an invalid value as a String"
+msgstr "E908: uso di un valore non valido come Stringa"
+
#: ../eval.c:16619
#, c-format
msgid "E706: Variable type mismatch for: %s"
@@ -960,12 +975,14 @@ msgid "E129: Function name required"
msgstr "E129: Nome funzione necessario"
#: ../eval.c:17824
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr "E128: Il nome funzione deve iniziare con una maiuscola o \"s:\": %s"
+msgstr "E128: Il nome funzione deve iniziare con maiuscola o \"s:\": %s"
#: ../eval.c:17833
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr "E884: Il nome funzione non può contenere una virgola: %s"
+msgstr "E884: Il nome della funzione non può contenere un due punti: %s"
#: ../eval.c:18336
#, c-format
@@ -1382,6 +1399,13 @@ msgstr "riga %<PRId64>: %s"
msgid "cmd: %s"
msgstr "com: %s"
+msgid "frame is zero"
+msgstr "al livello zero"
+
+#, c-format
+msgid "frame at highest level: %d"
+msgstr "al livello più alto: %d"
+
#: ../ex_cmds2.c:322
#, c-format
msgid "Breakpoint in \"%s%s\" line %<PRId64>"
@@ -1422,8 +1446,7 @@ msgstr "E162: Buffer \"%s\" non salvato dopo modifica"
#: ../ex_cmds2.c:1480
msgid "Warning: Entered other buffer unexpectedly (check autocommands)"
msgstr ""
-"Avviso: Entrato in altro buffer inaspettatamente (controllare "
-"autocomandi)"
+"Avviso: Entrato in altro buffer inaspettatamente (controllare autocomandi)"
#: ../ex_cmds2.c:1826
msgid "E163: There is only one file to edit"
@@ -2301,19 +2324,19 @@ msgstr "[in formato DOS]"
#: ../fileio.c:3801
msgid "[mac]"
-msgstr "[MAC]"
+msgstr "[Mac]"
#: ../fileio.c:3801
msgid "[mac format]"
-msgstr "[in formato MAC]"
+msgstr "[in formato Mac]"
#: ../fileio.c:3807
msgid "[unix]"
-msgstr "[UNIX]"
+msgstr "[Unix]"
#: ../fileio.c:3807
msgid "[unix format]"
-msgstr "[in formato UNIX]"
+msgstr "[in formato Unix]"
#: ../fileio.c:3831
msgid "1 line, "
@@ -2864,6 +2887,9 @@ msgstr "E46: Non posso cambiare la variabile read-only \"%s\""
msgid "E794: Cannot set variable in the sandbox: \"%s\""
msgstr "E794: Non posso impostare la variabile read-only in ambiente protetto: \"%s\""
+msgid "E713: Cannot use empty key for Dictionary"
+msgstr "E713: Non posso usare una chiave nulla per il Dizionario"
+
#: ../globals.h:1076
msgid "E47: Error while reading errorfile"
msgstr "E47: Errore leggendo il file errori"
@@ -4087,12 +4113,12 @@ msgid ""
"\n"
"(1) Another program may be editing the same file. If this is the case,\n"
" be careful not to end up with two different instances of the same\n"
-" file when making changes."
+" file when making changes. Quit, or continue with caution.\n"
msgstr ""
"\n"
-"(1) Un altro programma può essere in edit sullo stesso file.\n"
-" Se è così, attenzione a non trovarti con due versioni\n"
-" differenti dello stesso file a cui vengono apportate modifiche."
+"(1) Un altro programma può essere in edit sullo stesso file. Se è così,\n"
+" attenzione a non finire con due sessioni differenti che modificano lo\n"
+" stesso file. Uscire da Vim, o continuare con cautela.\n"
#: ../memline.c:3245
msgid " Quit, or continue with caution.\n"
@@ -4335,7 +4361,7 @@ msgstr "E766: Argomenti non sufficienti per printf()"
#: ../message.c:3119
msgid "E807: Expected Float argument for printf()"
-msgstr "E807: Numero con virgola atteso come argomento per printf()"
+msgstr "E807: Numero-a-virgola-mobile atteso come argomento per printf()"
#: ../message.c:3873
msgid "E767: Too many arguments to printf()"
@@ -4526,7 +4552,8 @@ msgstr "E574: Tipo di registro sconosciuto: %d"
msgid ""
"E883: search pattern and expression register may not contain two or more "
"lines"
-msgstr "E883: espressione di ricerca e registro dell'espressione non possono "
+msgstr ""
+"E883: espressione di ricerca e registro dell'espressione non possono "
"contenere due o più righe"
#: ../ops.c:5089
@@ -4794,6 +4821,14 @@ msgstr ""
"\n"
"Non posso impostare il contesto di sicurezza per "
+#, c-format
+msgid "Could not set security context %s for %s"
+msgstr "Non posso impostare il contesto di sicurezza %s per %s"
+
+#, c-format
+msgid "Could not get security context %s for %s. Removing it!"
+msgstr "Non posso ottenere il contesto di sicurezza %s per %s. Lo rimuovo!"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -4890,6 +4925,7 @@ msgid "E777: String or List expected"
msgstr "E777: aspettavo Stringa o Lista"
#: ../regexp.c:359
+#, c-format
msgid "E369: invalid item in %s%%[]"
msgstr "E369: elemento non valido in %s%%[]"
@@ -5005,6 +5041,7 @@ msgid "External submatches:\n"
msgstr "Sotto-corrispondenze esterne:\n"
#: ../regexp.c:2470
+#, c-format
msgid "E888: (NFA regexp) cannot repeat %s"
msgstr "E888: (NFA regexp) non riesco a ripetere %s"
@@ -5399,8 +5436,7 @@ msgstr "Valore errato per CHECKCOMPOUNDPATTERN in %s riga %d: %s"
#: ../spell.c:4847
#, c-format
msgid "Different combining flag in continued affix block in %s line %d: %s"
-msgstr ""
-"Flag combinazione diverso in blocco affissi continuo in %s riga %d: %s"
+msgstr "Flag combinazione diverso in blocco affissi continuo in %s riga %d: %s"
#: ../spell.c:4850
#, c-format
@@ -5639,10 +5675,12 @@ msgid "E765: 'spellfile' does not have %<PRId64> entries"
msgstr "E765: 'spellfile' non ha %<PRId64> elementi"
#: ../spell.c:8074
+#, c-format
msgid "Word '%.*s' removed from %s"
msgstr "Parola '%.*s' rimossa da %s"
#: ../spell.c:8117
+#, c-format
msgid "Word '%.*s' added to %s"
msgstr "Parola '%.*s' aggiunta a %s"
@@ -5720,6 +5758,9 @@ msgstr "Nessun elemento sintattico definito per questo buffer"
msgid "E390: Illegal argument: %s"
msgstr "E390: Argomento non ammesso: %s"
+msgid "syntax iskeyword "
+msgstr "syntax iskeyword "
+
#: ../syntax.c:3299
#, c-format
msgid "E391: No such syntax cluster: %s"
@@ -5816,6 +5857,9 @@ msgstr "E847: Troppe inclusioni di sintassi"
msgid "E789: Missing ']': %s"
msgstr "E789: Manca ']': %s"
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: Caratteri in più dopo ']': %s]%s"
+
#: ../syntax.c:4531
#, c-format
msgid "E398: Missing '=': %s"
diff --git a/src/nvim/po/ja.euc-jp.po b/src/nvim/po/ja.euc-jp.po
index d3061d3c5a..85042e3506 100644
--- a/src/nvim/po/ja.euc-jp.po
+++ b/src/nvim/po/ja.euc-jp.po
@@ -1,11 +1,11 @@
-# Japanese translation for Vim vim:set foldmethod=marker:
+# Japanese translation for Vim
#
# Do ":help uganda" in Vim to read copying and usage conditions.
# Do ":help credits" in Vim to see a list of people who contributed.
#
-# Last Change: 2013 Jul 06
+# Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>,
+# vim-jp (http://vim-jp.org/)
#
-# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
#
# Generated from ja.po, DO NOT EDIT.
@@ -14,10 +14,10 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim 7.4\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2013-07-06 15:00+0900\n"
+"POT-Creation-Date: 2016-02-01 09:02+0900\n"
+"PO-Revision-Date: 2016-02-01 09:08+0900\n"
"Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
-"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
+"Language-Team: vim-jp (https://github.com/vim-jp/lang-ja)\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=euc-jp\n"
@@ -34,7 +34,7 @@ msgstr "ÆâÉô¥¨¥é¡¼: ̤ÃΤΥª¥×¥·¥ç¥ó·¿¤Ç¤¹"
#: ../buffer.c:92
msgid "[Location List]"
-msgstr "[¾ì½ê¥ê¥¹¥È]"
+msgstr "[¥í¥±¡¼¥·¥ç¥ó¥ê¥¹¥È]"
#: ../buffer.c:93
msgid "[Quickfix List]"
@@ -277,7 +277,7 @@ msgstr "E810: °ì»þ¥Õ¥¡¥¤¥ë¤ÎÆÉ¹þ¤â¤·¤¯¤Ï½ñ¹þ¤¬¤Ç¤­¤Þ¤»¤ó"
#: ../diff.c:755
msgid "E97: Cannot create diffs"
-msgstr "E97: º¹Ê¬¤òºîÀ®¤Ç¤­¤Þ¤»¤ó "
+msgstr "E97: º¹Ê¬¤òºîÀ®¤Ç¤­¤Þ¤»¤ó"
#: ../diff.c:966
msgid "E816: Cannot read patch output"
@@ -293,7 +293,7 @@ msgstr "E99: ¸½ºß¤Î¥Ð¥Ã¥Õ¥¡¤Ïº¹Ê¬¥â¡¼¥É¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó"
#: ../diff.c:2100
msgid "E793: No other buffer in diff mode is modifiable"
-msgstr "E793: º¹Ê¬¥â¡¼¥É¤Ç¤¢¤ë¾¤Î¥Ð¥Ã¥Õ¥¡¤ÏÊѹ¹²Äǽ¤Ç¤¹"
+msgstr "E793: º¹Ê¬¥â¡¼¥É¤Ç¤¢¤ë¾¤Î¥Ð¥Ã¥Õ¥¡¤ÏÊѹ¹¤Ç¤­¤Þ¤»¤ó"
#: ../diff.c:2102
msgid "E100: No other buffer in diff mode"
@@ -349,7 +349,7 @@ msgstr " ¹Ô(Á´ÂÎ)Êä´° (^L^N^P)"
#: ../edit.c:86
msgid " File name completion (^F^N^P)"
-msgstr "¥Õ¥¡¥¤¥ë̾Êä´° (^F^N^P)"
+msgstr " ¥Õ¥¡¥¤¥ë̾Êä´° (^F^N^P)"
#: ../edit.c:87
msgid " Tag completion (^]^N^P)"
@@ -377,7 +377,7 @@ msgstr " ¥³¥Þ¥ó¥É¥é¥¤¥óÊä´° (^V^N^P)"
#: ../edit.c:94
msgid " User defined completion (^U^N^P)"
-msgstr " ¥æ¡¼¥¶ÄêµÁÊä´° (^U^N^P)"
+msgstr " ¥æ¡¼¥¶¡¼ÄêµÁÊä´° (^U^N^P)"
#: ../edit.c:95
msgid " Omni completion (^O^N^P)"
@@ -679,6 +679,11 @@ msgstr "E696: ¥ê¥¹¥È·¿¤Ë¥«¥ó¥Þ¤¬¤¢¤ê¤Þ¤»¤ó: %s"
msgid "E697: Missing end of List ']': %s"
msgstr "E697: ¥ê¥¹¥È·¿¤ÎºÇ¸å¤Ë ']' ¤¬¤¢¤ê¤Þ¤»¤ó: %s"
+#: ../eval.c:5807
+msgid "Not enough memory to set references, garbage collection aborted!"
+msgstr ""
+"¥¬¡¼¥Ù¥Ã¥¸¥³¥ì¥¯¥·¥ç¥ó¤òÃæ»ß¤·¤Þ¤·¤¿! »²¾È¤òºîÀ®¤¹¤ë¤Î¤Ë¥á¥â¥ê¤¬ÉÔ­¤·¤Þ¤·¤¿"
+
#: ../eval.c:6475
#, c-format
msgid "E720: Missing colon in Dictionary: %s"
@@ -721,7 +726,7 @@ msgstr "E117: ̤ÃΤδؿô¤Ç¤¹: %s"
#: ../eval.c:7383
#, c-format
msgid "E119: Not enough arguments for function: %s"
-msgstr "E119: ´Ø¿ô¤Î°ú¿ô¤¬¾¯¤Ê²á¤®¤Þ¤¹: %s"
+msgstr "E119: ´Ø¿ô¤Î°ú¿ô¤¬Â­¤ê¤Þ¤»¤ó: %s"
#: ../eval.c:7387
#, c-format
@@ -826,18 +831,16 @@ msgid "sort() argument"
msgstr "sort() ¤Î°ú¿ô"
#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr "add() ¤Î°ú¿ô"
+msgstr "uniq() ¤Î°ú¿ô"
#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: ¥½¡¼¥È¤ÎÈæ³Ó´Ø¿ô¤¬¼ºÇÔ¤·¤Þ¤·¤¿"
#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: ¥½¡¼¥È¤ÎÈæ³Ó´Ø¿ô¤¬¼ºÇÔ¤·¤Þ¤·¤¿"
+msgstr "E882: Uniq ¤ÎÈæ³Ó´Ø¿ô¤¬¼ºÇÔ¤·¤Þ¤·¤¿"
#: ../eval.c:14085
msgid "(Invalid)"
@@ -863,6 +866,18 @@ msgstr "E745: ¥ê¥¹¥È·¿¤ò¿ôÃͤȤ·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
msgid "E728: Using a Dictionary as a Number"
msgstr "E728: ¼­½ñ·¿¤ò¿ôÃͤȤ·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: ´Ø¿ô»²¾È·¿¤òÉâÆ°¾®¿ôÅÀ¿ô¤È¤·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹¡£"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: ʸ»úÎó¤òÉâÆ°¾®¿ôÅÀ¿ô¤È¤·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: ¥ê¥¹¥È·¿¤òÉâÆ°¾®¿ôÅÀ¿ô¤È¤·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: ¼­½ñ·¿¤òÉâÆ°¾®¿ôÅÀ¿ô¤È¤·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
+
#: ../eval.c:16259
msgid "E729: using Funcref as a String"
msgstr "E729: ´Ø¿ô»²¾È·¿¤òʸ»úÎó¤È¤·¤Æ°·¤Ã¤Æ¤¤¤Þ¤¹"
@@ -961,14 +976,14 @@ msgid "E129: Function name required"
msgstr "E129: ´Ø¿ô̾¤¬Í׵ᤵ¤ì¤Þ¤¹"
#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr "E128: ´Ø¿ô̾¤ÏÂçʸ»ú¤Ç»Ï¤Þ¤ë¤«¥³¥í¥ó¤ò´Þ¤Þ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó: %s"
+msgstr "E128: ´Ø¿ô̾¤ÏÂçʸ»ú¤« \"s:\" ¤Ç»Ï¤Þ¤é¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó: %s"
#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr "E128: ´Ø¿ô̾¤ÏÂçʸ»ú¤Ç»Ï¤Þ¤ë¤«¥³¥í¥ó¤ò´Þ¤Þ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó: %s"
+msgstr "E884: ´Ø¿ô̾¤Ë¤Ï¥³¥í¥ó¤Ï´Þ¤á¤é¤ì¤Þ¤»¤ó: %s"
#: ../eval.c:18336
#, c-format
@@ -1081,7 +1096,7 @@ msgstr "E136: viminfo: ¥¨¥é¡¼¤¬Â¿²á¤®¤ë¤Î¤Ç, °Ê¹ß¤Ï¥¹¥­¥Ã¥×¤·¤Þ¤¹"
#: ../ex_cmds.c:1458
#, c-format
msgid "Reading viminfo file \"%s\"%s%s%s"
-msgstr "viminfo¥Õ¥¡¥¤¥ë \"%s\"%s%s%s ¤òÆÉ¹þ¤ßÃæ "
+msgstr "viminfo¥Õ¥¡¥¤¥ë \"%s\"%s%s%s ¤òÆÉ¹þ¤ßÃæ"
#: ../ex_cmds.c:1460
msgid " info"
@@ -1357,6 +1372,10 @@ msgstr "E158: ̵¸ú¤Ê¥Ð¥Ã¥Õ¥¡Ì¾¤Ç¤¹: %s"
msgid "E157: Invalid sign ID: %<PRId64>"
msgstr "E157: ̵¸ú¤Êsign¼±Ê̻ҤǤ¹: %<PRId64>"
+#, c-format
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: Êѹ¹¤Ç¤­¤Ê¤¤ sign ¤Ç¤¹: %s"
+
#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " (È󥵥ݡ¼¥È)"
@@ -1379,6 +1398,13 @@ msgstr "¹Ô %<PRId64>: %s"
msgid "cmd: %s"
msgstr "¥³¥Þ¥ó¥É: %s"
+msgid "frame is zero"
+msgstr "¥Õ¥ì¡¼¥à¤¬ 0 ¤Ç¤¹"
+
+#, c-format
+msgid "frame at highest level: %d"
+msgstr "ºÇ¹â¥ì¥Ù¥ë¤Î¥Õ¥ì¡¼¥à: %d"
+
#: ../ex_cmds2.c:322
#, c-format
msgid "Breakpoint in \"%s%s\" line %<PRId64>"
@@ -1528,7 +1554,8 @@ msgstr "E197: ¸À¸ì¤ò \"%s\" ¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó"
#. don't wait for return
#: ../ex_docmd.c:387
msgid "Entering Ex mode. Type \"visual\" to go to Normal mode."
-msgstr "Ex¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹. ¥Î¡¼¥Þ¥ë¤ËÌá¤ë¤Ë¤Ï\"visual\"¤ÈÆþÎϤ·¤Æ¤¯¤À¤µ¤¤."
+msgstr ""
+"Ex¥â¡¼¥É¤ËÆþ¤ê¤Þ¤¹. ¥Î¡¼¥Þ¥ë¥â¡¼¥É¤ËÌá¤ë¤Ë¤Ï\"visual\"¤ÈÆþÎϤ·¤Æ¤¯¤À¤µ¤¤."
#: ../ex_docmd.c:428
msgid "E501: At end-of-file"
@@ -1553,7 +1580,7 @@ msgstr "´Ø¿ô¤ÎºÇ¸å¤Ç¤¹"
#: ../ex_docmd.c:1628
msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: ¥æ¡¼¥¶ÄêµÁ¥³¥Þ¥ó¥É¤Î¤¢¤¤¤Þ¤¤¤Ê»ÈÍѤǤ¹"
+msgstr "E464: ¥æ¡¼¥¶¡¼ÄêµÁ¥³¥Þ¥ó¥É¤Î¤¢¤¤¤Þ¤¤¤Ê»ÈÍѤǤ¹"
#: ../ex_docmd.c:1638
msgid "E492: Not an editor command"
@@ -1606,14 +1633,14 @@ msgstr "E174: ¥³¥Þ¥ó¥É¤¬´û¤Ë¤¢¤ê¤Þ¤¹: ºÆÄêµÁ¤¹¤ë¤Ë¤Ï ! ¤òÄɲ䷤Ƥ¯¤À¤µ¤¤"
#: ../ex_docmd.c:4432
msgid ""
"\n"
-" Name Args Range Complete Definition"
+" Name Args Address Complete Definition"
msgstr ""
"\n"
-" ̾Á° °ú¿ô ÈÏ°Ï Êä´° ÄêµÁ"
+" ̾Á° °ú¿ô ¥¢¥É¥ì¥¹ Êä´° ÄêµÁ"
#: ../ex_docmd.c:4516
msgid "No user-defined commands found"
-msgstr "¥æ¡¼¥¶ÄêµÁ¥³¥Þ¥ó¥É¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿"
+msgstr "¥æ¡¼¥¶¡¼ÄêµÁ¥³¥Þ¥ó¥É¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¤Ç¤·¤¿"
#: ../ex_docmd.c:4538
msgid "E175: No attribute specified"
@@ -1633,7 +1660,10 @@ msgstr "E178: ¥«¥¦¥ó¥È¤Î¾ÊάÃͤ¬Ìµ¸ú¤Ç¤¹"
#: ../ex_docmd.c:4625
msgid "E179: argument required for -complete"
-msgstr "E179: -Êä´°¤Î¤¿¤á¤Î°ú¿ô¤¬É¬ÍפǤ¹"
+msgstr "E179: -complete ¤Ë¤Ï°ú¿ô¤¬É¬ÍפǤ¹"
+
+msgid "E179: argument required for -addr"
+msgstr "E179: -addr ¤Ë¤Ï°ú¿ô¤¬É¬ÍפǤ¹"
#: ../ex_docmd.c:4635
#, c-format
@@ -1650,12 +1680,16 @@ msgstr "E183: ¥æ¡¼¥¶ÄêµÁ¥³¥Þ¥ó¥É¤Ï±ÑÂçʸ»ú¤Ç»Ï¤Þ¤é¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó"
#: ../ex_docmd.c:4696
msgid "E841: Reserved name, cannot be used for user defined command"
-msgstr "E841: ͽÌó̾¤Ê¤Î¤Ç, ¥æ¡¼¥¶ÄêµÁ¥³¥Þ¥ó¥É¤ËÍøÍѤǤ­¤Þ¤»¤ó"
+msgstr "E841: ͽÌó̾¤Ê¤Î¤Ç, ¥æ¡¼¥¶¡¼ÄêµÁ¥³¥Þ¥ó¥É¤ËÍøÍѤǤ­¤Þ¤»¤ó"
#: ../ex_docmd.c:4751
#, c-format
msgid "E184: No such user-defined command: %s"
-msgstr "E184: ¤½¤Î¥æ¡¼¥¶ÄêµÁ¥³¥Þ¥ó¥É¤Ï¤¢¤ê¤Þ¤»¤ó: %s"
+msgstr "E184: ¤½¤Î¥æ¡¼¥¶¡¼ÄêµÁ¥³¥Þ¥ó¥É¤Ï¤¢¤ê¤Þ¤»¤ó: %s"
+
+#, c-format
+msgid "E180: Invalid address type value: %s"
+msgstr "E180: ̵¸ú¤Ê¥¢¥É¥ì¥¹¥¿¥¤¥×ÃͤǤ¹: %s"
#: ../ex_docmd.c:5219
#, c-format
@@ -2019,11 +2053,11 @@ msgstr "ÉÔÀµ¤Ê¥Õ¥¡¥¤¥ë̾"
#: ../fileio.c:395 ../fileio.c:476 ../fileio.c:2543 ../fileio.c:2578
msgid "is a directory"
-msgstr " ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¹"
+msgstr "¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¹"
#: ../fileio.c:397
msgid "is not a file"
-msgstr " ¤Ï¥Õ¥¡¥¤¥ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó"
+msgstr "¤Ï¥Õ¥¡¥¤¥ë¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó"
#: ../fileio.c:508 ../fileio.c:3522
msgid "[New File]"
@@ -2039,7 +2073,7 @@ msgstr "[¥Õ¥¡¥¤¥ë²áÂç]"
#: ../fileio.c:534
msgid "[Permission Denied]"
-msgstr "[ǧ²Ä¤¬¤¢¤ê¤Þ¤»¤ó]"
+msgstr "[¸¢¸Â¤¬¤¢¤ê¤Þ¤»¤ó]"
#: ../fileio.c:653
msgid "E200: *ReadPre autocommands made the file unreadable"
@@ -2210,7 +2244,7 @@ msgstr " ÊÑ´¹¥¨¥é¡¼"
#: ../fileio.c:3509
#, c-format
msgid " in line %<PRId64>;"
-msgstr "¹Ô %<PRId64>;"
+msgstr " ¹Ô %<PRId64>;"
#: ../fileio.c:3519
msgid "[Device]"
@@ -2766,9 +2800,8 @@ msgid "E37: No write since last change (add ! to override)"
msgstr "E37: ºÇ¸å¤ÎÊѹ¹¤¬Êݸ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó (! ¤òÄɲäÇÊѹ¹¤òÇË´þ)"
#: ../globals.h:1055
-#, fuzzy
msgid "E37: No write since last change"
-msgstr "[ºÇ¸å¤ÎÊѹ¹¤¬Êݸ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó]\n"
+msgstr "E37: ºÇ¸å¤ÎÊѹ¹¤¬Êݸ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó"
#: ../globals.h:1056
msgid "E38: Null argument"
@@ -2810,7 +2843,7 @@ msgstr "E42: ¥¨¥é¡¼¤Ï¤¢¤ê¤Þ¤»¤ó"
#: ../globals.h:1067
msgid "E776: No location list"
-msgstr "E776: ¾ì½ê¥ê¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó"
+msgstr "E776: ¥í¥±¡¼¥·¥ç¥ó¥ê¥¹¥È¤Ï¤¢¤ê¤Þ¤»¤ó"
#: ../globals.h:1068
msgid "E43: Damaged match string"
@@ -3831,7 +3864,7 @@ msgid ""
"\n"
msgstr ""
"\n"
-"¤½¤ì¤«¤é.swp¥Õ¥¡¥¤¥ë¤òºï½ü¤·¤Æ¤¯¤À¤µ¤¤\n"
+"¸µ¤Î.swp¥Õ¥¡¥¤¥ë¤Ïºï½ü¤·¤Æ¤â¹½¤¤¤Þ¤»¤ó\n"
"\n"
#. use msg() to start the scrolling properly
@@ -3845,7 +3878,7 @@ msgstr " ¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê:\n"
#: ../memline.c:1448
msgid " Using specified name:\n"
-msgstr " ¤¢¤ë̾Á°¤ò»ÈÍÑÃæ:\n"
+msgstr " °Ê²¼¤Î̾Á°¤ò»ÈÍÑÃæ:\n"
#: ../memline.c:1450
msgid " In directory "
@@ -3901,7 +3934,7 @@ msgid ""
" user name: "
msgstr ""
"\n"
-" ¥æ¡¼¥¶Ì¾: "
+" ¥æ¡¼¥¶¡¼Ì¾: "
#: ../memline.c:1568
msgid " host name: "
@@ -4050,12 +4083,12 @@ msgid ""
msgstr ""
"\n"
"(1) ÊÌ¤Î¥×¥í¥°¥é¥à¤¬Æ±¤¸¥Õ¥¡¥¤¥ë¤òÊÔ½¸¤·¤Æ¤¤¤ë¤«¤â¤·¤ì¤Þ¤»¤ó.\n"
-" ¤³¤Î¾ì¹ç¤Ë¤Ï, Êѹ¹¤ò¤·¤¿ºÝ¤ËºÇ½ªÅª¤Ë, Ʊ¤¸¥Õ¥¡¥¤¥ë¤Î°Û¤Ê¤ë\n"
-" 2¤Ä¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤¬¤Ç¤­¤Æ¤·¤Þ¤¦¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤."
+" ¤³¤Î¾ì¹ç¤Ë¤Ï, Êѹ¹¤ò¤·¤Æ¤·¤Þ¤¦¤È1¤Ä¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ°Û¤Ê¤ë2¤Ä¤Î\n"
+" ¥¤¥ó¥¹¥¿¥ó¥¹¤¬¤Ç¤­¤Æ¤·¤Þ¤¦¤Î¤Ç, ¤½¤¦¤·¤Ê¤¤¤è¤¦¤Ëµ¤¤ò¤Ä¤±¤Æ¤¯¤À¤µ¤¤."
#: ../memline.c:3245
msgid " Quit, or continue with caution.\n"
-msgstr " ½ªÎ»¤¹¤ë¤«, Ãí°Õ¤·¤Ê¤¬¤é³¤±¤Æ¤¯¤À¤µ¤¤.\n"
+msgstr " ½ªÎ»¤¹¤ë¤«, Ãí°Õ¤·¤Ê¤¬¤é³¤±¤Æ¤¯¤À¤µ¤¤.\n"
#: ../memline.c:3246
msgid "(2) An edit session for this file crashed.\n"
@@ -4479,6 +4512,11 @@ msgstr ""
msgid "E574: Unknown register type %d"
msgstr "E574: ̤ÃΤΥ쥸¥¹¥¿·¿ %d ¤Ç¤¹"
+msgid ""
+"E883: search pattern and expression register may not contain two or more "
+"lines"
+msgstr "E883: ¸¡º÷¥Ñ¥¿¡¼¥ó¤È¼°¥ì¥¸¥¹¥¿¤Ë¤Ï2¹Ô°Ê¾å¤ò´Þ¤á¤é¤ì¤Þ¤»¤ó"
+
#: ../ops.c:5089
#, c-format
msgid "%<PRId64> Cols; "
@@ -4563,6 +4601,10 @@ msgstr "E522: termcap Æâ¤Ë¸«¤Ä¤«¤ê¤Þ¤»¤ó"
msgid "E539: Illegal character <%s>"
msgstr "E539: ÉÔÀµ¤Êʸ»ú¤Ç¤¹ <%s>"
+#, c-format
+msgid "For option %s"
+msgstr "¥ª¥×¥·¥ç¥ó: %s"
+
#: ../option.c:3862
msgid "E529: Cannot set 'term' to empty string"
msgstr "E529: 'term' ¤Ë¤Ï¶õʸ»úÎó¤òÀßÄê¤Ç¤­¤Þ¤»¤ó"
@@ -4740,6 +4782,14 @@ msgstr ""
"\n"
"¥»¥­¥å¥ê¥Æ¥£¥³¥ó¥Æ¥­¥¹¥È¤òÀßÄê¤Ç¤­¤Þ¤»¤ó "
+#, c-format
+msgid "Could not set security context %s for %s"
+msgstr "¥»¥­¥å¥ê¥Æ¥£¥³¥ó¥Æ¥­¥¹¥È %s ¤ò %s ¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó"
+
+#, c-format
+msgid "Could not get security context %s for %s. Removing it!"
+msgstr "¥»¥­¥å¥ê¥Æ¥£¥³¥ó¥Æ¥­¥¹¥È %s ¤ò %s ¤«¤é¼èÆÀ¤Ç¤­¤Þ¤»¤ó. ºï½ü¤·¤Þ¤¹!"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -4960,6 +5010,10 @@ msgstr "E554: %s{...} Æâ¤Ëʸˡ¥¨¥é¡¼¤¬¤¢¤ê¤Þ¤¹"
msgid "External submatches:\n"
msgstr "³°Éô¤ÎÉôʬ³ºÅö:\n"
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (NFA Àµµ¬É½¸½) ·«¤êÊÖ¤»¤Þ¤»¤ó %s"
+
#: ../regexp.c:7022
msgid ""
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be "
@@ -4968,6 +5022,9 @@ msgstr ""
"E864: \\%#= ¤Ë¤Ï 0, 1 ¤â¤·¤¯¤Ï 2 ¤Î¤ß¤¬Â³¤±¤é¤ì¤Þ¤¹¡£Àµµ¬É½¸½¥¨¥ó¥¸¥ó¤Ï¼«Æ°Áª"
"Âò¤µ¤ì¤Þ¤¹¡£"
+msgid "Switching to backtracking RE engine for pattern: "
+msgstr "¼¡¤Î¥Ñ¥¿¡¼¥ó¤Ë¥Ð¥Ã¥¯¥È¥é¥Ã¥­¥ó¥° RE ¥¨¥ó¥¸¥ó¤òŬÍѤ·¤Þ¤¹: "
+
#: ../regexp_nfa.c:239
msgid "E865: (NFA) Regexp end encountered prematurely"
msgstr "E865: (NFA) ´üÂÔ¤è¤êÁ᤯Àµµ¬É½¸½¤Î½ªÃ¼¤ËÅþ㤷¤Þ¤·¤¿"
@@ -4980,7 +5037,7 @@ msgstr "E866: (NFA Àµµ¬É½¸½) °ÌÃÖ¤¬¸í¤Ã¤Æ¤¤¤Þ¤¹: %c"
#: ../regexp_nfa.c:242
#, c-format
msgid "E877: (NFA regexp) Invalid character class: %<PRId64>"
-msgstr ""
+msgstr "E877: (NFA Àµµ¬É½¸½) ̵¸ú¤Êʸ»ú¥¯¥é¥¹: %<PRId64>"
#: ../regexp_nfa.c:1261
#, c-format
@@ -5590,14 +5647,14 @@ msgid "E765: 'spellfile' does not have %<PRId64> entries"
msgstr "E765: 'spellfile' ¤Ë¤Ï %<PRId64> ¸Ä¤Î¥¨¥ó¥È¥ê¤Ï¤¢¤ê¤Þ¤»¤ó"
#: ../spell.c:8074
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' removed from %s"
-msgstr "%s ¤«¤éñ¸ì¤¬ºï½ü¤µ¤ì¤Þ¤·¤¿"
+msgstr "ñ¸ì '%.*s' ¤¬ %s ¤«¤éºï½ü¤µ¤ì¤Þ¤·¤¿"
#: ../spell.c:8117
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' added to %s"
-msgstr "%s ¤Ëñ¸ì¤¬Äɲ䵤ì¤Þ¤·¤¿"
+msgstr "ñ¸ì '%.*s' ¤¬ %s ¤ØÄɲ䵤ì¤Þ¤·¤¿"
#: ../spell.c:8381
msgid "E763: Word characters differ between spell files"
@@ -5673,6 +5730,9 @@ msgstr "¤³¤Î¥Ð¥Ã¥Õ¥¡¤ËÄêµÁ¤µ¤ì¤¿¹½Ê¸Í×ÁǤϤ¢¤ê¤Þ¤»¤ó"
msgid "E390: Illegal argument: %s"
msgstr "E390: ÉÔÀµ¤Ê°ú¿ô¤Ç¤¹: %s"
+msgid "syntax iskeyword "
+msgstr "¥·¥ó¥¿¥Ã¥¯¥¹ÍÑ iskeyword "
+
#: ../syntax.c:3299
#, c-format
msgid "E391: No such syntax cluster: %s"
@@ -5769,6 +5829,10 @@ msgstr "E847: ¹½Ê¸¤Î¼è¤ê¹þ¤ß(include)¤¬Â¿²á¤®¤Þ¤¹"
msgid "E789: Missing ']': %s"
msgstr "E789: ']' ¤¬¤¢¤ê¤Þ¤»¤ó: %s"
+#, c-format
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: ']' ¤Î¸å¤í¤Ë;ʬ¤Êʸ»ú¤¬¤¢¤ê¤Þ¤¹: %s]%s"
+
#: ../syntax.c:4531
#, c-format
msgid "E398: Missing '=': %s"
@@ -5874,7 +5938,7 @@ msgstr "E415: ͽ´ü¤»¤ÌÅù¹æ¤Ç¤¹: %s"
#: ../syntax.c:6395
#, c-format
msgid "E416: missing equal sign: %s"
-msgstr "E416: Åù¹æ¤¬¤¬¤¢¤ê¤Þ¤»¤ó: %s"
+msgstr "E416: Åù¹æ¤¬¤¢¤ê¤Þ¤»¤ó: %s"
#: ../syntax.c:6418
#, c-format
@@ -6078,9 +6142,8 @@ msgstr "Vim: ÆþÎϤòÆÉ¹þ¤ßÃæ¤Î¥¨¥é¡¼¤Ë¤è¤ê½ªÎ»¤·¤Þ¤¹...\n"
#. This happens when the FileChangedRO autocommand changes the
#. * file in a way it becomes shorter.
#: ../undo.c:379
-#, fuzzy
msgid "E881: Line count changed unexpectedly"
-msgstr "E834: ͽ´ü¤»¤º¹Ô¥«¥¦¥ó¥È¤¬ÊѤï¤ê¤Þ¤·¤¿"
+msgstr "E881: ͽ´ü¤»¤º¹Ô¥«¥¦¥ó¥È¤¬ÊѤï¤ê¤Þ¤·¤¿"
#: ../undo.c:627
#, c-format
@@ -6287,23 +6350,23 @@ msgstr " ¥·¥¹¥Æ¥à vimrc: \""
#: ../version.c:672
msgid " user vimrc file: \""
-msgstr " ¥æ¡¼¥¶ vimrc: \""
+msgstr " ¥æ¡¼¥¶¡¼ vimrc: \""
#: ../version.c:677
msgid " 2nd user vimrc file: \""
-msgstr " Âè2¥æ¡¼¥¶ vimrc: \""
+msgstr " Âè2¥æ¡¼¥¶¡¼ vimrc: \""
#: ../version.c:682
msgid " 3rd user vimrc file: \""
-msgstr " Âè3¥æ¡¼¥¶ vimrc: \""
+msgstr " Âè3¥æ¡¼¥¶¡¼ vimrc: \""
#: ../version.c:687
msgid " user exrc file: \""
-msgstr " ¥æ¡¼¥¶ exrc: \""
+msgstr " ¥æ¡¼¥¶¡¼ exrc: \""
#: ../version.c:692
msgid " 2nd user exrc file: \""
-msgstr " Âè2¥æ¡¼¥¶ exrc: \""
+msgstr " Âè2¥æ¡¼¥¶¡¼ exrc: \""
#: ../version.c:699
msgid " fall-back for $VIM: \""
@@ -6379,7 +6442,7 @@ msgstr "Vim¤Î³«È¯¤ò±þ±ç¤·¤Æ¤¯¤À¤µ¤¤!"
#: ../version.c:828
msgid "Become a registered Vim user!"
-msgstr "Vim¤ÎÅÐÏ¿¥æ¡¼¥¶¤Ë¤Ê¤Ã¤Æ¤¯¤À¤µ¤¤!"
+msgstr "Vim¤ÎÅÐÏ¿¥æ¡¼¥¶¡¼¤Ë¤Ê¤Ã¤Æ¤¯¤À¤µ¤¤!"
#: ../version.c:831
msgid "type :help sponsor<Enter> for information "
@@ -6391,7 +6454,7 @@ msgstr "¾ÜºÙ¤Ê¾ðÊó¤Ï :help register<Enter> "
#: ../version.c:834
msgid "menu Help->Sponsor/Register for information "
-msgstr "¾ÜºÙ¤Ï¥á¥Ë¥å¡¼¤Î ¥Ø¥ë¥×¢ª¥¹¥Ý¥ó¥µ¡¼/ÅÐÏ¿ ¤ò»²¾È¤·¤Æ²¼¤µ¤¤ "
+msgstr "¾ÜºÙ¤Ï¥á¥Ë¥å¡¼¤Î ¥Ø¥ë¥×->¥¹¥Ý¥ó¥µ¡¼/ÅÐÏ¿ ¤ò»²¾È¤·¤Æ²¼¤µ¤¤"
#: ../window.c:119
msgid "Already only one window"
@@ -6429,6 +6492,9 @@ msgstr "E445: ¾¤Î¥¦¥£¥ó¥É¥¦¤Ë¤ÏÊѹ¹¤¬¤¢¤ê¤Þ¤¹"
msgid "E446: No file name under cursor"
msgstr "E446: ¥«¡¼¥½¥ë¤Î²¼¤Ë¥Õ¥¡¥¤¥ë̾¤¬¤¢¤ê¤Þ¤»¤ó"
+msgid "List or number required"
+msgstr "¥ê¥¹¥È¤«¿ôÃͤ¬É¬ÍפǤ¹"
+
#~ msgid "E831: bf_key_init() called with empty password"
#~ msgstr "E831: bf_key_init() ¤¬¶õ¥Ñ¥¹¥ï¡¼¥É¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿"
diff --git a/src/nvim/po/ja.po b/src/nvim/po/ja.po
index 6bdfcb426f..8a3fcb8f78 100644
--- a/src/nvim/po/ja.po
+++ b/src/nvim/po/ja.po
@@ -1,11 +1,11 @@
-# Japanese translation for Vim vim:set foldmethod=marker:
+# Japanese translation for Vim
#
# Do ":help uganda" in Vim to read copying and usage conditions.
# Do ":help credits" in Vim to see a list of people who contributed.
#
-# Last Change: 2013 Jul 06
+# Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>,
+# vim-jp (http://vim-jp.org/)
#
-# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
#
# Original translations.
@@ -14,10 +14,10 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim 7.4\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2013-07-06 15:00+0900\n"
+"POT-Creation-Date: 2016-02-01 09:02+0900\n"
+"PO-Revision-Date: 2013-06-02-01 09:08+09n"
"Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
-"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
+"Language-Team: vim-jp (https://github.com/vim-jp/lang-ja)\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
@@ -34,7 +34,7 @@ msgstr "内部エラー: 未知ã®ã‚ªãƒ—ション型ã§ã™"
#: ../buffer.c:92
msgid "[Location List]"
-msgstr "[場所リスト]"
+msgstr "[ロケーションリスト]"
#: ../buffer.c:93
msgid "[Quickfix List]"
@@ -277,7 +277,7 @@ msgstr "E810: 一時ファイルã®èª­è¾¼ã‚‚ã—ãã¯æ›¸è¾¼ãŒã§ãã¾ã›ã‚“"
#: ../diff.c:755
msgid "E97: Cannot create diffs"
-msgstr "E97: 差分を作æˆã§ãã¾ã›ã‚“ "
+msgstr "E97: 差分を作æˆã§ãã¾ã›ã‚“"
#: ../diff.c:966
msgid "E816: Cannot read patch output"
@@ -293,7 +293,7 @@ msgstr "E99: ç¾åœ¨ã®ãƒãƒƒãƒ•ã‚¡ã¯å·®åˆ†ãƒ¢ãƒ¼ãƒ‰ã§ã¯ã‚りã¾ã›ã‚“"
#: ../diff.c:2100
msgid "E793: No other buffer in diff mode is modifiable"
-msgstr "E793: 差分モードã§ã‚ã‚‹ä»–ã®ãƒãƒƒãƒ•ã‚¡ã¯å¤‰æ›´å¯èƒ½ã§ã™"
+msgstr "E793: 差分モードã§ã‚ã‚‹ä»–ã®ãƒãƒƒãƒ•ã‚¡ã¯å¤‰æ›´ã§ãã¾ã›ã‚“"
#: ../diff.c:2102
msgid "E100: No other buffer in diff mode"
@@ -349,7 +349,7 @@ msgstr " 行(全体)補完 (^L^N^P)"
#: ../edit.c:86
msgid " File name completion (^F^N^P)"
-msgstr "ファイルå補完 (^F^N^P)"
+msgstr " ファイルå補完 (^F^N^P)"
#: ../edit.c:87
msgid " Tag completion (^]^N^P)"
@@ -377,7 +377,7 @@ msgstr " コマンドライン補完 (^V^N^P)"
#: ../edit.c:94
msgid " User defined completion (^U^N^P)"
-msgstr " ユーザ定義補完 (^U^N^P)"
+msgstr " ユーザー定義補完 (^U^N^P)"
#: ../edit.c:95
msgid " Omni completion (^O^N^P)"
@@ -679,6 +679,10 @@ msgstr "E696: リスト型ã«ã‚«ãƒ³ãƒžãŒã‚りã¾ã›ã‚“: %s"
msgid "E697: Missing end of List ']': %s"
msgstr "E697: ãƒªã‚¹ãƒˆåž‹ã®æœ€å¾Œã« ']' ãŒã‚りã¾ã›ã‚“: %s"
+msgid "Not enough memory to set references, garbage collection aborted!"
+msgstr ""
+"ガーベッジコレクションを中止ã—ã¾ã—ãŸ! å‚照を作æˆã™ã‚‹ã®ã«ãƒ¡ãƒ¢ãƒªãŒä¸è¶³ã—ã¾ã—ãŸ"
+
#: ../eval.c:6475
#, c-format
msgid "E720: Missing colon in Dictionary: %s"
@@ -721,7 +725,7 @@ msgstr "E117: 未知ã®é–¢æ•°ã§ã™: %s"
#: ../eval.c:7383
#, c-format
msgid "E119: Not enough arguments for function: %s"
-msgstr "E119: 関数ã®å¼•æ•°ãŒå°‘ãªéŽãŽã¾ã™: %s"
+msgstr "E119: 関数ã®å¼•æ•°ãŒè¶³ã‚Šã¾ã›ã‚“: %s"
#: ../eval.c:7387
#, c-format
@@ -826,18 +830,16 @@ msgid "sort() argument"
msgstr "sort() ã®å¼•æ•°"
#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr "add() ã®å¼•æ•°"
+msgstr "uniq() ã®å¼•æ•°"
#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: ã‚½ãƒ¼ãƒˆã®æ¯”較関数ãŒå¤±æ•—ã—ã¾ã—ãŸ"
#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: ã‚½ãƒ¼ãƒˆã®æ¯”較関数ãŒå¤±æ•—ã—ã¾ã—ãŸ"
+msgstr "E882: Uniq ã®æ¯”較関数ãŒå¤±æ•—ã—ã¾ã—ãŸ"
#: ../eval.c:14085
msgid "(Invalid)"
@@ -863,6 +865,18 @@ msgstr "E745: リスト型を数値ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
msgid "E728: Using a Dictionary as a Number"
msgstr "E728: 辞書型を数値ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: 関数å‚ç…§åž‹ã‚’æµ®å‹•å°æ•°ç‚¹æ•°ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™ã€‚"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: æ–‡å­—åˆ—ã‚’æµ®å‹•å°æ•°ç‚¹æ•°ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: ãƒªã‚¹ãƒˆåž‹ã‚’æµ®å‹•å°æ•°ç‚¹æ•°ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: è¾žæ›¸åž‹ã‚’æµ®å‹•å°æ•°ç‚¹æ•°ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
+
#: ../eval.c:16259
msgid "E729: using Funcref as a String"
msgstr "E729: 関数å‚照型を文字列ã¨ã—ã¦æ‰±ã£ã¦ã„ã¾ã™"
@@ -961,14 +975,14 @@ msgid "E129: Function name required"
msgstr "E129: 関数åãŒè¦æ±‚ã•れã¾ã™"
#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr "E128: 関数åã¯å¤§æ–‡å­—ã§å§‹ã¾ã‚‹ã‹ã‚³ãƒ­ãƒ³ã‚’å«ã¾ãªã‘れã°ãªã‚Šã¾ã›ã‚“: %s"
+msgstr "E128: 関数åã¯å¤§æ–‡å­—ã‹ \"s:\" ã§å§‹ã¾ã‚‰ãªã‘れã°ãªã‚Šã¾ã›ã‚“: %s"
#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr "E128: 関数åã¯å¤§æ–‡å­—ã§å§‹ã¾ã‚‹ã‹ã‚³ãƒ­ãƒ³ã‚’å«ã¾ãªã‘れã°ãªã‚Šã¾ã›ã‚“: %s"
+msgstr "E884: 関数åã«ã¯ã‚³ãƒ­ãƒ³ã¯å«ã‚られã¾ã›ã‚“: %s"
#: ../eval.c:18336
#, c-format
@@ -1081,7 +1095,7 @@ msgstr "E136: viminfo: エラーãŒå¤šéŽãŽã‚‹ã®ã§, 以é™ã¯ã‚¹ã‚­ãƒƒãƒ—ã—ã
#: ../ex_cmds.c:1458
#, c-format
msgid "Reading viminfo file \"%s\"%s%s%s"
-msgstr "viminfoファイル \"%s\"%s%s%s を読込ã¿ä¸­ "
+msgstr "viminfoファイル \"%s\"%s%s%s を読込ã¿ä¸­"
#: ../ex_cmds.c:1460
msgid " info"
@@ -1357,6 +1371,10 @@ msgstr "E158: 無効ãªãƒãƒƒãƒ•ã‚¡åã§ã™: %s"
msgid "E157: Invalid sign ID: %<PRId64>"
msgstr "E157: 無効ãªsign識別å­ã§ã™: %<PRId64>"
+#, c-format
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: 変更ã§ããªã„ sign ã§ã™: %s"
+
#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " (éžã‚µãƒãƒ¼ãƒˆ)"
@@ -1379,6 +1397,13 @@ msgstr "行 %<PRId64>: %s"
msgid "cmd: %s"
msgstr "コマンド: %s"
+msgid "frame is zero"
+msgstr "フレーム㌠0 ã§ã™"
+
+#, c-format
+msgid "frame at highest level: %d"
+msgstr "最高レベルã®ãƒ•レーム: %d"
+
#: ../ex_cmds2.c:322
#, c-format
msgid "Breakpoint in \"%s%s\" line %<PRId64>"
@@ -1528,7 +1553,8 @@ msgstr "E197: 言語を \"%s\" ã«è¨­å®šã§ãã¾ã›ã‚“"
#. don't wait for return
#: ../ex_docmd.c:387
msgid "Entering Ex mode. Type \"visual\" to go to Normal mode."
-msgstr "Exモードã«å…¥ã‚Šã¾ã™. ãƒŽãƒ¼ãƒžãƒ«ã«æˆ»ã‚‹ã«ã¯\"visual\"ã¨å…¥åŠ›ã—ã¦ãã ã•ã„."
+msgstr ""
+"Exモードã«å…¥ã‚Šã¾ã™. ãƒŽãƒ¼ãƒžãƒ«ãƒ¢ãƒ¼ãƒ‰ã«æˆ»ã‚‹ã«ã¯\"visual\"ã¨å…¥åŠ›ã—ã¦ãã ã•ã„."
#: ../ex_docmd.c:428
msgid "E501: At end-of-file"
@@ -1553,7 +1579,7 @@ msgstr "é–¢æ•°ã®æœ€å¾Œã§ã™"
#: ../ex_docmd.c:1628
msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: ユーザ定義コマンドã®ã‚ã„ã¾ã„ãªä½¿ç”¨ã§ã™"
+msgstr "E464: ユーザー定義コマンドã®ã‚ã„ã¾ã„ãªä½¿ç”¨ã§ã™"
#: ../ex_docmd.c:1638
msgid "E492: Not an editor command"
@@ -1606,14 +1632,14 @@ msgstr "E174: ã‚³ãƒžãƒ³ãƒ‰ãŒæ—¢ã«ã‚りã¾ã™: å†å®šç¾©ã™ã‚‹ã«ã¯ ! を追å
#: ../ex_docmd.c:4432
msgid ""
"\n"
-" Name Args Range Complete Definition"
+" Name Args Address Complete Definition"
msgstr ""
"\n"
-" åå‰ å¼•æ•° 範囲 補完 定義"
+" åå‰ å¼•æ•° アドレス 補完 定義"
#: ../ex_docmd.c:4516
msgid "No user-defined commands found"
-msgstr "ユーザ定義コマンドãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸ"
+msgstr "ユーザー定義コマンドãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸ"
#: ../ex_docmd.c:4538
msgid "E175: No attribute specified"
@@ -1633,7 +1659,10 @@ msgstr "E178: カウントã®çœç•¥å€¤ãŒç„¡åйã§ã™"
#: ../ex_docmd.c:4625
msgid "E179: argument required for -complete"
-msgstr "E179: -補完ã®ãŸã‚ã®å¼•æ•°ãŒå¿…è¦ã§ã™"
+msgstr "E179: -complete ã«ã¯å¼•æ•°ãŒå¿…è¦ã§ã™"
+
+msgid "E179: argument required for -addr"
+msgstr "E179: -addr ã«ã¯å¼•æ•°ãŒå¿…è¦ã§ã™"
#: ../ex_docmd.c:4635
#, c-format
@@ -1646,16 +1675,20 @@ msgstr "E182: 無効ãªã‚³ãƒžãƒ³ãƒ‰åã§ã™"
#: ../ex_docmd.c:4691
msgid "E183: User defined commands must start with an uppercase letter"
-msgstr "E183: ユーザ定義コマンドã¯è‹±å¤§æ–‡å­—ã§å§‹ã¾ã‚‰ãªã‘れã°ãªã‚Šã¾ã›ã‚“"
+msgstr "E183: ユーザー定義コマンドã¯è‹±å¤§æ–‡å­—ã§å§‹ã¾ã‚‰ãªã‘れã°ãªã‚Šã¾ã›ã‚“"
#: ../ex_docmd.c:4696
msgid "E841: Reserved name, cannot be used for user defined command"
-msgstr "E841: 予約åãªã®ã§, ユーザ定義コマンドã«åˆ©ç”¨ã§ãã¾ã›ã‚“"
+msgstr "E841: 予約åãªã®ã§, ユーザー定義コマンドã«åˆ©ç”¨ã§ãã¾ã›ã‚“"
#: ../ex_docmd.c:4751
#, c-format
msgid "E184: No such user-defined command: %s"
-msgstr "E184: ãã®ãƒ¦ãƒ¼ã‚¶å®šç¾©ã‚³ãƒžãƒ³ãƒ‰ã¯ã‚りã¾ã›ã‚“: %s"
+msgstr "E184: ãã®ãƒ¦ãƒ¼ã‚¶ãƒ¼å®šç¾©ã‚³ãƒžãƒ³ãƒ‰ã¯ã‚りã¾ã›ã‚“: %s"
+
+#, c-format
+msgid "E180: Invalid address type value: %s"
+msgstr "E180: 無効ãªã‚¢ãƒ‰ãƒ¬ã‚¹ã‚¿ã‚¤ãƒ—値ã§ã™: %s"
#: ../ex_docmd.c:5219
#, c-format
@@ -2019,11 +2052,11 @@ msgstr "䏿­£ãªãƒ•ァイルå"
#: ../fileio.c:395 ../fileio.c:476 ../fileio.c:2543 ../fileio.c:2578
msgid "is a directory"
-msgstr " ã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã™"
+msgstr "ã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ã™"
#: ../fileio.c:397
msgid "is not a file"
-msgstr " ã¯ãƒ•ァイルã§ã¯ã‚りã¾ã›ã‚“"
+msgstr "ã¯ãƒ•ァイルã§ã¯ã‚りã¾ã›ã‚“"
#: ../fileio.c:508 ../fileio.c:3522
msgid "[New File]"
@@ -2039,7 +2072,7 @@ msgstr "[ファイルéŽå¤§]"
#: ../fileio.c:534
msgid "[Permission Denied]"
-msgstr "[èªå¯ãŒã‚りã¾ã›ã‚“]"
+msgstr "[権é™ãŒã‚りã¾ã›ã‚“]"
#: ../fileio.c:653
msgid "E200: *ReadPre autocommands made the file unreadable"
@@ -2210,7 +2243,7 @@ msgstr " 変æ›ã‚¨ãƒ©ãƒ¼"
#: ../fileio.c:3509
#, c-format
msgid " in line %<PRId64>;"
-msgstr "行 %<PRId64>;"
+msgstr " 行 %<PRId64>;"
#: ../fileio.c:3519
msgid "[Device]"
@@ -2766,9 +2799,8 @@ msgid "E37: No write since last change (add ! to override)"
msgstr "E37: 最後ã®å¤‰æ›´ãŒä¿å­˜ã•れã¦ã„ã¾ã›ã‚“ (! を追加ã§å¤‰æ›´ã‚’破棄)"
#: ../globals.h:1055
-#, fuzzy
msgid "E37: No write since last change"
-msgstr "[最後ã®å¤‰æ›´ãŒä¿å­˜ã•れã¦ã„ã¾ã›ã‚“]\n"
+msgstr "E37: 最後ã®å¤‰æ›´ãŒä¿å­˜ã•れã¦ã„ã¾ã›ã‚“"
#: ../globals.h:1056
msgid "E38: Null argument"
@@ -2810,7 +2842,7 @@ msgstr "E42: エラーã¯ã‚りã¾ã›ã‚“"
#: ../globals.h:1067
msgid "E776: No location list"
-msgstr "E776: 場所リストã¯ã‚りã¾ã›ã‚“"
+msgstr "E776: ロケーションリストã¯ã‚りã¾ã›ã‚“"
#: ../globals.h:1068
msgid "E43: Damaged match string"
@@ -3831,7 +3863,7 @@ msgid ""
"\n"
msgstr ""
"\n"
-"ãれã‹ã‚‰.swpファイルを削除ã—ã¦ãã ã•ã„\n"
+"å…ƒã®.swpファイルã¯å‰Šé™¤ã—ã¦ã‚‚æ§‹ã„ã¾ã›ã‚“\n"
"\n"
#. use msg() to start the scrolling properly
@@ -3845,7 +3877,7 @@ msgstr " ç¾åœ¨ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª:\n"
#: ../memline.c:1448
msgid " Using specified name:\n"
-msgstr " ã‚ã‚‹åå‰ã‚’使用中:\n"
+msgstr " 以下ã®åå‰ã‚’使用中:\n"
#: ../memline.c:1450
msgid " In directory "
@@ -3901,7 +3933,7 @@ msgid ""
" user name: "
msgstr ""
"\n"
-" ユーザå: "
+" ユーザーå: "
#: ../memline.c:1568
msgid " host name: "
@@ -4050,12 +4082,12 @@ msgid ""
msgstr ""
"\n"
"(1) 別ã®ãƒ—ログラムãŒåŒã˜ãƒ•ァイルを編集ã—ã¦ã„ã‚‹ã‹ã‚‚ã—れã¾ã›ã‚“.\n"
-" ã“ã®å ´åˆã«ã¯, 変更をã—ãŸéš›ã«æœ€çµ‚çš„ã«, åŒã˜ãƒ•ァイルã®ç•°ãªã‚‹\n"
-" 2ã¤ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ãŒã§ãã¦ã—ã¾ã†ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„."
+" ã“ã®å ´åˆã«ã¯, 変更をã—ã¦ã—ã¾ã†ã¨1ã¤ã®ãƒ•ァイルã«å¯¾ã—ã¦ç•°ãªã‚‹2ã¤ã®\n"
+" インスタンスãŒã§ãã¦ã—ã¾ã†ã®ã§, ãã†ã—ãªã„よã†ã«æ°—ã‚’ã¤ã‘ã¦ãã ã•ã„."
#: ../memline.c:3245
msgid " Quit, or continue with caution.\n"
-msgstr " 終了ã™ã‚‹ã‹, 注æ„ã—ãªãŒã‚‰ç¶šã‘ã¦ãã ã•ã„.\n"
+msgstr " 終了ã™ã‚‹ã‹, 注æ„ã—ãªãŒã‚‰ç¶šã‘ã¦ãã ã•ã„.\n"
#: ../memline.c:3246
msgid "(2) An edit session for this file crashed.\n"
@@ -4479,6 +4511,11 @@ msgstr ""
msgid "E574: Unknown register type %d"
msgstr "E574: 未知ã®ãƒ¬ã‚¸ã‚¹ã‚¿åž‹ %d ã§ã™"
+msgid ""
+"E883: search pattern and expression register may not contain two or more "
+"lines"
+msgstr "E883: 検索パターンã¨å¼ãƒ¬ã‚¸ã‚¹ã‚¿ã«ã¯2行以上をå«ã‚られã¾ã›ã‚“"
+
#: ../ops.c:5089
#, c-format
msgid "%<PRId64> Cols; "
@@ -4563,6 +4600,10 @@ msgstr "E522: termcap 内ã«è¦‹ã¤ã‹ã‚Šã¾ã›ã‚“"
msgid "E539: Illegal character <%s>"
msgstr "E539: 䏿­£ãªæ–‡å­—ã§ã™ <%s>"
+#, c-format
+msgid "For option %s"
+msgstr "オプション: %s"
+
#: ../option.c:3862
msgid "E529: Cannot set 'term' to empty string"
msgstr "E529: 'term' ã«ã¯ç©ºæ–‡å­—列を設定ã§ãã¾ã›ã‚“"
@@ -4740,6 +4781,14 @@ msgstr ""
"\n"
"セキュリティコンテキストを設定ã§ãã¾ã›ã‚“ "
+#, c-format
+msgid "Could not set security context %s for %s"
+msgstr "セキュリティコンテキスト %s ã‚’ %s ã«è¨­å®šã§ãã¾ã›ã‚“"
+
+#, c-format
+msgid "Could not get security context %s for %s. Removing it!"
+msgstr "セキュリティコンテキスト %s ã‚’ %s ã‹ã‚‰å–å¾—ã§ãã¾ã›ã‚“. 削除ã—ã¾ã™!"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -4960,6 +5009,10 @@ msgstr "E554: %s{...} å†…ã«æ–‡æ³•エラーãŒã‚りã¾ã™"
msgid "External submatches:\n"
msgstr "外部ã®éƒ¨åˆ†è©²å½“:\n"
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (NFA æ­£è¦è¡¨ç¾) 繰り返ã›ã¾ã›ã‚“ %s"
+
#: ../regexp.c:7022
msgid ""
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be "
@@ -4968,6 +5021,9 @@ msgstr ""
"E864: \\%#= ã«ã¯ 0, 1 ã‚‚ã—ã㯠2 ã®ã¿ãŒç¶šã‘られã¾ã™ã€‚æ­£è¦è¡¨ç¾ã‚¨ãƒ³ã‚¸ãƒ³ã¯è‡ªå‹•é¸"
"択ã•れã¾ã™ã€‚"
+msgid "Switching to backtracking RE engine for pattern: "
+msgstr "次ã®ãƒ‘ターンã«ãƒãƒƒã‚¯ãƒˆãƒ©ãƒƒã‚­ãƒ³ã‚° RE エンジンをé©ç”¨ã—ã¾ã™: "
+
#: ../regexp_nfa.c:239
msgid "E865: (NFA) Regexp end encountered prematurely"
msgstr "E865: (NFA) æœŸå¾…ã‚ˆã‚Šæ—©ãæ­£è¦è¡¨ç¾ã®çµ‚端ã«åˆ°é”ã—ã¾ã—ãŸ"
@@ -4980,7 +5036,7 @@ msgstr "E866: (NFA æ­£è¦è¡¨ç¾) ä½ç½®ãŒèª¤ã£ã¦ã„ã¾ã™: %c"
#: ../regexp_nfa.c:242
#, c-format
msgid "E877: (NFA regexp) Invalid character class: %<PRId64>"
-msgstr ""
+msgstr "E877: (NFA æ­£è¦è¡¨ç¾) ç„¡åŠ¹ãªæ–‡å­—クラス: %<PRId64>"
#: ../regexp_nfa.c:1261
#, c-format
@@ -5590,12 +5646,12 @@ msgid "E765: 'spellfile' does not have %<PRId64> entries"
msgstr "E765: 'spellfile' ã«ã¯ %<PRId64> 個ã®ã‚¨ãƒ³ãƒˆãƒªã¯ã‚りã¾ã›ã‚“"
#: ../spell.c:8074
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' removed from %s"
-msgstr "%s ã‹ã‚‰å˜èªžãŒå‰Šé™¤ã•れã¾ã—ãŸ"
+msgstr "å˜èªž '%.*s' ㌠%s ã‹ã‚‰å‰Šé™¤ã•れã¾ã—ãŸ"
#: ../spell.c:8117
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' added to %s"
msgstr "%s ã«å˜èªžãŒè¿½åŠ ã•れã¾ã—ãŸ"
@@ -5673,6 +5729,9 @@ msgstr "ã“ã®ãƒãƒƒãƒ•ã‚¡ã«å®šç¾©ã•ã‚ŒãŸæ§‹æ–‡è¦ç´ ã¯ã‚りã¾ã›ã‚“"
msgid "E390: Illegal argument: %s"
msgstr "E390: 䏿­£ãªå¼•æ•°ã§ã™: %s"
+msgid "syntax iskeyword "
+msgstr "シンタックス用 iskeyword "
+
#: ../syntax.c:3299
#, c-format
msgid "E391: No such syntax cluster: %s"
@@ -5769,6 +5828,10 @@ msgstr "E847: æ§‹æ–‡ã®å–り込ã¿(include)ãŒå¤šéŽãŽã¾ã™"
msgid "E789: Missing ']': %s"
msgstr "E789: ']' ãŒã‚りã¾ã›ã‚“: %s"
+#, c-format
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: ']' ã®å¾Œã‚ã«ä½™åˆ†ãªæ–‡å­—ãŒã‚りã¾ã™: %s]%s"
+
#: ../syntax.c:4531
#, c-format
msgid "E398: Missing '=': %s"
@@ -5874,7 +5937,7 @@ msgstr "E415: 予期ã›ã¬ç­‰å·ã§ã™: %s"
#: ../syntax.c:6395
#, c-format
msgid "E416: missing equal sign: %s"
-msgstr "E416: ç­‰å·ãŒãŒã‚りã¾ã›ã‚“: %s"
+msgstr "E416: ç­‰å·ãŒã‚りã¾ã›ã‚“: %s"
#: ../syntax.c:6418
#, c-format
@@ -6078,9 +6141,8 @@ msgstr "Vim: 入力を読込ã¿ä¸­ã®ã‚¨ãƒ©ãƒ¼ã«ã‚ˆã‚Šçµ‚了ã—ã¾ã™...\n"
#. This happens when the FileChangedRO autocommand changes the
#. * file in a way it becomes shorter.
#: ../undo.c:379
-#, fuzzy
msgid "E881: Line count changed unexpectedly"
-msgstr "E834: 予期ã›ãšè¡Œã‚«ã‚¦ãƒ³ãƒˆãŒå¤‰ã‚りã¾ã—ãŸ"
+msgstr "E881: 予期ã›ãšè¡Œã‚«ã‚¦ãƒ³ãƒˆãŒå¤‰ã‚りã¾ã—ãŸ"
#: ../undo.c:627
#, c-format
@@ -6287,23 +6349,23 @@ msgstr " システム vimrc: \""
#: ../version.c:672
msgid " user vimrc file: \""
-msgstr " ユーザ vimrc: \""
+msgstr " ユーザー vimrc: \""
#: ../version.c:677
msgid " 2nd user vimrc file: \""
-msgstr " 第2ユーザ vimrc: \""
+msgstr " 第2ユーザー vimrc: \""
#: ../version.c:682
msgid " 3rd user vimrc file: \""
-msgstr " 第3ユーザ vimrc: \""
+msgstr " 第3ユーザー vimrc: \""
#: ../version.c:687
msgid " user exrc file: \""
-msgstr " ユーザ exrc: \""
+msgstr " ユーザー exrc: \""
#: ../version.c:692
msgid " 2nd user exrc file: \""
-msgstr " 第2ユーザ exrc: \""
+msgstr " 第2ユーザー exrc: \""
#: ../version.c:699
msgid " fall-back for $VIM: \""
@@ -6379,7 +6441,7 @@ msgstr "Vimã®é–‹ç™ºã‚’応æ´ã—ã¦ãã ã•ã„!"
#: ../version.c:828
msgid "Become a registered Vim user!"
-msgstr "Vimã®ç™»éŒ²ãƒ¦ãƒ¼ã‚¶ã«ãªã£ã¦ãã ã•ã„!"
+msgstr "Vimã®ç™»éŒ²ãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ãªã£ã¦ãã ã•ã„!"
#: ../version.c:831
msgid "type :help sponsor<Enter> for information "
@@ -6391,7 +6453,7 @@ msgstr "è©³ç´°ãªæƒ…報㯠:help register<Enter> "
#: ../version.c:834
msgid "menu Help->Sponsor/Register for information "
-msgstr "詳細ã¯ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã® ヘルプ→スãƒãƒ³ã‚µãƒ¼/登録 ã‚’å‚ç…§ã—ã¦ä¸‹ã•ã„ "
+msgstr "詳細ã¯ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã® ヘルプ->スãƒãƒ³ã‚µãƒ¼/登録 ã‚’å‚ç…§ã—ã¦ä¸‹ã•ã„"
#: ../window.c:119
msgid "Already only one window"
@@ -6429,6 +6491,9 @@ msgstr "E445: ä»–ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«ã¯å¤‰æ›´ãŒã‚りã¾ã™"
msgid "E446: No file name under cursor"
msgstr "E446: カーソルã®ä¸‹ã«ãƒ•ァイルåãŒã‚りã¾ã›ã‚“"
+msgid "List or number required"
+msgstr "ãƒªã‚¹ãƒˆã‹æ•°å€¤ãŒå¿…è¦ã§ã™"
+
#~ msgid "E831: bf_key_init() called with empty password"
#~ msgstr "E831: bf_key_init() ãŒç©ºãƒ‘スワードã§å‘¼ã³å‡ºã•れã¾ã—ãŸ"
diff --git a/src/nvim/po/ja.sjis.po b/src/nvim/po/ja.sjis.po
index 7dac89e172..16a5d2ce36 100644
--- a/src/nvim/po/ja.sjis.po
+++ b/src/nvim/po/ja.sjis.po
@@ -1,11 +1,11 @@
-# Japanese translation for Vim vim:set foldmethod=marker:
+# Japanese translation for Vim
#
# Do ":help uganda" in Vim to read copying and usage conditions.
# Do ":help credits" in Vim to see a list of people who contributed.
#
-# Last Change: 2013 Jul 06
+# Copyright (C) 2001-2016 MURAOKA Taro <koron.kaoriya@gmail.com>,
+# vim-jp (http://vim-jp.org/)
#
-# Copyright (C) 2001-13 MURAOKA Taro <koron.kaoriya@gmail.com>
# THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE.
#
# Original translations.
@@ -14,10 +14,10 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim 7.4\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2013-07-06 15:00+0900\n"
+"POT-Creation-Date: 2016-02-01 09:02+0900\n"
+"PO-Revision-Date: 2016-02-01 09:08+0900\n"
"Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
-"Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n"
+"Language-Team: vim-jpj (https://github.com/vim-jp/lang-ja)\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=cp932\n"
@@ -34,7 +34,7 @@ msgstr "“à•”ƒGƒ‰[: –¢’m‚̃IƒvƒVƒ‡ƒ“Œ^‚Å‚·"
#: ../buffer.c:92
msgid "[Location List]"
-msgstr "[êŠƒŠƒXƒg]"
+msgstr "[ƒƒP[ƒVƒ‡ƒ“ƒŠƒXƒg]"
#: ../buffer.c:93
msgid "[Quickfix List]"
@@ -277,7 +277,7 @@ msgstr "E810: ˆêŽžƒtƒ@ƒCƒ‹‚̓Ǟ‚à‚µ‚­‚Í‘ž‚ª‚Å‚«‚Ü‚¹‚ñ"
#: ../diff.c:755
msgid "E97: Cannot create diffs"
-msgstr "E97: ·•ª‚ð쬂ł«‚Ü‚¹‚ñ "
+msgstr "E97: ·•ª‚ð쬂ł«‚Ü‚¹‚ñ"
#: ../diff.c:966
msgid "E816: Cannot read patch output"
@@ -293,7 +293,7 @@ msgstr "E99: Œ»Ý‚̃oƒbƒtƒ@‚Í·•ªƒ‚[ƒh‚ł͂ ‚è‚Ü‚¹‚ñ"
#: ../diff.c:2100
msgid "E793: No other buffer in diff mode is modifiable"
-msgstr "E793: ·•ªƒ‚[ƒh‚Å‚ ‚鑼‚̃oƒbƒtƒ@‚Í•ÏX‰Â”\\‚Å‚·"
+msgstr "E793: ·•ªƒ‚[ƒh‚Å‚ ‚鑼‚̃oƒbƒtƒ@‚Í•ÏX‚Å‚«‚Ü‚¹‚ñ"
#: ../diff.c:2102
msgid "E100: No other buffer in diff mode"
@@ -349,7 +349,7 @@ msgstr " s(‘S‘Ì)•⊮ (^L^N^P)"
#: ../edit.c:86
msgid " File name completion (^F^N^P)"
-msgstr "ƒtƒ@ƒCƒ‹–¼•⊮ (^F^N^P)"
+msgstr " ƒtƒ@ƒCƒ‹–¼•⊮ (^F^N^P)"
#: ../edit.c:87
msgid " Tag completion (^]^N^P)"
@@ -377,7 +377,7 @@ msgstr " ƒRƒ}ƒ“ƒhƒ‰ƒCƒ“•⊮ (^V^N^P)"
#: ../edit.c:94
msgid " User defined completion (^U^N^P)"
-msgstr " ƒ†[ƒU’è‹`•⊮ (^U^N^P)"
+msgstr " ƒ†[ƒU[’è‹`•⊮ (^U^N^P)"
#: ../edit.c:95
msgid " Omni completion (^O^N^P)"
@@ -679,6 +679,10 @@ msgstr "E696: ƒŠƒXƒgŒ^‚ɃJƒ“ƒ}‚ª‚ ‚è‚Ü‚¹‚ñ: %s"
msgid "E697: Missing end of List ']': %s"
msgstr "E697: ƒŠƒXƒgŒ^‚ÌÅŒã‚É ']' ‚ª‚ ‚è‚Ü‚¹‚ñ: %s"
+msgid "Not enough memory to set references, garbage collection aborted!"
+msgstr ""
+"ƒK[ƒxƒbƒWƒRƒŒƒNƒVƒ‡ƒ“‚𒆎~‚µ‚Ü‚µ‚½! ŽQÆ‚ð쬂·‚é‚̂Ƀƒ‚ƒŠ‚ª•s‘«‚µ‚Ü‚µ‚½"
+
#: ../eval.c:6475
#, c-format
msgid "E720: Missing colon in Dictionary: %s"
@@ -721,7 +725,7 @@ msgstr "E117: –¢’m‚ÌŠÖ”‚Å‚·: %s"
#: ../eval.c:7383
#, c-format
msgid "E119: Not enough arguments for function: %s"
-msgstr "E119: ŠÖ”‚̈ø”‚ª­‚ȉ߂¬‚Ü‚·: %s"
+msgstr "E119: ŠÖ”‚̈ø”‚ª‘«‚è‚Ü‚¹‚ñ: %s"
#: ../eval.c:7387
#, c-format
@@ -826,18 +830,16 @@ msgid "sort() argument"
msgstr "sort() ‚̈ø”"
#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr "add() ‚̈ø”"
+msgstr "uniq() ‚̈ø”"
#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: ƒ\\[ƒg‚Ì”äŠrŠÖ”‚ªŽ¸”s‚µ‚Ü‚µ‚½"
#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: ƒ\\[ƒg‚Ì”äŠrŠÖ”‚ªŽ¸”s‚µ‚Ü‚µ‚½"
+msgstr "E882: Uniq ‚Ì”äŠrŠÖ”‚ªŽ¸”s‚µ‚Ü‚µ‚½"
#: ../eval.c:14085
msgid "(Invalid)"
@@ -863,6 +865,18 @@ msgstr "E745: ƒŠƒXƒgŒ^‚ð”’l‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
msgid "E728: Using a Dictionary as a Number"
msgstr "E728: Ž«‘Œ^‚ð”’l‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: ŠÖ”ŽQÆŒ^‚ð•‚“®¬”“_”‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·B"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: •¶Žš—ñ‚ð•‚“®¬”“_”‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: ƒŠƒXƒgŒ^‚ð•‚“®¬”“_”‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: Ž«‘Œ^‚ð•‚“®¬”“_”‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
+
#: ../eval.c:16259
msgid "E729: using Funcref as a String"
msgstr "E729: ŠÖ”ŽQÆŒ^‚ð•¶Žš—ñ‚Æ‚µ‚Ĉµ‚Á‚Ä‚¢‚Ü‚·"
@@ -961,14 +975,14 @@ msgid "E129: Function name required"
msgstr "E129: ŠÖ”–¼‚ª—v‹‚³‚ê‚Ü‚·"
#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr "E128: ŠÖ”–¼‚Í‘å•¶Žš‚ÅŽn‚܂邩ƒRƒƒ“‚ðŠÜ‚܂Ȃ¯‚ê‚΂Ȃè‚Ü‚¹‚ñ: %s"
+msgstr "E128: ŠÖ”–¼‚Í‘å•¶Žš‚© \"s:\" ‚ÅŽn‚Ü‚ç‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ: %s"
#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr "E128: ŠÖ”–¼‚Í‘å•¶Žš‚ÅŽn‚܂邩ƒRƒƒ“‚ðŠÜ‚܂Ȃ¯‚ê‚΂Ȃè‚Ü‚¹‚ñ: %s"
+msgstr "E884: ŠÖ”–¼‚ɂ̓Rƒƒ“‚͊܂߂ç‚ê‚Ü‚¹‚ñ: %s"
#: ../eval.c:18336
#, c-format
@@ -1081,7 +1095,7 @@ msgstr "E136: viminfo: ƒGƒ‰[‚ª‘½‰ß‚¬‚é‚Ì‚Å, ˆÈ~‚̓XƒLƒbƒv‚µ‚Ü‚·"
#: ../ex_cmds.c:1458
#, c-format
msgid "Reading viminfo file \"%s\"%s%s%s"
-msgstr "viminfoƒtƒ@ƒCƒ‹ \"%s\"%s%s%s ‚ð“Çž‚Ý’† "
+msgstr "viminfoƒtƒ@ƒCƒ‹ \"%s\"%s%s%s ‚ð“Çž‚Ý’†"
#: ../ex_cmds.c:1460
msgid " info"
@@ -1357,6 +1371,10 @@ msgstr "E158: –³Œø‚ȃoƒbƒtƒ@–¼‚Å‚·: %s"
msgid "E157: Invalid sign ID: %<PRId64>"
msgstr "E157: –³Œø‚Èsignޝ•ÊŽq‚Å‚·: %<PRId64>"
+#, c-format
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: •ÏX‚Å‚«‚È‚¢ sign ‚Å‚·: %s"
+
#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " (”ñƒTƒ|[ƒg)"
@@ -1379,6 +1397,13 @@ msgstr "s %<PRId64>: %s"
msgid "cmd: %s"
msgstr "ƒRƒ}ƒ“ƒh: %s"
+msgid "frame is zero"
+msgstr "ƒtƒŒ[ƒ€‚ª 0 ‚Å‚·"
+
+#, c-format
+msgid "frame at highest level: %d"
+msgstr "Å‚ƒŒƒxƒ‹‚̃tƒŒ[ƒ€: %d"
+
#: ../ex_cmds2.c:322
#, c-format
msgid "Breakpoint in \"%s%s\" line %<PRId64>"
@@ -1528,7 +1553,8 @@ msgstr "E197: Œ¾Œê‚ð \"%s\" ‚ÉÝ’è‚Å‚«‚Ü‚¹‚ñ"
#. don't wait for return
#: ../ex_docmd.c:387
msgid "Entering Ex mode. Type \"visual\" to go to Normal mode."
-msgstr "Exƒ‚[ƒh‚É“ü‚è‚Ü‚·. ƒm[ƒ}ƒ‹‚É–ß‚é‚É‚Í\"visual\"‚Æ“ü—Í‚µ‚Ä‚­‚¾‚³‚¢."
+msgstr ""
+"Exƒ‚[ƒh‚É“ü‚è‚Ü‚·. ƒm[ƒ}ƒ‹ƒ‚[ƒh‚É–ß‚é‚É‚Í\"visual\"‚Æ“ü—Í‚µ‚Ä‚­‚¾‚³‚¢."
#: ../ex_docmd.c:428
msgid "E501: At end-of-file"
@@ -1553,7 +1579,7 @@ msgstr "ŠÖ”‚ÌÅŒã‚Å‚·"
#: ../ex_docmd.c:1628
msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: ƒ†[ƒU’è‹`ƒRƒ}ƒ“ƒh‚Ì‚ ‚¢‚Ü‚¢‚ÈŽg—p‚Å‚·"
+msgstr "E464: ƒ†[ƒU[’è‹`ƒRƒ}ƒ“ƒh‚Ì‚ ‚¢‚Ü‚¢‚ÈŽg—p‚Å‚·"
#: ../ex_docmd.c:1638
msgid "E492: Not an editor command"
@@ -1606,14 +1632,14 @@ msgstr "E174: ƒRƒ}ƒ“ƒh‚ªŠù‚É‚ ‚è‚Ü‚·: Ä’è‹`‚·‚é‚É‚Í ! ‚ð’ljÁ‚µ‚Ä‚­‚¾‚³‚¢"
#: ../ex_docmd.c:4432
msgid ""
"\n"
-" Name Args Range Complete Definition"
+" Name Args Address Complete Definition"
msgstr ""
"\n"
-" –¼‘O ˆø” ”ÍˆÍ •⊮ ’è‹`"
+" –¼‘O ˆø” ƒAƒhƒŒƒX •⊮ ’è‹`"
#: ../ex_docmd.c:4516
msgid "No user-defined commands found"
-msgstr "ƒ†[ƒU’è‹`ƒRƒ}ƒ“ƒh‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½"
+msgstr "ƒ†[ƒU[’è‹`ƒRƒ}ƒ“ƒh‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½"
#: ../ex_docmd.c:4538
msgid "E175: No attribute specified"
@@ -1633,7 +1659,10 @@ msgstr "E178: ƒJƒEƒ“ƒg‚ÌÈ—ª’l‚ª–³Œø‚Å‚·"
#: ../ex_docmd.c:4625
msgid "E179: argument required for -complete"
-msgstr "E179: -•⊮‚Ì‚½‚߂̈ø”‚ª•K—v‚Å‚·"
+msgstr "E179: -complete ‚ɂ͈ø”‚ª•K—v‚Å‚·"
+
+msgid "E179: argument required for -addr"
+msgstr "E179: -addr ‚ɂ͈ø”‚ª•K—v‚Å‚·"
#: ../ex_docmd.c:4635
#, c-format
@@ -1646,16 +1675,20 @@ msgstr "E182: –³Œø‚ȃRƒ}ƒ“ƒh–¼‚Å‚·"
#: ../ex_docmd.c:4691
msgid "E183: User defined commands must start with an uppercase letter"
-msgstr "E183: ƒ†[ƒU’è‹`ƒRƒ}ƒ“ƒh‚͉p‘å•¶Žš‚ÅŽn‚Ü‚ç‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ"
+msgstr "E183: ƒ†[ƒU[’è‹`ƒRƒ}ƒ“ƒh‚͉p‘å•¶Žš‚ÅŽn‚Ü‚ç‚È‚¯‚ê‚΂Ȃè‚Ü‚¹‚ñ"
#: ../ex_docmd.c:4696
msgid "E841: Reserved name, cannot be used for user defined command"
-msgstr "E841: —\\–ñ–¼‚Ȃ̂Å, ƒ†[ƒU’è‹`ƒRƒ}ƒ“ƒh‚É—˜—p‚Å‚«‚Ü‚¹‚ñ"
+msgstr "E841: —\\–ñ–¼‚Ȃ̂Å, ƒ†[ƒU[’è‹`ƒRƒ}ƒ“ƒh‚É—˜—p‚Å‚«‚Ü‚¹‚ñ"
#: ../ex_docmd.c:4751
#, c-format
msgid "E184: No such user-defined command: %s"
-msgstr "E184: ‚»‚̃†[ƒU’è‹`ƒRƒ}ƒ“ƒh‚Í‚ ‚è‚Ü‚¹‚ñ: %s"
+msgstr "E184: ‚»‚̃†[ƒU[’è‹`ƒRƒ}ƒ“ƒh‚Í‚ ‚è‚Ü‚¹‚ñ: %s"
+
+#, c-format
+msgid "E180: Invalid address type value: %s"
+msgstr "E180: –³Œø‚ȃAƒhƒŒƒXƒ^ƒCƒv’l‚Å‚·: %s"
#: ../ex_docmd.c:5219
#, c-format
@@ -2019,11 +2052,11 @@ msgstr "•s³‚ȃtƒ@ƒCƒ‹–¼"
#: ../fileio.c:395 ../fileio.c:476 ../fileio.c:2543 ../fileio.c:2578
msgid "is a directory"
-msgstr " ‚̓fƒBƒŒƒNƒgƒŠ‚Å‚·"
+msgstr "‚̓fƒBƒŒƒNƒgƒŠ‚Å‚·"
#: ../fileio.c:397
msgid "is not a file"
-msgstr " ‚̓tƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"
+msgstr "‚̓tƒ@ƒCƒ‹‚ł͂ ‚è‚Ü‚¹‚ñ"
#: ../fileio.c:508 ../fileio.c:3522
msgid "[New File]"
@@ -2039,7 +2072,7 @@ msgstr "[ƒtƒ@ƒCƒ‹‰ß‘å]"
#: ../fileio.c:534
msgid "[Permission Denied]"
-msgstr "[”F‰Â‚ª‚ ‚è‚Ü‚¹‚ñ]"
+msgstr "[Œ ŒÀ‚ª‚ ‚è‚Ü‚¹‚ñ]"
#: ../fileio.c:653
msgid "E200: *ReadPre autocommands made the file unreadable"
@@ -2210,7 +2243,7 @@ msgstr " •ÏŠ·ƒGƒ‰["
#: ../fileio.c:3509
#, c-format
msgid " in line %<PRId64>;"
-msgstr "s %<PRId64>;"
+msgstr " s %<PRId64>;"
#: ../fileio.c:3519
msgid "[Device]"
@@ -2766,9 +2799,8 @@ msgid "E37: No write since last change (add ! to override)"
msgstr "E37: ÅŒã‚Ì•ÏX‚ª•Û‘¶‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ (! ‚ð’ljÁ‚Å•ÏX‚ð”jŠü)"
#: ../globals.h:1055
-#, fuzzy
msgid "E37: No write since last change"
-msgstr "[ÅŒã‚Ì•ÏX‚ª•Û‘¶‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ]\n"
+msgstr "E37: ÅŒã‚Ì•ÏX‚ª•Û‘¶‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ"
#: ../globals.h:1056
msgid "E38: Null argument"
@@ -2810,7 +2842,7 @@ msgstr "E42: ƒGƒ‰[‚Í‚ ‚è‚Ü‚¹‚ñ"
#: ../globals.h:1067
msgid "E776: No location list"
-msgstr "E776: êŠƒŠƒXƒg‚Í‚ ‚è‚Ü‚¹‚ñ"
+msgstr "E776: ƒƒP[ƒVƒ‡ƒ“ƒŠƒXƒg‚Í‚ ‚è‚Ü‚¹‚ñ"
#: ../globals.h:1068
msgid "E43: Damaged match string"
@@ -2931,6 +2963,10 @@ msgstr "E363: ƒpƒ^[ƒ“‚ª 'maxmempattern' ˆÈã‚̃ƒ‚ƒŠ‚ðŽg—p‚µ‚Ü‚·"
msgid "E749: empty buffer"
msgstr "E749: ƒoƒbƒtƒ@‚ª‹ó‚Å‚·"
+#, c-format
+msgid "E86: Buffer %ld does not exist"
+msgstr "E86: ƒoƒbƒtƒ@ %ld ‚Í‚ ‚è‚Ü‚¹‚ñ"
+
#: ../globals.h:1108
msgid "E682: Invalid search pattern or delimiter"
msgstr "E682: ŒŸõƒpƒ^[ƒ“‚©‹æØ‚è‹L†‚ª•s³‚Å‚·"
@@ -3831,7 +3867,7 @@ msgid ""
"\n"
msgstr ""
"\n"
-"‚»‚ê‚©‚ç.swpƒtƒ@ƒCƒ‹‚ð휂µ‚Ä‚­‚¾‚³‚¢\n"
+"Œ³‚Ì.swpƒtƒ@ƒCƒ‹‚Í휂µ‚Ä‚à\\‚¢‚Ü‚¹‚ñ\n"
"\n"
#. use msg() to start the scrolling properly
@@ -3845,7 +3881,7 @@ msgstr " Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ:\n"
#: ../memline.c:1448
msgid " Using specified name:\n"
-msgstr " ‚ ‚é–¼‘O‚ðŽg—p’†:\n"
+msgstr " ˆÈ‰º‚Ì–¼‘O‚ðŽg—p’†:\n"
#: ../memline.c:1450
msgid " In directory "
@@ -3901,7 +3937,7 @@ msgid ""
" user name: "
msgstr ""
"\n"
-" ƒ†[ƒU–¼: "
+" ƒ†[ƒU[–¼: "
#: ../memline.c:1568
msgid " host name: "
@@ -4050,12 +4086,12 @@ msgid ""
msgstr ""
"\n"
"(1) •ʂ̃vƒƒOƒ‰ƒ€‚ª“¯‚¶ƒtƒ@ƒCƒ‹‚ð•ÒW‚µ‚Ä‚¢‚é‚©‚à‚µ‚ê‚Ü‚¹‚ñ.\n"
-" ‚±‚ÌꇂɂÍ, •ÏX‚ð‚µ‚½Û‚ÉÅI“I‚É, “¯‚¶ƒtƒ@ƒCƒ‹‚̈قȂé\n"
-" 2‚‚̃Cƒ“ƒXƒ^ƒ“ƒX‚ª‚Å‚«‚Ä‚µ‚Ü‚¤‚±‚ƂɒˆÓ‚µ‚Ä‚­‚¾‚³‚¢."
+" ‚±‚ÌꇂɂÍ, •ÏX‚ð‚µ‚Ä‚µ‚Ü‚¤‚Æ1‚‚̃tƒ@ƒCƒ‹‚ɑ΂µ‚ĈقȂé2‚‚Ì\n"
+" ƒCƒ“ƒXƒ^ƒ“ƒX‚ª‚Å‚«‚Ä‚µ‚Ü‚¤‚Ì‚Å, ‚»‚¤‚µ‚È‚¢‚悤‚É‹C‚ð‚‚¯‚Ä‚­‚¾‚³‚¢."
#: ../memline.c:3245
msgid " Quit, or continue with caution.\n"
-msgstr " I—¹‚·‚é‚©, ’ˆÓ‚µ‚È‚ª‚瑱‚¯‚Ä‚­‚¾‚³‚¢.\n"
+msgstr " I—¹‚·‚é‚©, ’ˆÓ‚µ‚È‚ª‚瑱‚¯‚Ä‚­‚¾‚³‚¢.\n"
#: ../memline.c:3246
msgid "(2) An edit session for this file crashed.\n"
@@ -4479,6 +4515,11 @@ msgstr ""
msgid "E574: Unknown register type %d"
msgstr "E574: –¢’m‚̃ŒƒWƒXƒ^Œ^ %d ‚Å‚·"
+msgid ""
+"E883: search pattern and expression register may not contain two or more "
+"lines"
+msgstr "E883: ŒŸõƒpƒ^[ƒ“‚ÆŽ®ƒŒƒWƒXƒ^‚É‚Í2sˆÈã‚ðŠÜ‚ß‚ç‚ê‚Ü‚¹‚ñ"
+
#: ../ops.c:5089
#, c-format
msgid "%<PRId64> Cols; "
@@ -4563,6 +4604,10 @@ msgstr "E522: termcap “à‚ÉŒ©‚‚©‚è‚Ü‚¹‚ñ"
msgid "E539: Illegal character <%s>"
msgstr "E539: •s³‚È•¶Žš‚Å‚· <%s>"
+#, c-format
+msgid "For option %s"
+msgstr "ƒIƒvƒVƒ‡ƒ“: %s"
+
#: ../option.c:3862
msgid "E529: Cannot set 'term' to empty string"
msgstr "E529: 'term' ‚ɂ͋󕶎š—ñ‚ðÝ’è‚Å‚«‚Ü‚¹‚ñ"
@@ -4740,6 +4785,14 @@ msgstr ""
"\n"
"ƒZƒLƒ…ƒŠƒeƒBƒRƒ“ƒeƒLƒXƒg‚ðÝ’è‚Å‚«‚Ü‚¹‚ñ "
+#, c-format
+msgid "Could not set security context %s for %s"
+msgstr "ƒZƒLƒ…ƒŠƒeƒBƒRƒ“ƒeƒLƒXƒg %s ‚ð %s ‚ÉÝ’è‚Å‚«‚Ü‚¹‚ñ"
+
+#, c-format
+msgid "Could not get security context %s for %s. Removing it!"
+msgstr "ƒZƒLƒ…ƒŠƒeƒBƒRƒ“ƒeƒLƒXƒg %s ‚ð %s ‚©‚çŽæ“¾‚Å‚«‚Ü‚¹‚ñ. 휂µ‚Ü‚·!"
+
#: ../os_unix.c:1558 ../os_unix.c:1647
#, c-format
msgid "dlerror = \"%s\""
@@ -4960,6 +5013,10 @@ msgstr "E554: %s{...} “à‚É•¶–@ƒGƒ‰[‚ª‚ ‚è‚Ü‚·"
msgid "External submatches:\n"
msgstr "ŠO•”‚Ì•”•ªŠY“–:\n"
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (NFA ³‹K•\\Œ») ŒJ‚è•Ô‚¹‚Ü‚¹‚ñ %s"
+
#: ../regexp.c:7022
msgid ""
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be "
@@ -4968,7 +5025,9 @@ msgstr ""
"E864: \\%#= ‚É‚Í 0, 1 ‚à‚µ‚­‚Í 2 ‚݂̂ª‘±‚¯‚ç‚ê‚Ü‚·B³‹K•\\Œ»ƒGƒ“ƒWƒ“‚ÍŽ©“®‘I"
"‘ð‚³‚ê‚Ü‚·B"
-#: ../regexp_nfa.c:239
+msgid "Switching to backtracking RE engine for pattern: "
+msgstr "ŽŸ‚̃pƒ^[ƒ“‚ɃoƒbƒNƒgƒ‰ƒbƒLƒ“ƒO RE ƒGƒ“ƒWƒ“‚ð“K—p‚µ‚Ü‚·: "
+
msgid "E865: (NFA) Regexp end encountered prematurely"
msgstr "E865: (NFA) Šú‘Ò‚æ‚è‘‚­³‹K•\\Œ»‚ÌI’[‚É“ž’B‚µ‚Ü‚µ‚½"
@@ -4980,7 +5039,7 @@ msgstr "E866: (NFA ³‹K•\\Œ») ˆÊ’u‚ªŒë‚Á‚Ä‚¢‚Ü‚·: %c"
#: ../regexp_nfa.c:242
#, c-format
msgid "E877: (NFA regexp) Invalid character class: %<PRId64>"
-msgstr ""
+msgstr "E877: (NFA ³‹K•\\Œ») –³Œø‚È•¶ŽšƒNƒ‰ƒX: %<PRId64>"
#: ../regexp_nfa.c:1261
#, c-format
@@ -5590,14 +5649,14 @@ msgid "E765: 'spellfile' does not have %<PRId64> entries"
msgstr "E765: 'spellfile' ‚É‚Í %<PRId64> ŒÂ‚̃Gƒ“ƒgƒŠ‚Í‚ ‚è‚Ü‚¹‚ñ"
#: ../spell.c:8074
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' removed from %s"
-msgstr "%s ‚©‚ç’PŒê‚ªíœ‚³‚ê‚Ü‚µ‚½"
+msgstr "’PŒê '%.*s' ‚ª %s ‚©‚ç휂³‚ê‚Ü‚µ‚½"
#: ../spell.c:8117
-#, fuzzy, c-format
+#, c-format
msgid "Word '%.*s' added to %s"
-msgstr "%s ‚É’PŒê‚ª’ljÁ‚³‚ê‚Ü‚µ‚½"
+msgstr "’PŒê '%.*s' ‚ª %s ‚֒ljÁ‚³‚ê‚Ü‚µ‚½"
#: ../spell.c:8381
msgid "E763: Word characters differ between spell files"
@@ -5673,6 +5732,9 @@ msgstr "‚±‚̃oƒbƒtƒ@‚É’è‹`‚³‚ꂽ\\•¶—v‘f‚Í‚ ‚è‚Ü‚¹‚ñ"
msgid "E390: Illegal argument: %s"
msgstr "E390: •s³‚Ȉø”‚Å‚·: %s"
+msgid "syntax iskeyword "
+msgstr "ƒVƒ“ƒ^ƒbƒNƒX—p iskeyword "
+
#: ../syntax.c:3299
#, c-format
msgid "E391: No such syntax cluster: %s"
@@ -5769,6 +5831,10 @@ msgstr "E847: \\•¶‚ÌŽæ‚èž‚Ý(include)‚ª‘½‰ß‚¬‚Ü‚·"
msgid "E789: Missing ']': %s"
msgstr "E789: ']' ‚ª‚ ‚è‚Ü‚¹‚ñ: %s"
+#, c-format
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: ']' ‚ÌŒã‚ë‚É—]•ª‚È•¶Žš‚ª‚ ‚è‚Ü‚·: %s]%s"
+
#: ../syntax.c:4531
#, c-format
msgid "E398: Missing '=': %s"
@@ -5874,7 +5940,7 @@ msgstr "E415: —\\Šú‚¹‚Ê“™†‚Å‚·: %s"
#: ../syntax.c:6395
#, c-format
msgid "E416: missing equal sign: %s"
-msgstr "E416: “™†‚ª‚ª‚ ‚è‚Ü‚¹‚ñ: %s"
+msgstr "E416: “™†‚ª‚ ‚è‚Ü‚¹‚ñ: %s"
#: ../syntax.c:6418
#, c-format
@@ -6078,9 +6144,8 @@ msgstr "Vim: “ü—Í‚ð“Çž‚Ý’†‚̃Gƒ‰[‚É‚æ‚èI—¹‚µ‚Ü‚·...\n"
#. This happens when the FileChangedRO autocommand changes the
#. * file in a way it becomes shorter.
#: ../undo.c:379
-#, fuzzy
msgid "E881: Line count changed unexpectedly"
-msgstr "E834: —\\Šú‚¹‚¸sƒJƒEƒ“ƒg‚ª•Ï‚í‚è‚Ü‚µ‚½"
+msgstr "E881: —\\Šú‚¹‚¸sƒJƒEƒ“ƒg‚ª•Ï‚í‚è‚Ü‚µ‚½"
#: ../undo.c:627
#, c-format
@@ -6287,23 +6352,23 @@ msgstr " ƒVƒXƒeƒ€ vimrc: \""
#: ../version.c:672
msgid " user vimrc file: \""
-msgstr " ƒ†[ƒU vimrc: \""
+msgstr " ƒ†[ƒU[ vimrc: \""
#: ../version.c:677
msgid " 2nd user vimrc file: \""
-msgstr " ‘æ2ƒ†[ƒU vimrc: \""
+msgstr " ‘æ2ƒ†[ƒU[ vimrc: \""
#: ../version.c:682
msgid " 3rd user vimrc file: \""
-msgstr " ‘æ3ƒ†[ƒU vimrc: \""
+msgstr " ‘æ3ƒ†[ƒU[ vimrc: \""
#: ../version.c:687
msgid " user exrc file: \""
-msgstr " ƒ†[ƒU exrc: \""
+msgstr " ƒ†[ƒU[ exrc: \""
#: ../version.c:692
msgid " 2nd user exrc file: \""
-msgstr " ‘æ2ƒ†[ƒU exrc: \""
+msgstr " ‘æ2ƒ†[ƒU[ exrc: \""
#: ../version.c:699
msgid " fall-back for $VIM: \""
@@ -6379,7 +6444,7 @@ msgstr "Vim‚ÌŠJ”­‚ð‰ž‰‡‚µ‚Ä‚­‚¾‚³‚¢!"
#: ../version.c:828
msgid "Become a registered Vim user!"
-msgstr "Vim‚Ì“o˜^ƒ†[ƒU‚ɂȂÁ‚Ä‚­‚¾‚³‚¢!"
+msgstr "Vim‚Ì“o˜^ƒ†[ƒU[‚ɂȂÁ‚Ä‚­‚¾‚³‚¢!"
#: ../version.c:831
msgid "type :help sponsor<Enter> for information "
@@ -6391,7 +6456,7 @@ msgstr "ÚׂÈî•ñ‚Í :help register<Enter> "
#: ../version.c:834
msgid "menu Help->Sponsor/Register for information "
-msgstr "Úׂ̓ƒjƒ…[‚Ì ƒwƒ‹ƒv¨ƒXƒ|ƒ“ƒT[/“o˜^ ‚ðŽQÆ‚µ‚ĉº‚³‚¢ "
+msgstr "Úׂ̓ƒjƒ…[‚Ì ƒwƒ‹ƒv->ƒXƒ|ƒ“ƒT[/“o˜^ ‚ðŽQÆ‚µ‚ĉº‚³‚¢"
#: ../window.c:119
msgid "Already only one window"
@@ -6429,6 +6494,9 @@ msgstr "E445: ‘¼‚̃EƒBƒ“ƒhƒE‚ɂ͕ÏX‚ª‚ ‚è‚Ü‚·"
msgid "E446: No file name under cursor"
msgstr "E446: ƒJ[ƒ\\ƒ‹‚̉º‚Ƀtƒ@ƒCƒ‹–¼‚ª‚ ‚è‚Ü‚¹‚ñ"
+msgid "List or number required"
+msgstr "ƒŠƒXƒg‚©”’l‚ª•K—v‚Å‚·"
+
#~ msgid "E831: bf_key_init() called with empty password"
#~ msgstr "E831: bf_key_init() ‚ª‹óƒpƒXƒ[ƒh‚ŌĂÑo‚³‚ê‚Ü‚µ‚½"
diff --git a/src/nvim/rbuffer.h b/src/nvim/rbuffer.h
index 35fb16508e..454972c69d 100644
--- a/src/nvim/rbuffer.h
+++ b/src/nvim/rbuffer.h
@@ -36,30 +36,36 @@
//
// Note that the rbuffer_{produced,consumed} calls are necessary or these macros
// create infinite loops
-#define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) \
- for (size_t rcnt = 0, _r = 1; _r; _r = 0) \
- for (char *rptr = rbuffer_read_ptr(buf, &rcnt); \
- buf->size; \
- rptr = rbuffer_read_ptr(buf, &rcnt))
+#define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) \
+ for (size_t rcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
+ for ( /* NOLINT(readability/braces) */ \
+ char *rptr = rbuffer_read_ptr(buf, &rcnt); \
+ buf->size; \
+ rptr = rbuffer_read_ptr(buf, &rcnt))
-#define RBUFFER_UNTIL_FULL(buf, wptr, wcnt) \
- for (size_t wcnt = 0, _r = 1; _r; _r = 0) \
- for (char *wptr = rbuffer_write_ptr(buf, &wcnt); \
- rbuffer_space(buf); \
- wptr = rbuffer_write_ptr(buf, &wcnt))
+#define RBUFFER_UNTIL_FULL(buf, wptr, wcnt) \
+ for (size_t wcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \
+ for ( /* NOLINT(readability/braces) */ \
+ char *wptr = rbuffer_write_ptr(buf, &wcnt); \
+ rbuffer_space(buf); \
+ wptr = rbuffer_write_ptr(buf, &wcnt))
// Iteration
-#define RBUFFER_EACH(buf, c, i) \
- for (size_t i = 0; i < buf->size; i = buf->size) \
- for (char c = 0; \
- i < buf->size ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
+#define RBUFFER_EACH(buf, c, i) \
+ for (size_t i = 0; /* NOLINT(readability/braces) */ \
+ i < buf->size; \
+ i = buf->size) \
+ for (char c = 0; /* NOLINT(readability/braces) */ \
+ i < buf->size ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
i++)
-#define RBUFFER_EACH_REVERSE(buf, c, i) \
- for (size_t i = buf->size; i != SIZE_MAX; i = SIZE_MAX) \
- for (char c = 0; \
- i-- > 0 ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
+#define RBUFFER_EACH_REVERSE(buf, c, i) \
+ for (size_t i = buf->size; /* NOLINT(readability/braces) */ \
+ i != SIZE_MAX; \
+ i = SIZE_MAX) \
+ for (char c = 0; /* NOLINT(readability/braces) */ \
+ i-- > 0 ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \
)
typedef struct rbuffer RBuffer;
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 7e53b2ccd1..f97dce9e0d 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -357,13 +357,14 @@ static int nfa_ll_index = 0;
# include "regexp_nfa.c.generated.h"
#endif
-/* helper functions used when doing re2post() ... regatom() parsing */
-#define EMIT(c) do { \
- if (post_ptr >= post_end) { \
- realloc_post_list(); \
- } \
- *post_ptr++ = c; \
-} while (0)
+// Helper functions used when doing re2post() ... regatom() parsing
+#define EMIT(c) \
+ do { \
+ if (post_ptr >= post_end) { \
+ realloc_post_list(); \
+ } \
+ *post_ptr++ = c; \
+ } while (0)
/*
* Initialize internal variables before NFA compilation.
@@ -2892,12 +2893,11 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
return NULL;
#define PUSH(s) st_push((s), &stackp, stack_end)
-#define POP() st_pop(&stackp, stack); \
- if (stackp < stack) \
- { \
- st_error(postfix, end, p); \
- xfree(stack); \
- return NULL; \
+#define POP() st_pop(&stackp, stack); \
+ if (stackp < stack) { \
+ st_error(postfix, end, p); \
+ xfree(stack); \
+ return NULL; \
}
if (nfa_calc_size == FALSE) {
@@ -4904,10 +4904,10 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
} else
addstate(thislist, start, m, NULL, 0);
-#define ADD_STATE_IF_MATCH(state) \
- if (result) { \
- add_state = state->out; \
- add_off = clen; \
+#define ADD_STATE_IF_MATCH(state) \
+ if (result) { \
+ add_state = state->out; \
+ add_off = clen; \
}
/*
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 84906a3548..d2401b6776 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -9319,7 +9319,56 @@ static void suggest_try_special(suginfo_T *su)
}
}
+// Measure how much time is spent in each state.
+// Output is dumped in "suggestprof".
+
+#ifdef SUGGEST_PROFILE
+proftime_T current;
+proftime_T total;
+proftime_T times[STATE_FINAL + 1];
+long counts[STATE_FINAL + 1];
+
+ static void
+prof_init(void)
+{
+ for (int i = 0; i <= STATE_FINAL; i++) {
+ profile_zero(&times[i]);
+ counts[i] = 0;
+ }
+ profile_start(&current);
+ profile_start(&total);
+}
+
+// call before changing state
+ static void
+prof_store(state_T state)
+{
+ profile_end(&current);
+ profile_add(&times[state], &current);
+ counts[state]++;
+ profile_start(&current);
+}
+# define PROF_STORE(state) prof_store(state);
+
+ static void
+prof_report(char *name)
+{
+ FILE *fd = fopen("suggestprof", "a");
+
+ profile_end(&total);
+ fprintf(fd, "-----------------------\n");
+ fprintf(fd, "%s: %s\n", name, profile_msg(&total));
+ for (int i = 0; i <= STATE_FINAL; i++) {
+ fprintf(fd, "%d: %s ("%" PRId64)\n", i, profile_msg(&times[i]), counts[i]);
+ }
+ fclose(fd);
+}
+#else
+# define PROF_STORE(state)
+#endif
+
// Try finding suggestions by adding/removing/swapping letters.
+
static void suggest_try_change(suginfo_T *su)
{
char_u fword[MAXWLEN]; // copy of the bad word, case-folded
@@ -9344,7 +9393,14 @@ static void suggest_try_change(suginfo_T *su)
continue;
// Try it for this language. Will add possible suggestions.
+ //
+#ifdef SUGGEST_PROFILE
+ prof_init();
+#endif
suggest_trie_walk(su, lp, fword, false);
+#ifdef SUGGEST_PROFILE
+ prof_report("try_change");
+#endif
}
}
@@ -9478,6 +9534,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// Always past NUL bytes now.
n = (int)sp->ts_state;
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_ENDNUL;
sp->ts_save_badflags = su->su_badflags;
@@ -9517,6 +9574,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (sp->ts_curi > len || byts[arridx] != 0) {
// Past bytes in node and/or past NUL bytes.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_ENDNUL;
sp->ts_save_badflags = su->su_badflags;
break;
@@ -9870,6 +9928,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
#endif
// Save things to be restored at STATE_SPLITUNDO.
sp->ts_save_badflags = su->su_badflags;
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_SPLITUNDO;
++depth;
@@ -9936,6 +9995,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
byts = pbyts;
idxs = pidxs;
sp->ts_prefixdepth = PFD_PREFIXTREE;
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_NOPREFIX;
}
}
@@ -9948,6 +10008,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
su->su_badflags = sp->ts_save_badflags;
// Continue looking for NUL bytes.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_START;
// In case we went into the prefix tree.
@@ -9962,9 +10023,11 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
&& sp->ts_tcharlen == 0
) {
// The badword ends, can't use STATE_PLAIN.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_DEL;
break;
}
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_PLAIN;
// FALLTHROUGH
@@ -9975,10 +10038,12 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (sp->ts_curi > byts[arridx]) {
// Done all bytes at this node, do next state. When still at
// already changed bytes skip the other tricks.
- if (sp->ts_fidx >= sp->ts_fidxtry)
+ PROF_STORE(sp->ts_state)
+ if (sp->ts_fidx >= sp->ts_fidxtry) {
sp->ts_state = STATE_DEL;
- else
+ } else {
sp->ts_state = STATE_FINAL;
+ }
} else {
arridx += sp->ts_curi++;
c = byts[arridx];
@@ -10110,10 +10175,12 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// When past the first byte of a multi-byte char don't try
// delete/insert/swap a character.
if (has_mbyte && sp->ts_tcharlen > 0) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_FINAL;
break;
}
// Try skipping one character in the bad word (delete it).
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_INS_PREP;
sp->ts_curi = 1;
if (soundfold && sp->ts_fidx == 0 && fword[sp->ts_fidx] == '*')
@@ -10161,6 +10228,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (sp->ts_flags & TSF_DIDDEL) {
// If we just deleted a byte then inserting won't make sense,
// a substitute is always cheaper.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_SWAP;
break;
}
@@ -10170,11 +10238,13 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
for (;; ) {
if (sp->ts_curi > byts[n]) {
// Only NUL bytes at this node, go to next state.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_SWAP;
break;
}
if (byts[n + sp->ts_curi] != NUL) {
// Found a byte to insert.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_INS;
break;
}
@@ -10190,6 +10260,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
n = sp->ts_arridx;
if (sp->ts_curi > byts[n]) {
// Done all bytes at this node, go to next state.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_SWAP;
break;
}
@@ -10250,6 +10321,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
c = *p;
if (c == NUL) {
// End of word, can't swap or replace.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_FINAL;
break;
}
@@ -10257,6 +10329,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// Don't swap if the first character is not a word character.
// SWAP3 etc. also don't make sense then.
if (!soundfold && !spell_iswordp(p, curwin)) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
break;
}
@@ -10281,6 +10354,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// When the second character is NUL we can't swap.
if (c2 == NUL) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
break;
}
@@ -10288,6 +10362,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// When characters are identical, swap won't do anything.
// Also get here if the second char is not a word character.
if (c == c2) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_SWAP3;
break;
}
@@ -10298,6 +10373,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
sp->ts_twordlen, tword, fword + sp->ts_fidx,
c, c2);
#endif
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNSWAP;
++depth;
if (has_mbyte) {
@@ -10312,6 +10388,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
}
} else
// If this swap doesn't work then SWAP3 won't either.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
break;
@@ -10359,6 +10436,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// Also get here when the third character is not a word character.
// Second character may any char: "a.b" -> "b.a"
if (c == c3 || c3 == NUL) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
break;
}
@@ -10369,6 +10447,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
sp->ts_twordlen, tword, fword + sp->ts_fidx,
c, c3);
#endif
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNSWAP3;
++depth;
if (has_mbyte) {
@@ -10382,8 +10461,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
p[2] = c;
stack[depth].ts_fidxtry = sp->ts_fidx + 3;
}
- } else
+ } else {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
+ }
break;
case STATE_UNSWAP3:
@@ -10409,6 +10490,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (!soundfold && !spell_iswordp(p, curwin)) {
// Middle char is not a word char, skip the rotate. First and
// third char were already checked at swap and swap3.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
break;
}
@@ -10423,6 +10505,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
sp->ts_twordlen, tword, fword + sp->ts_fidx,
p[0], p[1], p[2]);
#endif
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNROT3L;
++depth;
p = fword + sp->ts_fidx;
@@ -10441,8 +10524,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
p[2] = c;
stack[depth].ts_fidxtry = sp->ts_fidx + 3;
}
- } else
+ } else {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
+ }
break;
case STATE_UNROT3L:
@@ -10472,6 +10557,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
sp->ts_twordlen, tword, fword + sp->ts_fidx,
p[0], p[1], p[2]);
#endif
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNROT3R;
++depth;
p = fword + sp->ts_fidx;
@@ -10490,8 +10576,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
*p = c;
stack[depth].ts_fidxtry = sp->ts_fidx + 3;
}
- } else
+ } else {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI;
+ }
break;
case STATE_UNROT3R:
@@ -10521,6 +10609,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if ((lp->lp_replang == NULL && !soundfold)
|| sp->ts_score + SCORE_REP >= su->su_maxscore
|| sp->ts_fidx < sp->ts_fidxtry) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_FINAL;
break;
}
@@ -10533,10 +10622,12 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
sp->ts_curi = lp->lp_replang->sl_rep_first[fword[sp->ts_fidx]];
if (sp->ts_curi < 0) {
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_FINAL;
break;
}
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP;
// FALLTHROUGH
@@ -10566,6 +10657,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
ftp->ft_from, ftp->ft_to);
#endif
// Need to undo this afterwards.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_UNDO;
// Change the "from" to the "to" string.
@@ -10585,6 +10677,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (sp->ts_curi >= gap->ga_len && sp->ts_state == STATE_REP)
// No (more) matches.
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_FINAL;
break;
@@ -10604,6 +10697,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
repextra -= tl - fl;
}
memmove(p, ftp->ft_from, fl);
+ PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP;
break;
@@ -11014,7 +11108,13 @@ static void suggest_try_soundalike(suginfo_T *su)
// try all kinds of inserts/deletes/swaps/etc.
// TODO: also soundfold the next words, so that we can try joining
// and splitting
+#ifdef SUGGEST_PROFILE
+ prof_init();
+#endif
suggest_trie_walk(su, lp, salword, true);
+#ifdef SUGGEST_PROFILE
+ prof_report("soundalike");
+#endif
}
}
}
@@ -13364,3 +13464,4 @@ int expand_spelling(linenr_T lnum, char_u *pat, char_u ***matchp)
return ga.ga_len;
}
+
diff --git a/src/nvim/state.c b/src/nvim/state.c
index b2f3f0bebe..30133e2201 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -4,6 +4,7 @@
#include "nvim/state.h"
#include "nvim/vim.h"
+#include "nvim/main.h"
#include "nvim/getchar.h"
#include "nvim/ui.h"
#include "nvim/os/input.h"
@@ -32,7 +33,7 @@ getkey:
// processing. Characters can come from mappings, scripts and other
// sources, so this scenario is very common.
key = safe_vgetc();
- } else if (!queue_empty(loop.events)) {
+ } else if (!queue_empty(main_loop.events)) {
// Event was made available after the last queue_process_events call
key = K_EVENT;
} else {
@@ -45,7 +46,7 @@ getkey:
// directly.
(void)os_inchar(NULL, 0, -1, 0);
input_disable_events();
- key = !queue_empty(loop.events) ? K_EVENT : safe_vgetc();
+ key = !queue_empty(main_loop.events) ? K_EVENT : safe_vgetc();
}
if (key == K_EVENT) {
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 1f9dbd8228..9e4dc0204f 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -812,19 +812,39 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
validate_current_state();
}
+static void save_chartab(char_u *chartab)
+{
+ if (syn_block->b_syn_isk != empty_option) {
+ memmove(chartab, syn_buf->b_chartab, (size_t)32);
+ memmove(syn_buf->b_chartab, syn_win->w_s->b_syn_chartab, (size_t)32);
+ }
+}
+
+static void restore_chartab(char_u *chartab)
+{
+ if (syn_win->w_s->b_syn_isk != empty_option) {
+ memmove(syn_buf->b_chartab, chartab, (size_t)32);
+ }
+}
+
/*
* Return TRUE if the line-continuation pattern matches in line "lnum".
*/
static int syn_match_linecont(linenr_T lnum)
{
- regmmatch_T regmatch;
-
if (syn_block->b_syn_linecont_prog != NULL) {
+ regmmatch_T regmatch;
+ // chartab array for syn iskeyword
+ char_u buf_chartab[32];
+ save_chartab(buf_chartab);
+
regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
regmatch.regprog = syn_block->b_syn_linecont_prog;
int r = syn_regexec(&regmatch, lnum, (colnr_T)0,
IF_SYN_TIME(&syn_block->b_syn_linecont_time));
syn_block->b_syn_linecont_prog = regmatch.regprog;
+
+ restore_chartab(buf_chartab);
return r;
}
return FALSE;
@@ -1617,8 +1637,9 @@ syn_current_attr (
lpos_T pos;
int lc_col;
reg_extmatch_T *cur_extmatch = NULL;
- char_u *line; /* current line. NOTE: becomes invalid after
- looking for a pattern match! */
+ char_u buf_chartab[32]; // chartab array for syn iskeyword
+ char_u *line; // current line. NOTE: becomes invalid after
+ // looking for a pattern match!
/* variables for zero-width matches that have a "nextgroup" argument */
int keep_next_list;
@@ -1668,6 +1689,9 @@ syn_current_attr (
* avoid matching the same item in the same position twice. */
ga_init(&zero_width_next_ga, (int)sizeof(int), 10);
+ // use syntax iskeyword option
+ save_chartab(buf_chartab);
+
/*
* Repeat matching keywords and patterns, to find contained items at the
* same column. This stops when there are no extra matches at the current
@@ -1992,6 +2016,8 @@ syn_current_attr (
} while (found_match);
+ restore_chartab(buf_chartab);
+
/*
* Use attributes from the current state, if within its highlighting.
* If not, use attributes from the current-but-one state, etc.
@@ -2522,7 +2548,8 @@ find_endpos (
regmmatch_T best_regmatch; /* startpos/endpos of best match */
lpos_T pos;
char_u *line;
- int had_match = FALSE;
+ int had_match = false;
+ char_u buf_chartab[32]; // chartab array for syn option iskeyword
/* just in case we are invoked for a keyword */
if (idx < 0)
@@ -2562,9 +2589,13 @@ find_endpos (
unref_extmatch(re_extmatch_in);
re_extmatch_in = ref_extmatch(start_ext);
- matchcol = startpos->col; /* start looking for a match at sstart */
- start_idx = idx; /* remember the first END pattern. */
- best_regmatch.startpos[0].col = 0; /* avoid compiler warning */
+ matchcol = startpos->col; // start looking for a match at sstart
+ start_idx = idx; // remember the first END pattern.
+ best_regmatch.startpos[0].col = 0; // avoid compiler warning
+
+ // use syntax iskeyword option
+ save_chartab(buf_chartab);
+
for (;; ) {
/*
* Find end pattern that matches first after "matchcol".
@@ -2707,6 +2738,8 @@ find_endpos (
if (!had_match)
m_endpos->lnum = 0;
+ restore_chartab(buf_chartab);
+
/* Remove external matches. */
unref_extmatch(re_extmatch_in);
re_extmatch_in = NULL;
@@ -3027,6 +3060,46 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
redraw_win_later(curwin, NOT_VALID);
}
+/// Handle ":syntax iskeyword" command.
+static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
+{
+ char_u *arg = eap->arg;
+ char_u save_chartab[32];
+ char_u *save_isk;
+
+ if (eap->skip) {
+ return;
+ }
+
+ arg = skipwhite(arg);
+ if (*arg == NUL) {
+ MSG_PUTS("\n");
+ MSG_PUTS(_("syntax iskeyword "));
+ if (curwin->w_s->b_syn_isk != empty_option) {
+ msg_outtrans(curwin->w_s->b_syn_isk);
+ } else {
+ msg_outtrans((char_u *)"not set");
+ }
+ } else {
+ if (STRNICMP(arg, "clear", 5) == 0) {
+ memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, (size_t)32);
+ clear_string_option(&curwin->w_s->b_syn_isk);
+ } else {
+ memmove(save_chartab, curbuf->b_chartab, (size_t)32);
+ save_isk = curbuf->b_p_isk;
+ curbuf->b_p_isk = vim_strsave(arg);
+
+ buf_init_chartab(curbuf, false);
+ memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, (size_t)32);
+ memmove(curbuf->b_chartab, save_chartab, (size_t)32);
+ clear_string_option(&curwin->w_s->b_syn_isk);
+ curwin->w_s->b_syn_isk = curbuf->b_p_isk;
+ curbuf->b_p_isk = save_isk;
+ }
+ }
+ redraw_win_later(curwin, NOT_VALID);
+}
+
/*
* Clear all syntax info for one buffer.
*/
@@ -3065,6 +3138,7 @@ void syntax_clear(synblock_T *block)
xfree(block->b_syn_linecont_pat);
block->b_syn_linecont_pat = NULL;
block->b_syn_folditems = 0;
+ clear_string_option(&block->b_syn_isk);
/* free the stored states */
syn_stack_free_all(block);
@@ -3107,6 +3181,7 @@ static void syntax_sync_clear(void)
curwin->w_s->b_syn_linecont_prog = NULL;
xfree(curwin->w_s->b_syn_linecont_pat);
curwin->w_s->b_syn_linecont_pat = NULL;
+ clear_string_option(&curwin->w_s->b_syn_isk);
syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
}
@@ -3266,6 +3341,7 @@ static void syn_cmd_enable(exarg_T *eap, int syncing)
/*
* Handle ":syntax reset" command.
+ * It actually resets highlighting, not syntax.
*/
static void syn_cmd_reset(exarg_T *eap, int syncing)
{
@@ -5363,24 +5439,25 @@ struct subcommand {
static struct subcommand subcommands[] =
{
- {"case", syn_cmd_case},
- {"clear", syn_cmd_clear},
- {"cluster", syn_cmd_cluster},
- {"conceal", syn_cmd_conceal},
- {"enable", syn_cmd_enable},
- {"include", syn_cmd_include},
- {"keyword", syn_cmd_keyword},
- {"list", syn_cmd_list},
- {"manual", syn_cmd_manual},
- {"match", syn_cmd_match},
- {"on", syn_cmd_on},
- {"off", syn_cmd_off},
- {"region", syn_cmd_region},
- {"reset", syn_cmd_reset},
- {"spell", syn_cmd_spell},
- {"sync", syn_cmd_sync},
- {"", syn_cmd_list},
- {NULL, NULL}
+ { "case", syn_cmd_case },
+ { "clear", syn_cmd_clear },
+ { "cluster", syn_cmd_cluster },
+ { "conceal", syn_cmd_conceal },
+ { "enable", syn_cmd_enable },
+ { "include", syn_cmd_include },
+ { "iskeyword", syn_cmd_iskeyword },
+ { "keyword", syn_cmd_keyword },
+ { "list", syn_cmd_list },
+ { "manual", syn_cmd_manual },
+ { "match", syn_cmd_match },
+ { "on", syn_cmd_on },
+ { "off", syn_cmd_off },
+ { "region", syn_cmd_region },
+ { "reset", syn_cmd_reset },
+ { "spell", syn_cmd_spell },
+ { "sync", syn_cmd_sync },
+ { "", syn_cmd_list },
+ { NULL, NULL }
};
/*
@@ -5434,6 +5511,7 @@ void ex_ownsyntax(exarg_T *eap)
clear_string_option(&curwin->w_s->b_p_spc);
clear_string_option(&curwin->w_s->b_p_spf);
clear_string_option(&curwin->w_s->b_p_spl);
+ clear_string_option(&curwin->w_s->b_syn_isk);
}
/* save value of b:current_syntax */
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 104cc47cda..3e41926b70 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -63,6 +63,7 @@
#include "nvim/map.h"
#include "nvim/misc1.h"
#include "nvim/move.h"
+#include "nvim/main.h"
#include "nvim/state.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_cmds.h"
@@ -163,9 +164,9 @@ static VTermColor default_vt_bg_rgb;
void terminal_init(void)
{
invalidated_terminals = pmap_new(ptr_t)();
- time_watcher_init(&loop, &refresh_timer, NULL);
+ time_watcher_init(&main_loop, &refresh_timer, NULL);
// refresh_timer_cb will redraw the screen which can call vimscript
- refresh_timer.events = queue_new_child(loop.events);
+ refresh_timer.events = queue_new_child(main_loop.events);
// initialize a rgb->color index map for cterm attributes(VTermScreenCell
// only has RGB information and we need color indexes for terminal UIs)
@@ -452,7 +453,7 @@ static int terminal_execute(VimState *state, int key)
case K_EVENT:
// We cannot let an event free the terminal yet. It is still needed.
s->term->refcount++;
- queue_process_events(loop.events);
+ queue_process_events(main_loop.events);
s->term->refcount--;
if (s->term->buf_handle == 0) {
s->close = true;
@@ -1158,15 +1159,15 @@ static bool is_focused(Terminal *term)
return State & TERM_FOCUS && curbuf->terminal == term;
}
-#define GET_CONFIG_VALUE(k, o) \
- do { \
- Error err; \
- /* Only called from terminal_open where curbuf->terminal is the */ \
- /* context */ \
- o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \
- if (o.type == kObjectTypeNil) { \
- o = dict_get_value(&globvardict, cstr_as_string(k), &err); \
- } \
+#define GET_CONFIG_VALUE(k, o) \
+ do { \
+ Error err; \
+ /* Only called from terminal_open where curbuf->terminal is the */ \
+ /* context */ \
+ o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \
+ if (o.type == kObjectTypeNil) { \
+ o = dict_get_value(&globvardict, cstr_as_string(k), &err); \
+ } \
} while (0)
static char *get_config_string(char *key)
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 867cab9fbf..4b0b5e8d26 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -9,7 +9,6 @@ SCRIPTSOURCE := ../../../runtime
SCRIPTS := \
test8.out \
- test10.out \
test12.out \
test13.out \
test14.out \
@@ -17,7 +16,6 @@ SCRIPTS := \
test24.out \
test30.out \
test32.out \
- test34.out \
test37.out \
test40.out \
test42.out \
@@ -26,7 +24,6 @@ SCRIPTS := \
test49.out \
test52.out \
test53.out \
- test55.out \
test64.out \
test69.out \
test73.out \
@@ -37,9 +34,13 @@ SCRIPTS := \
# Keep test_alot*.res as the last one, sort the others.
NEW_TESTS = \
test_cursor_func.res \
+ test_hardcopy.res \
test_help_tagjump.res \
+ test_langmap.res \
test_menu.res \
+ test_syntax.res \
test_timers.res \
+ test_unlet.res \
test_viml.res \
test_alot.res
@@ -59,7 +60,7 @@ ifdef USE_VALGRIND
TOOL := valgrind -q \
-q \
$(VALGRIND_TOOL) \
- --suppressions=../../../.valgrind.supp \
+ --suppressions=../../.valgrind.supp \
--error-exitcode=123 \
--log-file=valgrind.\%p.$* \
$(VGDB) \
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim
index 2712fb9371..578d64efde 100644
--- a/src/nvim/testdir/runtest.vim
+++ b/src/nvim/testdir/runtest.vim
@@ -61,12 +61,13 @@ endif
" Locate Test_ functions and execute them.
set nomore
redir @q
-function /^Test_
+silent function /^Test_
redir END
let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
" Execute the tests in alphabetical order.
for test in sort(tests)
+ echo 'Executing ' . test
if exists("*SetUp")
call SetUp()
endif
diff --git a/src/nvim/testdir/test10.in b/src/nvim/testdir/test10.in
deleted file mode 100644
index 2178cf41ce..0000000000
--- a/src/nvim/testdir/test10.in
+++ /dev/null
@@ -1,110 +0,0 @@
-Test for 'errorformat'. This will fail if the quickfix feature was disabled.
-
-STARTTEST
-:7/start of errorfile/,/end of errorfile/w! Xerrorfile1
-:7/start of errorfile/,/end of errorfile/-1w! Xerrorfile2
-:/start of testfile/,/end of testfile/w! Xtestfile
-:set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
-:set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m
-:cf Xerrorfile2
-:clast
-:copen
-:let a=w:quickfix_title
-:wincmd p
-lgR=a 
-:cf Xerrorfile1
-grA
-:cn
-gRLINE 6, COL 19
-:cn
-gRNO COLUMN SPECIFIED
-:cn
-gRAGAIN NO COLUMN
-:cn
-gRCOL 1
-:cn
-gRCOL 2
-:cn
-gRCOL 10
-:cn
-gRVCOL 10
-:cn
-grI
-:cn
-gR. SPACE POINTER
-:cn
-gR. DOT POINTER
-:cn
-gR. DASH POINTER
-:cn
-gR. TAB-SPACE POINTER
-:clast
-:cprev
-:cprev
-:wincmd w
-:let a=w:quickfix_title
-:wincmd p
-lgR=a 
-:w! test.out " Write contents of this file
-:qa!
-ENDTEST
-
-start of errorfile
-"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
-"Xtestfile", line 6 col 19; this is an error
-gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c
-Xtestfile:9: parse error before `asd'
-make: *** [vim] Error 1
-in file "Xtestfile" linenr 10: there is an error
-
-2 returned
-"Xtestfile", line 11 col 1; this is an error
-"Xtestfile", line 12 col 2; this is another error
-"Xtestfile", line 14:10; this is an error in column 10
-=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time
-"Xtestfile", linenr 16: yet another problem
-Error in "Xtestfile" at line 17:
-x should be a dot
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
- ^
-Error in "Xtestfile" at line 18:
-x should be a dot
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
-.............^
-Error in "Xtestfile" at line 19:
-x should be a dot
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
---------------^
-Error in "Xtestfile" at line 20:
-x should be a dot
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
- ^
-
-Does anyone know what is the problem and how to correction it?
-"Xtestfile", line 21 col 9: What is the title of the quickfix window?
-"Xtestfile", line 22 col 9: What is the title of the quickfix window?
-end of errorfile
-
-start of testfile
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
-end of testfile
diff --git a/src/nvim/testdir/test10.ok b/src/nvim/testdir/test10.ok
deleted file mode 100644
index 76a02f40b4..0000000000
--- a/src/nvim/testdir/test10.ok
+++ /dev/null
@@ -1,23 +0,0 @@
-start of testfile
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
- xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx line 4
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5
- xxxxxxxxxxxxxxxxxLINE 6, COL 19 line 6
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8
- NO COLUMN SPECIFIEDxxxxxxxxxxx line 9
- AGAIN NO COLUMNxxxxxxxxxxxxxxx line 10
-COL 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11
- COL 2xxxxxxxxxxxxxxxxxxxxxxxxx line 12
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13
- xxxxxxxxCOL 10xxxxxxxxxxxxxxxx line 14
- xVCOL 10xxxxxxxxxxxxxxxxxxxxxx line 15
- Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16
- xxxx. SPACE POINTERxxxxxxxxxxx line 17
- xxxxx. DOT POINTERxxxxxxxxxxxx line 18
- xxxxxx. DASH POINTERxxxxxxxxxx line 19
- xxxxxxx. TAB-SPACE POINTERxxxx line 20
- xxxxxxxx:cf Xerrorfile1xxxxxxx line 21
- xxxxxxxx:cf Xerrorfile2xxxxxxx line 22
-end of testfile
diff --git a/src/nvim/testdir/test10a.in b/src/nvim/testdir/test10a.in
deleted file mode 100644
index 99a5a03db8..0000000000
--- a/src/nvim/testdir/test10a.in
+++ /dev/null
@@ -1,72 +0,0 @@
-Test for 'errorformat'.
-
-STARTTEST
-:/start of errorfile/,/end of errorfile/w! Xerrorfile
-:/start of testfile/,/end of testfile/w! Xtestfile
-:cf Xerrorfile
-rA
-:cn
-rB
-:cn
-rC
-:cn
-rD
-:cn
-rE
-:w! test.out " Write contents of this file
-:qa!
-ENDTEST
-
-start of errorfile
-
- printf(" %d \n", (number/other)%10 );
-..................^
-%CC-E-NOSEMI, Missing ";".
-at line number 4 in file SYS$DISK:XTESTFILE
-
- other=10000000;
-.............^
-%CC-E-UNDECLARED, In this statement, "oszt" is not declared.
-at line number 7 in file SYS$DISK:XTESTFILE
-
- for (i = 0; i<7 ; i++ ){
-..................^
-%CC-E-UNDECLARED, In this statement, "i" is not declared.
-at line number 16 in file SYS$DISK:XTESTFILE
-
-some other error somewhere here.
-...........................^
-%CC-W-WARRING, Sorry, but no expalnation for such an warring.
-at line number 19 in file SYS$DISK:XTESTFILE
-
-and finally some other error exactly here.
-.....................................^
-%CC-I-INFORMATIONAL, It should be some informational message.
-at line number 20 in file SYS$DISK:XTESTFILE
-
-Does anyone know what is the problem and how to correct ?? :)
-end of errorfile
-
-start of testfile
-01234567890123456789012345678901234567
-line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 8 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 10 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 12 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 13 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 14 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 15 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 16 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 17 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 18 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 19 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-end of testfile
diff --git a/src/nvim/testdir/test10a.ok b/src/nvim/testdir/test10a.ok
deleted file mode 100644
index 10e78c9239..0000000000
--- a/src/nvim/testdir/test10a.ok
+++ /dev/null
@@ -1,23 +0,0 @@
-start of testfile
-01234567890123456789012345678901234567
-line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 4 xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx
-line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 7 xxxxxBxxxxxxxxxxxxxxxxxxxxxxxx
-line 8 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 10 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 12 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 13 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 14 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 15 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 16 xxxxxxxxxxCxxxxxxxxxxxxxxxxxxx
-line 17 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 18 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 19 xxxxxxxxxxxxxxxxxxxDxxxxxxxxxx
-line 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxE
-line 21 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-line 22 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-end of testfile
diff --git a/src/nvim/testdir/test34.in b/src/nvim/testdir/test34.in
deleted file mode 100644
index 4cb7e9494a..0000000000
--- a/src/nvim/testdir/test34.in
+++ /dev/null
@@ -1,86 +0,0 @@
-Test for user functions.
-Also test an <expr> mapping calling a function.
-Also test that a builtin function cannot be replaced.
-Also test for regression when calling arbitrary expression.
-
-STARTTEST
-:function Table(title, ...)
-: let ret = a:title
-: let idx = 1
-: while idx <= a:0
-: exe "let ret = ret . a:" . idx
-: let idx = idx + 1
-: endwhile
-: return ret
-:endfunction
-:function Compute(n1, n2, divname)
-: if a:n2 == 0
-: return "fail"
-: endif
-: exe "let g:" . a:divname . " = ". a:n1 / a:n2
-: return "ok"
-:endfunction
-:func Expr1()
-: normal! v
-: return "111"
-:endfunc
-:func Expr2()
-: call search('XX', 'b')
-: return "222"
-:endfunc
-:func ListItem()
-: let g:counter += 1
-: return g:counter . '. '
-:endfunc
-:func ListReset()
-: let g:counter = 0
-: return ''
-:endfunc
-:func FuncWithRef(a)
-: unlet g:FuncRef
-: return a:a
-:endfunc
-:let g:FuncRef=function("FuncWithRef")
-:let counter = 0
-:inoremap <expr> ( ListItem()
-:inoremap <expr> [ ListReset()
-:imap <expr> + Expr1()
-:imap <expr> * Expr2()
-:let retval = "nop"
-/^here
-C=Table("xxx", 4, "asdf")
- =Compute(45, 0, "retval")
- =retval
- =Compute(45, 5, "retval")
- =retval
- =g:FuncRef(333)
-
-XX+-XX
----*---
-(one
-(two
-[(one again:call append(line('$'), max([1, 2, 3]))
-:call extend(g:, {'max': function('min')})
-:call append(line('$'), max([1, 2, 3]))
-:try
-: " Regression: the first line below used to throw ?E110: Missing ')'?
-: " Second is here just to prove that this line is correct when not skipping
-: " rhs of &&.
-: $put =(0&&(function('tr'))(1, 2, 3))
-: $put =(1&&(function('tr'))(1, 2, 3))
-:catch
-: $put ='!!! Unexpected exception:'
-: $put =v:exception
-:endtry
-:$-9,$w! test.out
-:delfunc Table
-:delfunc Compute
-:delfunc Expr1
-:delfunc Expr2
-:delfunc ListItem
-:delfunc ListReset
-:unlet retval counter
-:q!
-ENDTEST
-
-here
diff --git a/src/nvim/testdir/test34.ok b/src/nvim/testdir/test34.ok
deleted file mode 100644
index 97995de80e..0000000000
--- a/src/nvim/testdir/test34.ok
+++ /dev/null
@@ -1,10 +0,0 @@
-xxx4asdf fail nop ok 9 333
-XX111-XX
----222---
-1. one
-2. two
-1. one again
-3
-3
-0
-1
diff --git a/src/nvim/testdir/test55.in b/src/nvim/testdir/test55.in
deleted file mode 100644
index 9a55eac6f6..0000000000
--- a/src/nvim/testdir/test55.in
+++ /dev/null
@@ -1,600 +0,0 @@
-Tests for List and Dictionary types. vim: set ft=vim :
-
-STARTTEST
-:fun Test(...)
-:lang C
-:" Creating List directly with different types
-:let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
-:$put =string(l)
-:$put =string(l[-1])
-:$put =string(l[-4])
-:try
-: $put =string(l[-5])
-:catch
-: $put =v:exception[:14]
-:endtry
-:" List slices
-:$put =string(l[:])
-:$put =string(l[1:])
-:$put =string(l[:-2])
-:$put =string(l[0:8])
-:$put =string(l[8:-1])
-:"
-:" List identity
-:let ll = l
-:let lx = copy(l)
-:try
-: $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) . (l is lx) . (l isnot lx)
-:catch
-: $put =v:exception
-:endtry
-:"
-:" Creating Dictionary directly with different types
-:let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},}
-:$put =string(d) . d.1
-:$put =string(sort(keys(d)))
-:$put =string (values(d))
-:for [key, val] in items(d)
-: $put =key . ':' . string(val)
-: unlet key val
-:endfor
-:call extend (d, {3:33, 1:99})
-:call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
-:try
-: call extend(d, {3:333,4:444}, "error")
-:catch
-: $put =v:exception[:15] . v:exception[-1:-1]
-:endtry
-:$put =string(d)
-:call filter(d, 'v:key =~ ''[ac391]''')
-:$put =string(d)
-:"
-:" Dictionary identity
-:let dd = d
-:let dx = copy(d)
-:try
-: $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) . (d isnot dx)
-:catch
-: $put =v:exception
-:endtry
-:"
-:" Changing var type should fail
-:try
-: let d = []
-:catch
-: $put =v:exception[:14] . v:exception[-1:-1]
-:endtry
-:try
-: let l = {}
-:catch
-: $put =v:exception[:14] . v:exception[-1:-1]
-:endtry
-:"
-:" removing items with :unlet
-:unlet l[2]
-:$put =string(l)
-:let l = range(8)
-:try
-:unlet l[:3]
-:unlet l[1:]
-:catch
-:$put =v:exception
-:endtry
-:$put =string(l)
-:"
-:unlet d.c
-:unlet d[-1]
-:$put =string(d)
-:"
-:" removing items out of range: silently skip items that don't exist
-let l = [0, 1, 2, 3]
-:unlet l[2:1]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[2:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[2:3]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[2:4]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[2:5]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-1:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-2:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-3:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-4:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-5:2]
-:$put =string(l)
-let l = [0, 1, 2, 3]
-:unlet l[-6:2]
-:$put =string(l)
-:"
-:" assignment to a list
-:let l = [0, 1, 2, 3]
-:let [va, vb] = l[2:3]
-:$put =va
-:$put =vb
-:try
-: let [va, vb] = l
-:catch
-: $put =v:exception[:14]
-:endtry
-:try
-: let [va, vb] = l[1:1]
-:catch
-: $put =v:exception[:14]
-:endtry
-:"
-:" manipulating a big Dictionary (hashtable.c has a border of 1000 entries)
-:let d = {}
-:for i in range(1500)
-: let d[i] = 3000 - i
-:endfor
-:$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . d[1499]
-:try
-: let n = d[1500]
-:catch
-: $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '')
-:endtry
-:" lookup each items
-:for i in range(1500)
-: if d[i] != 3000 - i
-: $put =d[i]
-: endif
-:endfor
-: let i += 1
-:" delete even items
-:while i >= 2
-: let i -= 2
-: unlet d[i]
-:endwhile
-:$put =get(d, 1500 - 100, 'NONE') . ' ' . d[1]
-:" delete odd items, checking value, one intentionally wrong
-:let d[33] = 999
-:let i = 1
-:while i < 1500
-: if d[i] != 3000 - i
-: $put =i . '=' . d[i]
-: else
-: unlet d[i]
-: endif
-: let i += 2
-:endwhile
-:$put =string(d) " must be almost empty now
-:unlet d
-:"
-:" Dictionary function
-:let dict = {}
-:func dict.func(a) dict
-: $put =a:a . len(self.data)
-:endfunc
-:let dict.data = [1,2,3]
-:call dict.func("len: ")
-:let x = dict.func("again: ")
-:try
-: let Fn = dict.func
-: call Fn('xxx')
-:catch
-: $put =v:exception[:15]
-:endtry
-:"
-:" Function in script-local List or Dict
-:let g:dict = {}
-:function g:dict.func() dict
-: $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf')
-:endfunc
-:let g:dict.foo = ['-', 2, 3]
-:call insert(g:dict.foo, function('strlen'))
-:call g:dict.func()
-:"
-:" Nasty: remove func from Dict that's being called (works)
-:let d = {1:1}
-:func d.func(a)
-: return "a:". a:a
-:endfunc
-:$put =d.func(string(remove(d, 'func')))
-:"
-:" Nasty: deepcopy() dict that refers to itself (fails when noref used)
-:let d = {1:1, 2:2}
-:let l = [4, d, 6]
-:let d[3] = l
-:let dc = deepcopy(d)
-:try
-: let dc = deepcopy(d, 1)
-:catch
-: $put =v:exception[:14]
-:endtry
-:let l2 = [0, l, l, 3]
-:let l[1] = l2
-:let l3 = deepcopy(l2)
-:$put ='same list: ' . (l3[1] is l3[2])
-:"
-:" Locked variables
-:for depth in range(5)
-: $put ='depth is ' . depth
-: for u in range(3)
-: unlet l
-: let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
-: exe "lockvar " . depth . " l"
-: if u == 1
-: exe "unlockvar l"
-: elseif u == 2
-: exe "unlockvar " . depth . " l"
-: endif
-: let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]")
-: $put =ps
-: let ps = ''
-: try
-: let l[1][1][0] = 99
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l[1][1] = [99]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l[1] = [99]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l[2]['6'][7] = 99
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l[2][6] = {99: 99}
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l[2] = {99: 99}
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: let l = [99]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: $put =ps
-: endfor
-:endfor
-:"
-:" Unletting locked variables
-:$put ='Unletting:'
-:for depth in range(5)
-: $put ='depth is ' . depth
-: for u in range(3)
-: unlet l
-: let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
-: exe "lockvar " . depth . " l"
-: if u == 1
-: exe "unlockvar l"
-: elseif u == 2
-: exe "unlockvar " . depth . " l"
-: endif
-: let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]")
-: $put =ps
-: let ps = ''
-: try
-: unlet l[2]['6'][7]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l[2][6]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l[2]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l[1][1][0]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l[1][1]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l[1]
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: try
-: unlet l
-: let ps .= 'p'
-: catch
-: let ps .= 'F'
-: endtry
-: $put =ps
-: endfor
-:endfor
-:"
-:" Locked variables and :unlet or list / dict functions
-:$put ='Locks and commands or functions:'
-:"
-:$put ='No :unlet after lock on dict:'
-:unlet! d
-:let d = {'a': 99, 'b': 100}
-:lockvar 1 d
-:try
-: unlet d.a
-: $put ='did :unlet'
-:catch
-: $put =v:exception[:16]
-:endtry
-:$put =string(d)
-:"
-:$put =':unlet after lock on dict item:'
-:unlet! d
-:let d = {'a': 99, 'b': 100}
-:lockvar d.a
-:try
-: unlet d.a
-: $put ='did :unlet'
-:catch
-: $put =v:exception[:16]
-:endtry
-:$put =string(d)
-:"
-:$put ='filter() after lock on dict item:'
-:unlet! d
-:let d = {'a': 99, 'b': 100}
-:lockvar d.a
-:try
-: call filter(d, 'v:key != "a"')
-: $put ='did filter()'
-:catch
-: $put =v:exception[:16]
-:endtry
-:$put =string(d)
-:"
-:$put ='map() after lock on dict:'
-:unlet! d
-:let d = {'a': 99, 'b': 100}
-:lockvar 1 d
-:try
-: call map(d, 'v:val + 200')
-: $put ='did map()'
-:catch
-: $put =v:exception[:16]
-:endtry
-:$put =string(d)
-:"
-:$put ='No extend() after lock on dict item:'
-:unlet! d
-:let d = {'a': 99, 'b': 100}
-:lockvar d.a
-:try
-: $put =string(extend(d, {'a': 123}))
-: $put ='did extend()'
-:catch
-: $put =v:exception[:14]
-:endtry
-:$put =string(d)
-:"
-:$put ='No remove() of write-protected scope-level variable:'
-:fun! Tfunc(this_is_a_loooooooooong_parameter_name)
-: try
-: $put =string(remove(a:, 'this_is_a_loooooooooong_parameter_name'))
-: $put ='did remove()'
-: catch
-: $put =v:exception[:14]
-: endtry
-:endfun
-:call Tfunc('testval')
-:"
-:$put ='No extend() of write-protected scope-level variable:'
-:fun! Tfunc(this_is_a_loooooooooong_parameter_name)
-: try
-: $put =string(extend(a:, {'this_is_a_loooooooooong_parameter_name': 1234}))
-: $put ='did extend()'
-: catch
-: $put =v:exception[:14]
-: endtry
-:endfun
-:call Tfunc('testval')
-:"
-:$put ='No :unlet of variable in locked scope:'
-:let b:testvar = 123
-:lockvar 1 b:
-:try
-: unlet b:testvar
-: $put ='b:testvar was :unlet: '. (!exists('b:testvar'))
-:catch
-: $put =v:exception[:16]
-:endtry
-:unlockvar 1 b:
-:unlet! b:testvar
-:"
-:$put ='No :let += of locked list variable:'
-:let l = ['a', 'b', 3]
-:lockvar 1 l
-:try
-: let l += ['x']
-: $put ='did :let +='
-:catch
-: $put =v:exception[:14]
-:endtry
-:$put =string(l)
-:"
-:unlet l
-:let l = [1, 2, 3, 4]
-:lockvar! l
-:$put =string(l)
-:unlockvar l[1]
-:unlet l[0:1]
-:$put =string(l)
-:unlet l[1:2]
-:$put =string(l)
-:unlockvar l[1]
-:let l[0:1] = [0, 1]
-:$put =string(l)
-:let l[1:2] = [0, 1]
-:$put =string(l)
-:unlet l
-:" :lockvar/islocked() triggering script autoloading
-:set rtp+=./sautest
-:lockvar g:footest#x
-:unlockvar g:footest#x
-:$put ='locked g:footest#x:'.islocked('g:footest#x')
-:$put ='exists g:footest#x:'.exists('g:footest#x')
-:$put ='g:footest#x: '.g:footest#x
-:"
-:" a:000 function argument
-:" first the tests that should fail
-:try
-: let a:000 = [1, 2]
-:catch
-: $put ='caught a:000'
-:endtry
-:try
-: let a:000[0] = 9
-:catch
-: $put ='caught a:000[0]'
-:endtry
-:try
-: let a:000[2] = [9, 10]
-:catch
-: $put ='caught a:000[2]'
-:endtry
-:try
-: let a:000[3] = {9: 10}
-:catch
-: $put ='caught a:000[3]'
-:endtry
-:" now the tests that should pass
-:try
-: let a:000[2][1] = 9
-: call extend(a:000[2], [5, 6])
-: let a:000[3][5] = 8
-: let a:000[3]['a'] = 12
-: $put =string(a:000)
-:catch
-: $put ='caught ' . v:exception
-:endtry
-:"
-:" reverse(), sort(), uniq()
-:let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
-:$put =string(uniq(copy(l)))
-:$put =string(reverse(l))
-:$put =string(reverse(reverse(l)))
-:$put =string(sort(l))
-:$put =string(reverse(sort(l)))
-:$put =string(sort(reverse(sort(l))))
-:$put =string(uniq(sort(l)))
-:let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, 0.22, 'four']
-:$put =string(sort(copy(l), 'n'))
-:let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
-:$put =string(sort(copy(l), 1))
-:$put =string(sort(copy(l), 'i'))
-:$put =string(sort(copy(l)))
-:"
-:" splitting a string to a List
-:$put =string(split(' aa bb '))
-:$put =string(split(' aa bb ', '\W\+', 0))
-:$put =string(split(' aa bb ', '\W\+', 1))
-:$put =string(split(' aa bb ', '\W', 1))
-:$put =string(split(':aa::bb:', ':', 0))
-:$put =string(split(':aa::bb:', ':', 1))
-:$put =string(split('aa,,bb, cc,', ',\s*', 1))
-:$put =string(split('abc', '\zs'))
-:$put =string(split('abc', '\zs', 1))
-:"
-:" compare recursively linked list and dict
-:let l = [1, 2, 3, 4]
-:let d = {'1': 1, '2': l, '3': 3}
-:let l[1] = d
-:$put =(l == l)
-:$put =(d == d)
-:$put =(l != deepcopy(l))
-:$put =(d != deepcopy(d))
-:"
-:" compare complex recursively linked list and dict
-:let l = []
-:call add(l, l)
-:let dict4 = {"l": l}
-:call add(dict4.l, dict4)
-:let lcopy = deepcopy(l)
-:let dict4copy = deepcopy(dict4)
-:$put =(l == lcopy)
-:$put =(dict4 == dict4copy)
-:"
-:" Pass the same List to extend()
-:let l = [1, 2, 3, 4, 5]
-:call extend(l, l)
-:$put =string(l)
-:"
-:" Pass the same Dict to extend()
-:let d = { 'a': {'b': 'B'}}
-:call extend(d, d)
-:$put =string(d)
-:"
-:" Pass the same Dict to extend() with "error"
-:try
-: call extend(d, d, "error")
-:catch
-: $put =v:exception[:15] . v:exception[-1:-1]
-:endtry
-:$put =string(d)
-:"
-:" test for range assign
-:let l = [0]
-:let l[:] = [1, 2]
-:$put =string(l)
-:endfun
-:"
-:call Test(1, 2, [3, 4], {5: 6}) " This may take a while
-:"
-:delfunc Test
-:unlet dict
-:call garbagecollect(1)
-:"
-:" test for patch 7.3.637
-:let a = 'No error caught'
-:try|foldopen|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
-o=a :"
-:lang C
-:redir => a
-:try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
-:redir END
-o=a :"
-:"
-:/^start:/,$wq! test.out
-ENDTEST
-
-start:
diff --git a/src/nvim/testdir/test55.ok b/src/nvim/testdir/test55.ok
deleted file mode 100644
index 607a95ead9..0000000000
--- a/src/nvim/testdir/test55.ok
+++ /dev/null
@@ -1,199 +0,0 @@
-start:
-[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
-{'a': 1}
-1
-Vim(put):E684:
-[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
-['as''d', [1, 2, function('strlen')], {'a': 1}]
-[1, 'as''d', [1, 2, function('strlen')]]
-[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
-[]
-101101
-{'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd
-['-1', '1', 'b']
-['asd', [1, 2, function('strlen')], {'a': 1}]
-1:'asd'
-b:[1, 2, function('strlen')]
--1:{'a': 1}
-Vim(call):E737: 3
-{'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}}
-{'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
-101101
-Vim(let):E706: d
-Vim(let):E706: l
-[1, 'as''d', {'a': 1}]
-[4]
-{'1': 99, '3': 33}
-[0, 1, 2, 3]
-[0, 1, 3]
-[0, 1]
-[0, 1]
-[0, 1]
-[0, 1, 2, 3]
-[0, 1, 3]
-[0, 3]
-[3]
-[3]
-[3]
-2
-3
-Vim(let):E687:
-Vim(let):E688:
-3000 2900 2001 1600 1501
-Vim(let):E716: 1500
-NONE 2999
-33=999
-{'33': 999}
-len: 3
-again: 3
-Vim(call):E725:
-g:dict.func-4
-a:function('3')
-Vim(let):E698:
-same list: 1
-depth is 0
-0000-000
-ppppppp
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 1
-1000-000
-ppppppF
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 2
-1100-100
-ppFppFF
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 3
-1110-110
-pFFpFFF
-0010-010
-pFppFpp
-0000-000
-ppppppp
-depth is 4
-1111-111
-FFFFFFF
-0011-011
-FFpFFpp
-0000-000
-ppppppp
-Unletting:
-depth is 0
-0000-000
-ppppppp
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 1
-1000-000
-ppFppFp
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 2
-1100-100
-pFFpFFp
-0000-000
-ppppppp
-0000-000
-ppppppp
-depth is 3
-1110-110
-FFFFFFp
-0010-010
-FppFppp
-0000-000
-ppppppp
-depth is 4
-1111-111
-FFFFFFp
-0011-011
-FppFppp
-0000-000
-ppppppp
-Locks and commands or functions:
-No :unlet after lock on dict:
-Vim(unlet):E741:
-{'a': 99, 'b': 100}
-:unlet after lock on dict item:
-did :unlet
-{'b': 100}
-filter() after lock on dict item:
-did filter()
-{'b': 100}
-map() after lock on dict:
-did map()
-{'a': 299, 'b': 300}
-No extend() after lock on dict item:
-Vim(put):E741:
-{'a': 99, 'b': 100}
-No remove() of write-protected scope-level variable:
-Vim(put):E795:
-No extend() of write-protected scope-level variable:
-Vim(put):E742:
-No :unlet of variable in locked scope:
-Vim(unlet):E741:
-No :let += of locked list variable:
-Vim(let):E741:
-['a', 'b', 3]
-[1, 2, 3, 4]
-[1, 2, 3, 4]
-[1, 2, 3, 4]
-[1, 2, 3, 4]
-[1, 2, 3, 4]
-locked g:footest#x:-1
-exists g:footest#x:0
-g:footest#x: 1
-caught a:000
-caught a:000[0]
-caught a:000[2]
-caught a:000[3]
-[1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}]
-['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
-[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
-[1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
-['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]]
-[[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0']
-['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]]
-['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]]
-[-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255]
-['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
-['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
-['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
-['aa', 'bb']
-['aa', 'bb']
-['', 'aa', 'bb', '']
-['', '', 'aa', '', 'bb', '', '']
-['aa', '', 'bb']
-['', 'aa', '', 'bb', '']
-['aa', '', 'bb', 'cc', '']
-['a', 'b', 'c']
-['', 'a', '', 'b', '', 'c', '']
-1
-1
-0
-0
-1
-1
-[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
-{'a': {'b': 'B'}}
-Vim(call):E737: a
-{'a': {'b': 'B'}}
-[1, 2]
-Vim(foldopen):E490:
-
-
-Error detected while processing :
-E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
-
diff --git a/src/nvim/testdir/test_hardcopy.vim b/src/nvim/testdir/test_hardcopy.vim
new file mode 100644
index 0000000000..4629d17dd2
--- /dev/null
+++ b/src/nvim/testdir/test_hardcopy.vim
@@ -0,0 +1,58 @@
+" Test :hardcopy
+
+func Test_printoptions_parsing()
+ " Only test that this doesn't throw an error.
+ set printoptions=left:5in,right:10pt,top:8mm,bottom:2pc
+ set printoptions=left:2in,top:30pt,right:16mm,bottom:3pc
+ set printoptions=header:3,syntax:y,number:7,wrap:n
+ set printoptions=duplex:short,collate:n,jobsplit:y,portrait:n
+ set printoptions=paper:10x14
+ set printoptions=paper:A3
+ set printoptions=paper:A4
+ set printoptions=paper:A5
+ set printoptions=paper:B4
+ set printoptions=paper:B5
+ set printoptions=paper:executive
+ set printoptions=paper:folio
+ set printoptions=paper:ledger
+ set printoptions=paper:legal
+ set printoptions=paper:letter
+ set printoptions=paper:quarto
+ set printoptions=paper:statement
+ set printoptions=paper:tabloid
+ set printoptions=formfeed:y
+ set printoptions=
+ set printoptions&
+endfunc
+
+func Test_printmbfont_parsing()
+ " Only test that this doesn't throw an error.
+ set printmbfont=r:WadaMin-Regular,b:WadaMin-Bold,i:WadaMin-Italic,o:WadaMin-Bold-Italic,c:yes,a:no
+ set printmbfont=
+ set printmbfont&
+endfunc
+
+func Test_printheader_parsing()
+ " Only test that this doesn't throw an error.
+ set printheader=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
+ set printheader=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
+ set printheader=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
+ set printheader=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
+ set printheader=
+ set printheader&
+endfunc
+
+" Test that :hardcopy produces a non-empty file.
+" We don't check much of the contents.
+func Test_with_syntax()
+ if has('postscript')
+ set printoptions=syntax:y
+ syn on
+ hardcopy > Xhardcopy
+ let lines = readfile('Xhardcopy')
+ call assert_true(len(lines) > 20)
+ call assert_true(lines[0] =~ 'PS-Adobe')
+ call delete('Xhardcopy')
+ set printoptions&
+ endif
+endfunc
diff --git a/src/nvim/testdir/test_langmap.vim b/src/nvim/testdir/test_langmap.vim
new file mode 100644
index 0000000000..066c3bf2bd
--- /dev/null
+++ b/src/nvim/testdir/test_langmap.vim
@@ -0,0 +1,24 @@
+" tests for 'langmap'
+
+func Test_langmap()
+ new
+ set langmap=}l,^x,%v
+
+ call setline(1, ['abc'])
+ call feedkeys('gg0}^', 'tx')
+ call assert_equal('ac', getline(1))
+
+ " in Replace mode
+ " need silent! to avoid a delay when entering Insert mode
+ call setline(1, ['abcde'])
+ silent! call feedkeys("gg0lR%{z\<Esc>00", 'tx')
+ call assert_equal('a%{ze', getline(1))
+
+ " in Select mode
+ " need silent! to avoid a delay when entering Insert mode
+ call setline(1, ['abcde'])
+ silent! call feedkeys("gg0}%}\<C-G>}^\<Esc>00", 'tx')
+ call assert_equal('a}^de', getline(1))
+
+ quit!
+endfunc
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
new file mode 100644
index 0000000000..309c0f460b
--- /dev/null
+++ b/src/nvim/testdir/test_syntax.vim
@@ -0,0 +1,63 @@
+" Test for syntax and syntax iskeyword option
+
+func GetSyntaxItem(pat)
+ let c = ''
+ let a = ['a', getreg('a'), getregtype('a')]
+ 0
+ redraw!
+ call search(a:pat, 'W')
+ let synid = synID(line('.'), col('.'), 1)
+ while synid == synID(line('.'), col('.'), 1)
+ norm! v"ay
+ " stop at whitespace
+ if @a =~# '\s'
+ break
+ endif
+ let c .= @a
+ norm! l
+ endw
+ call call('setreg', a)
+ 0
+ return c
+endfunc
+
+func Test_syn_iskeyword()
+ new
+ call setline(1, [
+ \ 'CREATE TABLE FOOBAR(',
+ \ ' DLTD_BY VARCHAR2(100)',
+ \ ');',
+ \ ''])
+
+ syntax on
+ set ft=sql
+ syn match SYN /C\k\+\>/
+ hi link SYN ErrorMsg
+ call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
+ /\<D\k\+\>/:norm! ygn
+ call assert_equal('DLTD_BY', @0)
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword not set", @c)
+
+ syn iskeyword @,48-57,_,192-255
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword @,48-57,_,192-255", @c)
+
+ setlocal isk-=_
+ call assert_equal('DLTD_BY', GetSyntaxItem('DLTD'))
+ /\<D\k\+\>/:norm! ygn
+ let b2=@0
+ call assert_equal('DLTD', @0)
+
+ syn iskeyword clear
+ redir @c
+ syn iskeyword
+ redir END
+ call assert_equal("\nsyntax iskeyword not set", @c)
+
+ quit!
+endfunc
diff --git a/src/nvim/testdir/test_unlet.vim b/src/nvim/testdir/test_unlet.vim
new file mode 100644
index 0000000000..f6705997a9
--- /dev/null
+++ b/src/nvim/testdir/test_unlet.vim
@@ -0,0 +1,26 @@
+" Tests for :unlet
+
+func Test_read_only()
+ try
+ " this caused a crash
+ unlet count
+ catch
+ call assert_true(v:exception =~ ':E795:')
+ endtry
+endfunc
+
+func Test_existing()
+ let does_exist = 1
+ call assert_true(exists('does_exist'))
+ unlet does_exist
+ call assert_false(exists('does_exist'))
+endfunc
+
+func Test_not_existing()
+ unlet! does_not_exist
+ try
+ unlet does_not_exist
+ catch
+ call assert_true(v:exception =~ ':E108:')
+ endtry
+endfunc
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 99eb230a88..be256f3ebc 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -4,6 +4,7 @@
#include "nvim/api/vim.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
+#include "nvim/main.h"
#include "nvim/misc2.h"
#include "nvim/os/os.h"
#include "nvim/os/input.h"
@@ -92,7 +93,7 @@ static void flush_input(TermInput *input, bool wait_until_empty)
size_t drain_boundary = wait_until_empty ? 0 : 0xff;
do {
uv_mutex_lock(&input->key_buffer_mutex);
- loop_schedule(&loop, event_create(1, wait_input_enqueue, 1, input));
+ loop_schedule(&main_loop, event_create(1, wait_input_enqueue, 1, input));
input->waiting = true;
while (input->waiting) {
uv_cond_wait(&input->key_buffer_cond, &input->key_buffer_mutex);
@@ -138,6 +139,9 @@ static void forward_modified_utf8(TermInput *input, TermKeyKey *key)
if (key->type == TERMKEY_TYPE_KEYSYM
&& key->code.sym == TERMKEY_SYM_ESCAPE) {
len = (size_t)snprintf(buf, sizeof(buf), "<Esc>");
+ } else if (key->type == TERMKEY_TYPE_KEYSYM
+ && key->code.sym == TERMKEY_SYM_SUSPEND) {
+ len = (size_t)snprintf(buf, sizeof(buf), "<C-Z>");
} else {
len = termkey_strfkey(input->tk, buf, sizeof(buf), key, TERMKEY_FORMAT_VIM);
}
@@ -153,7 +157,8 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key)
TermKeyMouseEvent ev;
termkey_interpret_mouse(input->tk, key, &ev, &button, &row, &col);
- if (ev != TERMKEY_MOUSE_PRESS && ev != TERMKEY_MOUSE_DRAG) {
+ if (ev != TERMKEY_MOUSE_PRESS && ev != TERMKEY_MOUSE_DRAG
+ && ev != TERMKEY_MOUSE_RELEASE) {
return;
}
@@ -190,6 +195,8 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key)
}
} else if (ev == TERMKEY_MOUSE_DRAG) {
len += (size_t)snprintf(buf + len, sizeof(buf) - len, "Drag");
+ } else if (ev == TERMKEY_MOUSE_RELEASE) {
+ len += (size_t)snprintf(buf + len, sizeof(buf) - len, "Release");
}
len += (size_t)snprintf(buf + len, sizeof(buf) - len, "><%d,%d>", col, row);
@@ -336,7 +343,7 @@ static void read_cb(Stream *stream, RBuffer *buf, size_t c, void *data,
stream_close(&input->read_stream, NULL);
queue_put(input->loop->fast_events, restart_reading, 1, input);
} else {
- loop_schedule(&loop, event_create(1, input_done_event, 0));
+ loop_schedule(&main_loop, event_create(1, input_done_event, 0));
}
return;
}
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 62bc81ba64..50558e644a 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -11,6 +11,7 @@
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/map.h"
+#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/api/vim.h"
#include "nvim/api/private/helpers.h"
@@ -261,7 +262,7 @@ static void sigwinch_cb(SignalWatcher *watcher, int signum, void *data)
UI *ui = data;
update_size(ui);
// run refresh_event in nvim main loop
- loop_schedule(&loop, event_create(1, refresh_event, 0));
+ loop_schedule(&main_loop, event_create(1, refresh_event, 0));
}
static bool attrs_differ(HlAttrs a1, HlAttrs a2)
@@ -681,7 +682,7 @@ static void invalidate(UI *ui, int top, int bot, int left, int right)
intersects->right = MAX(right, intersects->right);
} else {
// Else just add a new entry;
- kv_push(Rect, data->invalid_regions, ((Rect){top, bot, left, right}));
+ kv_push(data->invalid_regions, ((Rect) { top, bot, left, right }));
}
}
diff --git a/src/nvim/ugrid.h b/src/nvim/ugrid.h
index ad6d96a168..268362bf1b 100644
--- a/src/nvim/ugrid.h
+++ b/src/nvim/ugrid.h
@@ -23,16 +23,16 @@ struct ugrid {
#define EMPTY_ATTRS ((HlAttrs){ false, false, false, false, false, -1, -1, -1 })
-#define UGRID_FOREACH_CELL(grid, top, bot, left, right, code) \
- do { \
- for (int row = top; row <= bot; ++row) { \
- UCell *row_cells = (grid)->cells[row]; \
- for (int col = left; col <= right; ++col) { \
- UCell *cell = row_cells + col; \
- (void)(cell); \
- code; \
- } \
- } \
+#define UGRID_FOREACH_CELL(grid, top, bot, left, right, code) \
+ do { \
+ for (int row = top; row <= bot; row++) { \
+ UCell *row_cells = (grid)->cells[row]; \
+ for (int col = left; col <= right; col++) { \
+ UCell *cell = row_cells + col; \
+ (void)(cell); \
+ code; \
+ } \
+ } \
} while (0)
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index ae38754c1e..d968cbc390 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -60,22 +60,22 @@ static int height, width;
// See http://stackoverflow.com/a/11172679 for a better explanation of how it
// works.
#ifdef _MSC_VER
- #define UI_CALL(funname, ...) \
- do { \
- flush_cursor_update(); \
- for (size_t i = 0; i < ui_count; i++) { \
- UI *ui = uis[i]; \
- UI_CALL_MORE(funname, __VA_ARGS__); \
- } \
+# define UI_CALL(funname, ...) \
+ do { \
+ flush_cursor_update(); \
+ for (size_t i = 0; i < ui_count; i++) { \
+ UI *ui = uis[i]; \
+ UI_CALL_MORE(funname, __VA_ARGS__); \
+ } \
} while (0)
#else
- #define UI_CALL(...) \
- do { \
- flush_cursor_update(); \
- for (size_t i = 0; i < ui_count; i++) { \
- UI *ui = uis[i]; \
- UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
- } \
+# define UI_CALL(...) \
+ do { \
+ flush_cursor_update(); \
+ for (size_t i = 0; i < ui_count; i++) { \
+ UI *ui = uis[i]; \
+ UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
+ } \
} while (0)
#endif
#define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore)
diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c
index d17fa4a782..6290fb3d87 100644
--- a/src/nvim/ui_bridge.c
+++ b/src/nvim/ui_bridge.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <limits.h>
+#include "nvim/main.h"
#include "nvim/vim.h"
#include "nvim/ui.h"
#include "nvim/memory.h"
@@ -18,9 +19,9 @@
#define UI(b) (((UIBridgeData *)b)->ui)
// Call a function in the UI thread
-#define UI_CALL(ui, name, argc, ...) \
- ((UIBridgeData *)ui)->scheduler( \
- event_create(1, ui_bridge_##name##_event, argc, __VA_ARGS__), UI(ui))
+#define UI_CALL(ui, name, argc, ...) \
+ ((UIBridgeData *)ui)->scheduler( \
+ event_create(1, ui_bridge_##name##_event, argc, __VA_ARGS__), UI(ui))
#define INT2PTR(i) ((void *)(uintptr_t)i)
#define PTR2INT(p) ((int)(uintptr_t)p)
@@ -100,7 +101,7 @@ static void ui_bridge_stop(UI *b)
if (stopped) {
break;
}
- loop_poll_events(&loop, 10);
+ loop_poll_events(&main_loop, 10);
}
uv_thread_join(&bridge->ui_thread);
uv_mutex_destroy(&bridge->mutex);
diff --git a/src/nvim/ui_bridge.h b/src/nvim/ui_bridge.h
index 31b9a69216..561ddb6b24 100644
--- a/src/nvim/ui_bridge.h
+++ b/src/nvim/ui_bridge.h
@@ -28,13 +28,13 @@ struct ui_bridge_data {
bool stopped;
};
-#define CONTINUE(b) \
- do { \
- UIBridgeData *d = (UIBridgeData *)b; \
- uv_mutex_lock(&d->mutex); \
- d->ready = true; \
- uv_cond_signal(&d->cond); \
- uv_mutex_unlock(&d->mutex); \
+#define CONTINUE(b) \
+ do { \
+ UIBridgeData *d = (UIBridgeData *)b; \
+ uv_mutex_lock(&d->mutex); \
+ d->ready = true; \
+ uv_cond_signal(&d->cond); \
+ uv_mutex_unlock(&d->mutex); \
} while (0)
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 844c21916f..04a6f63451 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -85,6 +85,7 @@ static int included_patches[] = {
1755,
1753,
1728,
+ 1695,
1654,
1652,
1643,
@@ -224,11 +225,11 @@ static int included_patches[] = {
// 1471 NA
// 1470 NA
// 1469 NA
- // 1468,
+ 1468,
// 1467 NA
// 1466 NA
// 1465 NA
- // 1464,
+ 1464,
// 1463 NA
// 1462 NA
// 1461 NA
@@ -295,10 +296,10 @@ static int included_patches[] = {
// 1400 NA
// 1399 NA
// 1398 NA
- // 1397,
+ 1397,
// 1396,
// 1395 NA
- // 1394,
+ 1394,
// 1393 NA
// 1392 NA
// 1391 NA
@@ -340,7 +341,7 @@ static int included_patches[] = {
// 1355 NA
// 1354 NA
// 1353 NA
- // 1352,
+ 1352,
// 1351 NA
// 1350 NA
// 1349 NA
@@ -469,7 +470,7 @@ static int included_patches[] = {
// 1226 NA
// 1225 NA
// 1224 NA
- // 1223,
+ 1223,
// 1222 NA
// 1221 NA
// 1220 NA
@@ -539,10 +540,10 @@ static int included_patches[] = {
// 1156 NA
// 1155 NA
// 1154 NA
- // 1153,
+ 1153,
// 1152 NA
- // 1151,
- // 1150,
+ 1151,
+ 1150,
1149,
// 1148 NA
// 1147,
@@ -550,7 +551,7 @@ static int included_patches[] = {
// 1145 NA
1144,
1143,
- // 1142,
+ 1142,
1141,
// 1140,
// 1139 NA
@@ -562,7 +563,7 @@ static int included_patches[] = {
// 1133 NA
1132,
// 1131 NA
- // 1130,
+ // 1130 NA
// 1129 NA
// 1128 NA
// 1127 NA
@@ -584,7 +585,7 @@ static int included_patches[] = {
// 1111,
1110,
// 1109 NA
- // 1108,
+ 1108,
1107,
// 1106 NA
1105,
@@ -598,11 +599,11 @@ static int included_patches[] = {
// 1097,
1096,
// 1095 NA
- // 1094,
+ 1094,
1093,
1092,
1091,
- // 1090,
+ 1090,
1089,
1088,
1087,
@@ -624,7 +625,7 @@ static int included_patches[] = {
1071,
// 1070 NA
// 1069 NA
- // 1068,
+ 1068,
// 1067 NA
// 1066 NA
1065,
@@ -636,12 +637,12 @@ static int included_patches[] = {
1059,
// 1058,
1057,
- // 1056,
+ 1056,
1055,
1054,
1053,
1052,
- // 1051,
+ 1051,
1050,
1049,
1048,
@@ -2019,3 +2020,4 @@ void ex_intro(exarg_T *eap)
intro_message(TRUE);
wait_return(TRUE);
}
+
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index 0eefa25a13..cf8a83ad81 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -1,5 +1,5 @@
-- Sanity checks for buffer_* API calls via msgpack-rpc
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, buffer = helpers.clear, helpers.nvim, helpers.buffer
local curbuf, curwin, eq = helpers.curbuf, helpers.curwin, helpers.eq
local curbufmeths, ok = helpers.curbufmeths, helpers.ok
diff --git a/test/functional/api/menu_spec.lua b/test/functional/api/menu_spec.lua
index 5b414fb559..d55b7b118a 100644
--- a/test/functional/api/menu_spec.lua
+++ b/test/functional/api/menu_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua
index 6791fbb4ba..d68ce411c0 100644
--- a/test/functional/api/server_notifications_spec.lua
+++ b/test/functional/api/server_notifications_spec.lua
@@ -1,5 +1,5 @@
-- Tests for nvim notifications
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq, clear, eval, execute, nvim, next_message =
helpers.eq, helpers.clear, helpers.eval, helpers.execute, helpers.nvim,
helpers.next_message
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index 1b33275803..54095112fb 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -1,7 +1,7 @@
-- Tests for some server->client RPC scenarios. Note that unlike with
-- `rpcnotify`, to evaluate `rpcrequest` calls we need the client event loop to
-- be running.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eval = helpers.clear, helpers.nvim, helpers.eval
local eq, neq, run, stop = helpers.eq, helpers.neq, helpers.run, helpers.stop
local nvim_prog = helpers.nvim_prog
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index c782107714..7b97c7f067 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -1,5 +1,5 @@
-- Sanity checks for tabpage_* API calls via msgpack-rpc
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, tabpage, curtab, eq, ok =
helpers.clear, helpers.nvim, helpers.tabpage, helpers.curtab, helpers.eq,
helpers.ok
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 20de6d0072..c4976ea06b 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,5 +1,5 @@
-- Sanity checks for vim_* API calls via msgpack-rpc
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local NIL = helpers.NIL
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 92a33b4cdb..d90323181c 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -1,5 +1,5 @@
-- Sanity checks for window_* API calls via msgpack-rpc
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, curbuf, curbuf_contents, window, curwin, eq, neq,
ok, feed, insert, eval = helpers.clear, helpers.nvim, helpers.curbuf,
helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq,
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
index 3c813abc2e..72aff58d73 100644
--- a/test/functional/autocmd/autocmd_spec.lua
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
diff --git a/test/functional/autocmd/tabclose_spec.lua b/test/functional/autocmd/tabclose_spec.lua
index bf609d1846..65182ad859 100644
--- a/test/functional/autocmd/tabclose_spec.lua
+++ b/test/functional/autocmd/tabclose_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
describe('TabClosed', function()
diff --git a/test/functional/autocmd/tabnew_spec.lua b/test/functional/autocmd/tabnew_spec.lua
index aaf9db0a99..8c94dee49b 100644
--- a/test/functional/autocmd/tabnew_spec.lua
+++ b/test/functional/autocmd/tabnew_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua
index 64b9a22f41..53bbca9f39 100644
--- a/test/functional/autocmd/tabnewentered_spec.lua
+++ b/test/functional/autocmd/tabnewentered_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
describe('TabNewEntered', function()
diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua
index 4de3f039c1..02ea0dbd95 100644
--- a/test/functional/autocmd/termclose_spec.lua
+++ b/test/functional/autocmd/termclose_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, execute, feed, nvim, nvim_dir = helpers.clear,
diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua
index c26ceeaedc..bd5f1912c5 100644
--- a/test/functional/autocmd/textyankpost_spec.lua
+++ b/test/functional/autocmd/textyankpost_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
local feed, execute, expect, command = helpers.feed, helpers.execute, helpers.expect, helpers.command
local curbufmeths, funcs, neq = helpers.curbufmeths, helpers.funcs, helpers.neq
diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua
index 898ec556a2..b4febe4bfb 100644
--- a/test/functional/clipboard/clipboard_provider_spec.lua
+++ b/test/functional/clipboard/clipboard_provider_spec.lua
@@ -1,6 +1,6 @@
-- Test clipboard provider support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect, eq, eval = helpers.execute, helpers.expect, helpers.eq, helpers.eval
diff --git a/test/functional/dict_notifications_spec.lua b/test/functional/dict_notifications_spec.lua
index 2540929126..dc87312911 100644
--- a/test/functional/dict_notifications_spec.lua
+++ b/test/functional/dict_notifications_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, source = helpers.clear, helpers.nvim, helpers.source
local eq, next_msg = helpers.eq, helpers.next_message
local exc_exec = helpers.exc_exec
diff --git a/test/functional/eval/glob_spec.lua b/test/functional/eval/glob_spec.lua
index c6bba46424..599b3dcdc3 100644
--- a/test/functional/eval/glob_spec.lua
+++ b/test/functional/eval/glob_spec.lua
@@ -1,5 +1,5 @@
local lfs = require('lfs')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, eval, eq = helpers.clear, helpers.execute, helpers.eval, helpers.eq
before_each(function()
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index b32688a9d2..c0b56b2102 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local funcs = helpers.funcs
local meths = helpers.meths
diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua
index 9e501353a5..5b87b05652 100644
--- a/test/functional/eval/msgpack_functions_spec.lua
+++ b/test/functional/eval/msgpack_functions_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local funcs = helpers.funcs
local eval, eq = helpers.eval, helpers.eq
diff --git a/test/functional/eval/operators_spec.lua b/test/functional/eval/operators_spec.lua
index bc9a17935c..4d07bc1b05 100644
--- a/test/functional/eval/operators_spec.lua
+++ b/test/functional/eval/operators_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local eval = helpers.eval
local clear = helpers.clear
diff --git a/test/functional/eval/printf_spec.lua b/test/functional/eval/printf_spec.lua
index 6180f4156a..c84290ceef 100644
--- a/test/functional/eval/printf_spec.lua
+++ b/test/functional/eval/printf_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local funcs = helpers.funcs
diff --git a/test/functional/eval/reltime_spec.lua b/test/functional/eval/reltime_spec.lua
index da55a3fac3..0b19d372ec 100644
--- a/test/functional/eval/reltime_spec.lua
+++ b/test/functional/eval/reltime_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eq, ok = helpers.clear, helpers.eq, helpers.ok
local neq, execute, funcs = helpers.neq, helpers.execute, helpers.funcs
local reltime, reltimestr, reltimefloat = funcs.reltime, funcs.reltimestr, funcs.reltimefloat
diff --git a/test/functional/eval/server_spec.lua b/test/functional/eval/server_spec.lua
index 7f53522c08..0fd55ce2f9 100644
--- a/test/functional/eval/server_spec.lua
+++ b/test/functional/eval/server_spec.lua
@@ -1,5 +1,5 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim, eq, neq, eval = helpers.nvim, helpers.eq, helpers.neq, helpers.eval
local clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
local os_name = helpers.os_name
diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua
index 2526483830..4c5d63ce23 100644
--- a/test/functional/eval/special_vars_spec.lua
+++ b/test/functional/eval/special_vars_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local exc_exec = helpers.exc_exec
local execute = helpers.execute
local funcs = helpers.funcs
diff --git a/test/functional/eval/string_spec.lua b/test/functional/eval/string_spec.lua
index abda2c59cb..9e2dc4e111 100644
--- a/test/functional/eval/string_spec.lua
+++ b/test/functional/eval/string_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local command = helpers.command
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index 611113f560..a31e942cdf 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local ok, feed, eq, eval = helpers.ok, helpers.feed, helpers.eq, helpers.eval
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
diff --git a/test/functional/eval/vvar_event_spec.lua b/test/functional/eval/vvar_event_spec.lua
index bbac86524f..eec8aa917a 100644
--- a/test/functional/eval/vvar_event_spec.lua
+++ b/test/functional/eval/vvar_event_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
local command = helpers.command
describe('v:event', function()
diff --git a/test/functional/ex_cmds/append_spec.lua b/test/functional/ex_cmds/append_spec.lua
index 2d5ab8e8c8..3e326d9460 100644
--- a/test/functional/ex_cmds/append_spec.lua
+++ b/test/functional/ex_cmds/append_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local feed = helpers.feed
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 69467632a4..fcd826c25d 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -1,49 +1,145 @@
-- Specs for :cd, :tcd, :lcd and getcwd()
-local helpers = require('test.functional.helpers')
-local execute, eq, clear, eval, exc_exec =
- helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.exc_exec
local lfs = require('lfs')
+local helpers = require('test.functional.helpers')(after_each)
+
+local eq = helpers.eq
+local call = helpers.call
+local clear = helpers.clear
+local execute = helpers.execute
+local exc_exec = helpers.exc_exec
-- These directories will be created for testing
local directories = {
- 'Xtest-functional-ex_cmds-cd_spec.1', -- Tab
- 'Xtest-functional-ex_cmds-cd_spec.2', -- Window
- 'Xtest-functional-ex_cmds-cd_spec.3', -- New global
+ tab = 'Xtest-functional-ex_cmds-cd_spec.tab', -- Tab
+ window = 'Xtest-functional-ex_cmds-cd_spec.window', -- Window
+ global = 'Xtest-functional-ex_cmds-cd_spec.global', -- New global
}
-- Shorthand writing to get the current working directory
-local cwd = function() return eval('getcwd( )') end -- effective working dir
-local wcwd = function() return eval('getcwd( 0 )') end -- window dir
-local tcwd = function() return eval('getcwd(-1, 0)') end -- tab dir
---local gcwd = function() return eval('getcwd(-1, -1)') end -- global dir
+local cwd = function(...) return call('getcwd', ...) end -- effective working dir
+local wcwd = function() return cwd(0) end -- window dir
+local tcwd = function() return cwd(-1, 0) end -- tab dir
-- Same, except these tell us if there is a working directory at all
---local lwd = function() return eval('haslocaldir( )') end -- effective working dir
-local wlwd = function() return eval('haslocaldir( 0 )') end -- window dir
-local tlwd = function() return eval('haslocaldir(-1, 0)') end -- tab dir
+local lwd = function(...) return call('haslocaldir', ...) end -- effective working dir
+local wlwd = function() return lwd(0) end -- window dir
+local tlwd = function() return lwd(-1, 0) end -- tab dir
--local glwd = function() return eval('haslocaldir(-1, -1)') end -- global dir
-- Test both the `cd` and `chdir` variants
for _, cmd in ipairs {'cd', 'chdir'} do
- describe(':*' .. cmd, function()
+ describe(':' .. cmd, function()
before_each(function()
clear()
- for _, d in ipairs(directories) do
+ for _, d in pairs(directories) do
lfs.mkdir(d)
end
+ directories.start = cwd()
end)
after_each(function()
- for _, d in ipairs(directories) do
+ for _, d in pairs(directories) do
lfs.rmdir(d)
end
end)
- it('works', function()
- -- Store the initial working directory
- local globalDir = cwd()
+ describe('using explicit scope', function()
+ it('for window', function()
+ local globalDir = directories.start
+ local globalwin = call('winnr')
+ local tabnr = call('tabpagenr')
+
+ -- Everything matches globalDir to start
+ eq(globalDir, cwd(globalwin))
+ eq(globalDir, cwd(globalwin, tabnr))
+ eq(0, lwd(globalwin))
+ eq(0, lwd(globalwin, tabnr))
+
+ execute('bot split')
+ local localwin = call('winnr')
+ -- Initial window is still using globalDir
+ eq(globalDir, cwd(localwin))
+ eq(globalDir, cwd(localwin, tabnr))
+ eq(0, lwd(globalwin))
+ eq(0, lwd(globalwin, tabnr))
+
+ execute('silent l' .. cmd .. ' ' .. directories.window)
+ -- From window with local dir, the original window
+ -- is still reporting the global dir
+ eq(globalDir, cwd(globalwin))
+ eq(globalDir, cwd(globalwin, tabnr))
+ eq(0, lwd(globalwin))
+ eq(0, lwd(globalwin, tabnr))
+
+ -- Window with local dir reports as such
+ eq(globalDir .. '/' .. directories.window, cwd(localwin))
+ eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr))
+ eq(1, lwd(localwin))
+ eq(1, lwd(localwin, tabnr))
+
+ execute('tabnew')
+ -- From new tab page, original window reports global dir
+ eq(globalDir, cwd(globalwin, tabnr))
+ eq(0, lwd(globalwin, tabnr))
+
+ -- From new tab page, local window reports as such
+ eq(globalDir .. '/' .. directories.window, cwd(localwin, tabnr))
+ eq(1, lwd(localwin, tabnr))
+ end)
+
+ it('for tab page', function()
+ local globalDir = directories.start
+ local globaltab = call('tabpagenr')
+
+ -- Everything matches globalDir to start
+ eq(globalDir, cwd(-1, 0))
+ eq(globalDir, cwd(-1, globaltab))
+ eq(0, lwd(-1, 0))
+ eq(0, lwd(-1, globaltab))
+
+ execute('tabnew')
+ execute('silent t' .. cmd .. ' ' .. directories.tab)
+ local localtab = call('tabpagenr')
+
+ -- From local tab page, original tab reports globalDir
+ eq(globalDir, cwd(-1, globaltab))
+ eq(0, lwd(-1, globaltab))
+
+ -- new tab reports local
+ eq(globalDir .. '/' .. directories.tab, cwd(-1, 0))
+ eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
+ eq(1, lwd(-1, 0))
+ eq(1, lwd(-1, localtab))
+
+ execute('tabnext')
+ -- From original tab page, local reports as such
+ eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
+ eq(1, lwd(-1, localtab))
+ end)
+ end)
+ describe('getcwd(-1, -1)', function()
+ it('works', function()
+ eq(directories.start, cwd(-1, -1))
+ eq(0, lwd(-1, -1))
+ end)
+
+ it('works with tab-local pwd', function()
+ execute('silent t' .. cmd .. ' ' .. directories.tab)
+ eq(directories.start, cwd(-1, -1))
+ eq(0, lwd(-1, -1))
+ end)
+
+ it('works with window-local pwd', function()
+ execute('silent l' .. cmd .. ' ' .. directories.window)
+ eq(directories.start, cwd(-1, -1))
+ eq(0, lwd(-1, -1))
+ end)
+ end)
+
+ it('works', function()
+ local globalDir = directories.start
-- Create a new tab first and verify that is has the same working dir
execute('tabnew')
eq(globalDir, cwd())
@@ -53,8 +149,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, wlwd())
-- Change tab-local working directory and verify it is different
- execute('silent t' .. cmd .. ' ' .. directories[1])
- eq(globalDir .. '/' .. directories[1], cwd())
+ execute('silent t' .. cmd .. ' ' .. directories.tab)
+ eq(globalDir .. '/' .. directories.tab, cwd())
eq(cwd(), tcwd()) -- working directory maches tab directory
eq(1, tlwd())
eq(cwd(), wcwd()) -- still no window-directory
@@ -64,16 +160,16 @@ for _, cmd in ipairs {'cd', 'chdir'} do
execute('new')
eq(1, tlwd()) -- Still tab-local working directory
eq(0, wlwd()) -- Still no window-local working directory
- eq(globalDir .. '/' .. directories[1], cwd())
- execute('silent l' .. cmd .. ' ../' .. directories[2])
- eq(globalDir .. '/' .. directories[2], cwd())
- eq(globalDir .. '/' .. directories[1], tcwd())
+ eq(globalDir .. '/' .. directories.tab, cwd())
+ execute('silent l' .. cmd .. ' ../' .. directories.window)
+ eq(globalDir .. '/' .. directories.window, cwd())
+ eq(globalDir .. '/' .. directories.tab, tcwd())
eq(1, wlwd())
-- Verify the first window still has the tab local directory
execute('wincmd w')
- eq(globalDir .. '/' .. directories[1], cwd())
- eq(globalDir .. '/' .. directories[1], tcwd())
+ eq(globalDir .. '/' .. directories.tab, cwd())
+ eq(globalDir .. '/' .. directories.tab, tcwd())
eq(0, wlwd()) -- No window-local directory
-- Change back to initial tab and verify working directory has stayed
@@ -83,11 +179,11 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, wlwd())
-- Verify global changes don't affect local ones
- execute('silent ' .. cmd .. ' ' .. directories[3])
- eq(globalDir .. '/' .. directories[3], cwd())
+ execute('silent ' .. cmd .. ' ' .. directories.global)
+ eq(globalDir .. '/' .. directories.global, cwd())
execute('tabnext')
- eq(globalDir .. '/' .. directories[1], cwd())
- eq(globalDir .. '/' .. directories[1], tcwd())
+ eq(globalDir .. '/' .. directories.tab, cwd())
+ eq(globalDir .. '/' .. directories.tab, tcwd())
eq(0, wlwd()) -- Still no window-local directory in this window
-- Unless the global change happened in a tab with local directory
@@ -101,9 +197,9 @@ for _, cmd in ipairs {'cd', 'chdir'} do
-- But not in a window with its own local directory
execute('tabnext | wincmd w')
- eq(globalDir .. '/' .. directories[2], cwd() )
+ eq(globalDir .. '/' .. directories.window, cwd() )
eq(0 , tlwd())
- eq(globalDir .. '/' .. directories[2], wcwd())
+ eq(globalDir .. '/' .. directories.window, wcwd())
end)
end)
end
diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua
index 6d402b7974..4d96335d62 100644
--- a/test/functional/ex_cmds/encoding_spec.lua
+++ b/test/functional/ex_cmds/encoding_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, feed = helpers.clear, helpers.execute, helpers.feed
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
diff --git a/test/functional/ex_cmds/grep_spec.lua b/test/functional/ex_cmds/grep_spec.lua
index f3ff0a3817..13f88b7e03 100644
--- a/test/functional/ex_cmds/grep_spec.lua
+++ b/test/functional/ex_cmds/grep_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, feed, ok, eval =
helpers.clear, helpers.execute, helpers.feed, helpers.ok, helpers.eval
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua
index f5fd30465d..10bcc5b7bb 100644
--- a/test/functional/ex_cmds/menu_spec.lua
+++ b/test/functional/ex_cmds/menu_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
local expect, feed, command = helpers.expect, helpers.feed, helpers.command
local eq, eval = helpers.eq, helpers.eval
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index 5bba1a0e7c..b7109f2f98 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -1,5 +1,5 @@
local Screen = require('test.functional.ui.screen')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local buf, eq, execute = helpers.curbufmeths, helpers.eq, helpers.execute
local feed, nvim_prog, wait = helpers.feed, helpers.nvim_prog, helpers.wait
diff --git a/test/functional/ex_cmds/profile_spec.lua b/test/functional/ex_cmds/profile_spec.lua
index 744b22621f..d390806679 100644
--- a/test/functional/ex_cmds/profile_spec.lua
+++ b/test/functional/ex_cmds/profile_spec.lua
@@ -1,7 +1,7 @@
require('os')
local lfs = require('lfs')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eval = helpers.eval
local command = helpers.command
local eq, neq = helpers.eq, helpers.neq
diff --git a/test/functional/ex_cmds/quit_spec.lua b/test/functional/ex_cmds/quit_spec.lua
index a8156228d3..697c000766 100644
--- a/test/functional/ex_cmds/quit_spec.lua
+++ b/test/functional/ex_cmds/quit_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
describe(':qa', function()
diff --git a/test/functional/ex_cmds/recover_spec.lua b/test/functional/ex_cmds/recover_spec.lua
index e1d01f6896..60673d25ef 100644
--- a/test/functional/ex_cmds/recover_spec.lua
+++ b/test/functional/ex_cmds/recover_spec.lua
@@ -1,6 +1,6 @@
-- Tests for :recover
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local lfs = require('lfs')
local execute, eq, clear, eval, feed, expect, source =
helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
diff --git a/test/functional/ex_cmds/sign_spec.lua b/test/functional/ex_cmds/sign_spec.lua
index c50704504d..b37e6e8563 100644
--- a/test/functional/ex_cmds/sign_spec.lua
+++ b/test/functional/ex_cmds/sign_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
describe('sign', function()
diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua
index d90b297ca8..83513d747f 100644
--- a/test/functional/ex_cmds/write_spec.lua
+++ b/test/functional/ex_cmds/write_spec.lua
@@ -1,6 +1,6 @@
-- Specs for :write
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq, eval, clear, write_file, execute, source =
helpers.eq, helpers.eval, helpers.clear, helpers.write_file,
helpers.execute, helpers.source
diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua
index 969dfea3d9..e1216fa5d4 100644
--- a/test/functional/ex_cmds/wundo_spec.lua
+++ b/test/functional/ex_cmds/wundo_spec.lua
@@ -1,6 +1,6 @@
-- Specs for :wundo and underlying functions
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local execute, clear, eval, feed, spawn, nvim_prog, set_session =
helpers.execute, helpers.clear, helpers.eval, helpers.feed, helpers.spawn,
helpers.nvim_prog, helpers.set_session
diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua
index 21f14be62c..37f45da2d4 100644
--- a/test/functional/ex_cmds/wviminfo_spec.lua
+++ b/test/functional/ex_cmds/wviminfo_spec.lua
@@ -1,4 +1,5 @@
-local helpers, lfs = require('test.functional.helpers'), require('lfs')
+local helpers = require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
local execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
= helpers.execute, helpers.eq, helpers.neq, helpers.spawn,
helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
diff --git a/test/functional/ex_getln/history_spec.lua b/test/functional/ex_getln/history_spec.lua
index 532c81dab9..c1d2ffda53 100644
--- a/test/functional/ex_getln/history_spec.lua
+++ b/test/functional/ex_getln/history_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, meths, funcs, eq =
helpers.clear, helpers.meths, helpers.funcs, helpers.eq
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 37b7bf664c..5eec5638f5 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -1,8 +1,13 @@
require('coxpcall')
local lfs = require('lfs')
-local assert = require('luassert')
local ChildProcessStream = require('nvim.child_process_stream')
local Session = require('nvim.session')
+local global_helpers = require('test.helpers')
+
+local check_logs = global_helpers.check_logs
+local neq = global_helpers.neq
+local eq = global_helpers.eq
+local ok = global_helpers.ok
local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
@@ -30,7 +35,7 @@ if os.getenv('VALGRIND') then
prepend_argv = {'valgrind', '-q', '--tool=memcheck',
'--leak-check=yes', '--track-origins=yes',
'--show-possibly-lost=no',
- '--suppressions=.valgrind.supp',
+ '--suppressions=src/.valgrind.supp',
'--log-file='..log_file}
if os.getenv('GDB') then
table.insert(prepend_argv, '--vgdb=yes')
@@ -267,18 +272,6 @@ local function source(code)
return tmpname
end
-local function eq(expected, actual)
- return assert.are.same(expected, actual)
-end
-
-local function neq(expected, actual)
- return assert.are_not.same(expected, actual)
-end
-
-local function ok(expr)
- assert.is_true(expr)
-end
-
local function nvim(method, ...)
return request('vim_'..method, ...)
end
@@ -345,10 +338,18 @@ local function rmdir(path)
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
- local ret, err = os.remove(path..'/'..file)
- if not ret then
- error('os.remove: '..err)
- return nil
+ local abspath = path..'/'..file
+ if lfs.attributes(abspath, 'mode') == 'directory' then
+ local ret = rmdir(abspath) -- recurse
+ if not ret then
+ return nil
+ end
+ else
+ local ret, err = os.remove(abspath)
+ if not ret then
+ error('os.remove: '..err)
+ return nil
+ end
end
end
end
@@ -404,54 +405,59 @@ local curbufmeths = create_callindex(curbuf)
local curwinmeths = create_callindex(curwin)
local curtabmeths = create_callindex(curtab)
-return {
- prepend_argv = prepend_argv,
- clear = clear,
- spawn = spawn,
- dedent = dedent,
- source = source,
- rawfeed = rawfeed,
- insert = insert,
- feed = feed,
- execute = execute,
- eval = nvim_eval,
- call = nvim_call,
- command = nvim_command,
- request = request,
- next_message = next_message,
- run = run,
- stop = stop,
- eq = eq,
- neq = neq,
- expect = expect,
- ok = ok,
- nvim = nvim,
- nvim_async = nvim_async,
- nvim_prog = nvim_prog,
- nvim_dir = nvim_dir,
- buffer = buffer,
- window = window,
- tabpage = tabpage,
- curbuf = curbuf,
- curwin = curwin,
- curtab = curtab,
- curbuf_contents = curbuf_contents,
- wait = wait,
- set_session = set_session,
- write_file = write_file,
- os_name = os_name,
- rmdir = rmdir,
- mkdir = lfs.mkdir,
- exc_exec = exc_exec,
- redir_exec = redir_exec,
- merge_args = merge_args,
- funcs = funcs,
- meths = meths,
- bufmeths = bufmeths,
- winmeths = winmeths,
- tabmeths = tabmeths,
- curbufmeths = curbufmeths,
- curwinmeths = curwinmeths,
- curtabmeths = curtabmeths,
- NIL = mpack.NIL
-}
+return function(after_each)
+ if after_each then
+ after_each(check_logs)
+ end
+ return {
+ prepend_argv = prepend_argv,
+ clear = clear,
+ spawn = spawn,
+ dedent = dedent,
+ source = source,
+ rawfeed = rawfeed,
+ insert = insert,
+ feed = feed,
+ execute = execute,
+ eval = nvim_eval,
+ call = nvim_call,
+ command = nvim_command,
+ request = request,
+ next_message = next_message,
+ run = run,
+ stop = stop,
+ eq = eq,
+ neq = neq,
+ expect = expect,
+ ok = ok,
+ nvim = nvim,
+ nvim_async = nvim_async,
+ nvim_prog = nvim_prog,
+ nvim_dir = nvim_dir,
+ buffer = buffer,
+ window = window,
+ tabpage = tabpage,
+ curbuf = curbuf,
+ curwin = curwin,
+ curtab = curtab,
+ curbuf_contents = curbuf_contents,
+ wait = wait,
+ set_session = set_session,
+ write_file = write_file,
+ os_name = os_name,
+ rmdir = rmdir,
+ mkdir = lfs.mkdir,
+ exc_exec = exc_exec,
+ redir_exec = redir_exec,
+ merge_args = merge_args,
+ funcs = funcs,
+ meths = meths,
+ bufmeths = bufmeths,
+ winmeths = winmeths,
+ tabmeths = tabmeths,
+ curbufmeths = curbufmeths,
+ curwinmeths = curwinmeths,
+ curtabmeths = curtabmeths,
+ NIL = mpack.NIL,
+ }
+end
diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua
index d21b9051e2..b54d5166ac 100644
--- a/test/functional/job/job_spec.lua
+++ b/test/functional/job/job_spec.lua
@@ -1,11 +1,11 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eq, eval, execute, feed, insert, neq, next_msg, nvim,
- nvim_dir, ok, source, write_file = helpers.clear,
+ nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
helpers.eq, helpers.eval, helpers.execute, helpers.feed,
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
helpers.nvim_dir, helpers.ok, helpers.source,
- helpers.write_file
+ helpers.write_file, helpers.mkdir, helpers.rmdir
local Screen = require('test.functional.ui.screen')
@@ -37,6 +37,32 @@ describe('jobs', function()
eq({'notification', 'exit', {0, 0}}, next_msg())
end)
+ it('changes to given / directory', function()
+ nvim('command', "let g:job_opts.cwd = '/'")
+ nvim('command', "let j = jobstart('pwd', g:job_opts)")
+ eq({'notification', 'stdout', {0, {'/', ''}}}, next_msg())
+ eq({'notification', 'exit', {0, 0}}, next_msg())
+ end)
+
+ it('changes to given `cwd` directory', function()
+ local dir = eval('resolve(tempname())')
+ mkdir(dir)
+ nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
+ nvim('command', "let j = jobstart('pwd', g:job_opts)")
+ eq({'notification', 'stdout', {0, {dir, ''}}}, next_msg())
+ eq({'notification', 'exit', {0, 0}}, next_msg())
+ rmdir(dir)
+ end)
+
+ it('fails to change to invalid `cwd`', function()
+ local dir = eval('resolve(tempname())."-bogus"')
+ local _, err = pcall(function()
+ nvim('command', "let g:job_opts.cwd = '" .. dir .. "'")
+ nvim('command', "let j = jobstart('pwd', g:job_opts)")
+ end)
+ ok(string.find(err, "E475: Invalid argument: expected valid directory$") ~= nil)
+ end)
+
it('returns 0 when it fails to start', function()
local status, rv = pcall(eval, "jobstart([])")
eq(false, status)
diff --git a/test/functional/legacy/002_filename_recognition_spec.lua b/test/functional/legacy/002_filename_recognition_spec.lua
index 569e748631..5a833281e7 100644
--- a/test/functional/legacy/002_filename_recognition_spec.lua
+++ b/test/functional/legacy/002_filename_recognition_spec.lua
@@ -1,7 +1,7 @@
-- Test if URLs are recognized as filenames by commands such as "gf". Here
-- we'll use `expand("<cfile>")` since "gf" would need to open the file.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/003_cindent_spec.lua b/test/functional/legacy/003_cindent_spec.lua
index 4b838eda1d..83388bd1eb 100644
--- a/test/functional/legacy/003_cindent_spec.lua
+++ b/test/functional/legacy/003_cindent_spec.lua
@@ -3,7 +3,7 @@
-- There are 50+ test command blocks (the stuff between STARTTEST and ENDTEST)
-- in the original test. These have been converted to "it" test cases here.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
index 34e702b798..3e5cdd2ff2 100644
--- a/test/functional/legacy/004_bufenter_with_modelines_spec.lua
+++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
@@ -2,7 +2,7 @@
-- Test for autocommand that changes current buffer on BufEnter event.
-- Check if modelines are interpreted for the correct buffer.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
index e6989a6674..895f4ad181 100644
--- a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
+++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
@@ -1,7 +1,7 @@
-- Test for autocommand that deletes the current buffer on BufLeave event.
-- Also test deleting the last buffer, should give a new, empty buffer.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/006_argument_list_spec.lua b/test/functional/legacy/006_argument_list_spec.lua
index 1266a876d4..764854314f 100644
--- a/test/functional/legacy/006_argument_list_spec.lua
+++ b/test/functional/legacy/006_argument_list_spec.lua
@@ -1,6 +1,6 @@
-- Test for autocommand that redefines the argument list, when doing ":all".
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, dedent, eq = helpers.execute, helpers.dedent, helpers.eq
local curbuf_contents = helpers.curbuf_contents
diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua
index 295f63f044..07e3fe6e7a 100644
--- a/test/functional/legacy/007_ball_buffer_list_spec.lua
+++ b/test/functional/legacy/007_ball_buffer_list_spec.lua
@@ -1,6 +1,6 @@
-- Test for autocommand that changes the buffer list, when doing ":ball".
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/009_bufleave_autocommand_spec.lua b/test/functional/legacy/009_bufleave_autocommand_spec.lua
index 8c18639c8f..7481c639cf 100644
--- a/test/functional/legacy/009_bufleave_autocommand_spec.lua
+++ b/test/functional/legacy/009_bufleave_autocommand_spec.lua
@@ -1,6 +1,6 @@
-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, insert = helpers.clear, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/010_errorformat_spec.lua b/test/functional/legacy/010_errorformat_spec.lua
new file mode 100644
index 0000000000..785bf136b5
--- /dev/null
+++ b/test/functional/legacy/010_errorformat_spec.lua
@@ -0,0 +1,156 @@
+-- Test for 'errorformat'. This will fail if the quickfix feature was
+-- disabled.
+
+local helpers = require('test.functional.helpers')(after_each)
+local feed, clear, execute = helpers.feed, helpers.clear, helpers.execute
+local expect, write_file = helpers.expect, helpers.write_file
+
+describe('errorformat', function()
+ setup(function()
+ clear()
+ local error_file_text = [[
+ start of errorfile
+ "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.
+ "Xtestfile", line 6 col 19; this is an error
+ gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c
+ Xtestfile:9: parse error before `asd'
+ make: *** [vim] Error 1
+ in file "Xtestfile" linenr 10: there is an error
+
+ 2 returned
+ "Xtestfile", line 11 col 1; this is an error
+ "Xtestfile", line 12 col 2; this is another error
+ "Xtestfile", line 14:10; this is an error in column 10
+ =Xtestfile=, line 15:10; this is another error, but in vcol 10 this time
+ "Xtestfile", linenr 16: yet another problem
+ Error in "Xtestfile" at line 17:
+ x should be a dot
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
+ ^
+ Error in "Xtestfile" at line 18:
+ x should be a dot
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
+ .............^
+ Error in "Xtestfile" at line 19:
+ x should be a dot
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
+ --------------^
+ Error in "Xtestfile" at line 20:
+ x should be a dot
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
+ ^
+
+ Does anyone know what is the problem and how to correction it?
+ "Xtestfile", line 21 col 9: What is the title of the quickfix window?
+ "Xtestfile", line 22 col 9: What is the title of the quickfix window?
+ ]]
+ write_file('Xerrorfile1', error_file_text .. 'end of errorfile\n')
+ write_file('Xerrorfile2', error_file_text)
+ write_file('Xtestfile', [[
+ start of testfile
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22
+ end of testfile
+ ]])
+ end)
+ teardown(function()
+ os.remove('Xerrorfile1')
+ os.remove('Xerrorfile2')
+ os.remove('Xtestfile')
+ end)
+
+ it('is working', function()
+ -- Also test a BOM is ignored.
+ execute(
+ 'set encoding=utf-8',
+ [[set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m]],
+ [[set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m]],
+ 'cf Xerrorfile2',
+ 'clast',
+ 'copen',
+ 'let a=w:quickfix_title',
+ 'wincmd p'
+ )
+ feed('lgR<C-R>=a<CR><esc>')
+ execute('cf Xerrorfile1')
+ feed('grA<cr>')
+ execute('cn')
+ feed('gRLINE 6, COL 19<esc>')
+ execute('cn')
+ feed('gRNO COLUMN SPECIFIED<esc>')
+ execute('cn')
+ feed('gRAGAIN NO COLUMN<esc>')
+ execute('cn')
+ feed('gRCOL 1<esc>')
+ execute('cn')
+ feed('gRCOL 2<esc>')
+ execute('cn')
+ feed('gRCOL 10<esc>')
+ execute('cn')
+ feed('gRVCOL 10<esc>')
+ execute('cn')
+ feed('grI<cr>')
+ execute('cn')
+ feed('gR. SPACE POINTER<esc>')
+ execute('cn')
+ feed('gR. DOT POINTER<esc>')
+ execute('cn')
+ feed('gR. DASH POINTER<esc>')
+ execute('cn')
+ feed('gR. TAB-SPACE POINTER<esc>')
+ execute(
+ 'clast',
+ 'cprev',
+ 'cprev',
+ 'wincmd w',
+ 'let a=w:quickfix_title',
+ 'wincmd p'
+ )
+ feed('lgR<C-R>=a<CR><esc>')
+
+ -- Assert buffer contents.
+ expect([[
+ start of testfile
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3
+ xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx line 4
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5
+ xxxxxxxxxxxxxxxxxLINE 6, COL 19 line 6
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8
+ NO COLUMN SPECIFIEDxxxxxxxxxxx line 9
+ AGAIN NO COLUMNxxxxxxxxxxxxxxx line 10
+ COL 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11
+ COL 2xxxxxxxxxxxxxxxxxxxxxxxxx line 12
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13
+ xxxxxxxxCOL 10xxxxxxxxxxxxxxxx line 14
+ xVCOL 10xxxxxxxxxxxxxxxxxxxxxx line 15
+ Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16
+ xxxx. SPACE POINTERxxxxxxxxxxx line 17
+ xxxxx. DOT POINTERxxxxxxxxxxxx line 18
+ xxxxxx. DASH POINTERxxxxxxxxxx line 19
+ xxxxxxx. TAB-SPACE POINTERxxxx line 20
+ xxxxxxxx:cf Xerrorfile1xxxxxxx line 21
+ xxxxxxxx:cf Xerrorfile2xxxxxxx line 22
+ end of testfile]])
+ end)
+end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 483e465cee..6e613c85df 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -12,7 +12,8 @@
-- Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz"
-- being modified outside of Vim (noticed on Solaris).
-local helpers, lfs = require('test.functional.helpers'), require('lfs')
+local helpers= require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
local clear, execute, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.execute, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua
index 3b19f4ff42..48d4042ff2 100644
--- a/test/functional/legacy/015_alignment_spec.lua
+++ b/test/functional/legacy/015_alignment_spec.lua
@@ -2,7 +2,7 @@
-- Also test formatting a paragraph.
-- Also test undo after ":%s" and formatting.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua
index 6975cb7f26..ba1eac02cb 100644
--- a/test/functional/legacy/018_unset_smart_indenting_spec.lua
+++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua
@@ -1,6 +1,6 @@
-- Tests for not doing smart indenting when it isn't set.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/019_smarttab_expandtab_spec.lua b/test/functional/legacy/019_smarttab_expandtab_spec.lua
index a33bd0c3ae..2287a9f786 100644
--- a/test/functional/legacy/019_smarttab_expandtab_spec.lua
+++ b/test/functional/legacy/019_smarttab_expandtab_spec.lua
@@ -1,7 +1,7 @@
-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
-- Also test that dv_ works correctly
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua
index 95574a0957..660348a792 100644
--- a/test/functional/legacy/020_blockwise_visual_spec.lua
+++ b/test/functional/legacy/020_blockwise_visual_spec.lua
@@ -3,7 +3,7 @@
-- First test for undo working properly when executing commands from a register.
-- Also test this in an empty buffer.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua
index 9fd83fec5f..787a384fca 100644
--- a/test/functional/legacy/021_control_wi_spec.lua
+++ b/test/functional/legacy/021_control_wi_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/022_line_ending_spec.lua b/test/functional/legacy/022_line_ending_spec.lua
index a841378a82..092440bb16 100644
--- a/test/functional/legacy/022_line_ending_spec.lua
+++ b/test/functional/legacy/022_line_ending_spec.lua
@@ -1,6 +1,6 @@
-- Tests for file with some lines ending in CTRL-M, some not
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua
index 15b30bfa3a..95ab983d24 100644
--- a/test/functional/legacy/023_edit_arguments_spec.lua
+++ b/test/functional/legacy/023_edit_arguments_spec.lua
@@ -1,6 +1,6 @@
-- Tests for complicated + argument to :edit command
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, insert = helpers.clear, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua
index bd434c013c..7b7ddb07b9 100644
--- a/test/functional/legacy/025_jump_tag_hidden_spec.lua
+++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua
@@ -1,7 +1,7 @@
-- Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag.
-- This only works for Unix, because of the symbolic link.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/026_execute_while_if_spec.lua b/test/functional/legacy/026_execute_while_if_spec.lua
index f17bb79702..74ef34bb20 100644
--- a/test/functional/legacy/026_execute_while_if_spec.lua
+++ b/test/functional/legacy/026_execute_while_if_spec.lua
@@ -1,6 +1,6 @@
-- Test for :execute, :while and :if
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local execute, expect = helpers.execute, helpers.expect
local source = helpers.source
diff --git a/test/functional/legacy/027_expand_file_names_spec.lua b/test/functional/legacy/027_expand_file_names_spec.lua
deleted file mode 100644
index 4778d16d43..0000000000
--- a/test/functional/legacy/027_expand_file_names_spec.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- Test for expanding file names
-
-local helpers = require('test.functional.helpers')
-local clear, feed = helpers.clear, helpers.feed
-local execute = helpers.execute
-local curbuf_contents = helpers.curbuf_contents
-local eq = helpers.eq
-
-describe('expand file name', function()
- setup(clear)
-
- it('is working', function()
- execute('!mkdir Xdir1')
- execute('!mkdir Xdir2')
- execute('!mkdir Xdir3')
- execute('cd Xdir3')
- execute('!mkdir Xdir4')
- execute('cd ..')
- execute('w Xdir1/file')
- execute('w Xdir3/Xdir4/file')
- execute('n Xdir?/*/file')
-
- -- Yank current file path to @a register
- feed('i<C-R>%<Esc>V"ad')
-
- -- Put @a and current file path in the current buffer
- execute('n! Xdir?/*/nofile')
- feed('V"ap')
- feed('o<C-R>%<Esc>')
-
- eq("Xdir3/Xdir4/file\nXdir?/*/nofile", curbuf_contents())
- end)
-
- teardown(function()
- os.execute('rm -rf Xdir1 Xdir2 Xdir3')
- end)
-end)
diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua
index fc36b436ef..a8c43260be 100644
--- a/test/functional/legacy/028_source_ctrl_v_spec.lua
+++ b/test/functional/legacy/028_source_ctrl_v_spec.lua
@@ -1,6 +1,6 @@
-- Test for sourcing a file with CTRL-V's at the end of the line
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/029_join_spec.lua b/test/functional/legacy/029_join_spec.lua
index 25a072ad6e..7a183fcbec 100644
--- a/test/functional/legacy/029_join_spec.lua
+++ b/test/functional/legacy/029_join_spec.lua
@@ -1,6 +1,6 @@
-- Test for joining lines with marks in them (and with 'joinspaces' set/reset)
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/031_close_commands_spec.lua b/test/functional/legacy/031_close_commands_spec.lua
index b79b1903ba..eaf4e2982f 100644
--- a/test/functional/legacy/031_close_commands_spec.lua
+++ b/test/functional/legacy/031_close_commands_spec.lua
@@ -9,9 +9,14 @@
-- :buf
-- :edit
-local helpers = require('test.functional.helpers')
-local feed, insert, source = helpers.feed, helpers.insert, helpers.source
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local helpers = require('test.functional.helpers')(after_each)
+
+local feed = helpers.feed
+local clear = helpers.clear
+local source = helpers.source
+local insert = helpers.insert
+local expect = helpers.expect
+local execute = helpers.execute
describe('Commands that close windows and/or buffers', function()
setup(clear)
diff --git a/test/functional/legacy/033_lisp_indent_spec.lua b/test/functional/legacy/033_lisp_indent_spec.lua
index 0a5577fad3..b4abb02ac2 100644
--- a/test/functional/legacy/033_lisp_indent_spec.lua
+++ b/test/functional/legacy/033_lisp_indent_spec.lua
@@ -2,7 +2,7 @@
-- Test for 'lisp'
-- If the lisp feature is not enabled, this will fail!
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/034_user_function_spec.lua b/test/functional/legacy/034_user_function_spec.lua
new file mode 100644
index 0000000000..38989cd982
--- /dev/null
+++ b/test/functional/legacy/034_user_function_spec.lua
@@ -0,0 +1,102 @@
+-- Test for user functions.
+-- Also test an <expr> mapping calling a function.
+-- Also test that a builtin function cannot be replaced.
+-- Also test for regression when calling arbitrary expression.
+
+local helpers = require('test.functional.helpers')(after_each)
+local feed, insert, source = helpers.feed, helpers.insert, helpers.source
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', function()
+ setup(clear)
+
+ it('are working', function()
+ insert('here')
+
+ source([[
+ function Table(title, ...)
+ let ret = a:title
+ let idx = 1
+ while idx <= a:0
+ exe "let ret = ret . a:" . idx
+ let idx = idx + 1
+ endwhile
+ return ret
+ endfunction
+ function Compute(n1, n2, divname)
+ if a:n2 == 0
+ return "fail"
+ endif
+ exe "let g:" . a:divname . " = ". a:n1 / a:n2
+ return "ok"
+ endfunction
+ func Expr1()
+ normal! v
+ return "111"
+ endfunc
+ func Expr2()
+ call search('XX', 'b')
+ return "222"
+ endfunc
+ func ListItem()
+ let g:counter += 1
+ return g:counter . '. '
+ endfunc
+ func ListReset()
+ let g:counter = 0
+ return ''
+ endfunc
+ func FuncWithRef(a)
+ unlet g:FuncRef
+ return a:a
+ endfunc
+ let g:FuncRef=function("FuncWithRef")
+ let counter = 0
+ inoremap <expr> ( ListItem()
+ inoremap <expr> [ ListReset()
+ imap <expr> + Expr1()
+ imap <expr> * Expr2()
+ let retval = "nop"
+ /^here
+ ]])
+ feed('C<C-R>=Table("xxx", 4, "asdf")<cr>')
+ -- Using a actual space will not work as feed() calls dedent on the input.
+ feed('<space><C-R>=Compute(45, 0, "retval")<cr>')
+ feed('<space><C-R>=retval<cr>')
+ feed('<space><C-R>=Compute(45, 5, "retval")<cr>')
+ feed('<space><C-R>=retval<cr>')
+ feed('<space><C-R>=g:FuncRef(333)<cr>')
+ feed('<cr>')
+ feed('XX+-XX<cr>')
+ feed('---*---<cr>')
+ feed('(one<cr>')
+ feed('(two<cr>')
+ feed('[(one again<esc>')
+ execute('call append(line("$"), max([1, 2, 3]))')
+ execute('call extend(g:, {"max": function("min")})')
+ execute('call append(line("$"), max([1, 2, 3]))')
+ execute('try')
+ -- Regression: the first line below used to throw "E110: Missing ')'"
+ -- Second is here just to prove that this line is correct when not
+ -- skipping rhs of &&.
+ execute([[ $put =(0&&(function('tr'))(1, 2, 3))]])
+ execute([[ $put =(1&&(function('tr'))(1, 2, 3))]])
+ execute('catch')
+ execute([[ $put ='!!! Unexpected exception:']])
+ execute(' $put =v:exception')
+ execute('endtry')
+
+ -- Assert buffer contents.
+ expect([[
+ xxx4asdf fail nop ok 9 333
+ XX111-XX
+ ---222---
+ 1. one
+ 2. two
+ 1. one again
+ 3
+ 3
+ 0
+ 1]])
+ end)
+end)
diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua
index e6252c384b..3b9f7a9d85 100644
--- a/test/functional/legacy/035_increment_and_decrement_spec.lua
+++ b/test/functional/legacy/035_increment_and_decrement_spec.lua
@@ -1,7 +1,7 @@
-- Test Ctrl-A and Ctrl-X, which increment and decrement decimal, hexadecimal,
-- and octal numbers.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index de080f4b43..3d5e69d1e5 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -1,6 +1,6 @@
-- Test character classes in regexp using regexpengine 0, 1, 2.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
local source, write_file = helpers.source, helpers.write_file
local os_name = helpers.os_name
diff --git a/test/functional/legacy/038_virtual_replace_spec.lua b/test/functional/legacy/038_virtual_replace_spec.lua
index 10d42f0cea..dcbc9c39f7 100644
--- a/test/functional/legacy/038_virtual_replace_spec.lua
+++ b/test/functional/legacy/038_virtual_replace_spec.lua
@@ -1,6 +1,6 @@
-- Test Virtual replace mode.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
index 7195d7d11d..63335985cc 100644
--- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua
+++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
@@ -1,7 +1,7 @@
-- Test Visual block mode commands
-- And test "U" in Visual mode, also on German sharp S.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim, eq = helpers.meths, helpers.eq
local insert, feed = helpers.insert, helpers.feed
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua
index 42fb5ed2b3..b6451eb720 100644
--- a/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua
+++ b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua
@@ -1,6 +1,6 @@
-- Test for writing and reading a file of over 100 Kbyte
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/043_magic_settings_spec.lua b/test/functional/legacy/043_magic_settings_spec.lua
index 27694e3754..f174751de2 100644
--- a/test/functional/legacy/043_magic_settings_spec.lua
+++ b/test/functional/legacy/043_magic_settings_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for regexp with various magic settings.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
index 2a4c0149fa..4189e8a33a 100644
--- a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
+++ b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
@@ -3,7 +3,7 @@
--
-- This test contains both "test44" and "test99" from the old test suite.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/045_folding_spec.lua b/test/functional/legacy/045_folding_spec.lua
index 04b623ff3b..cefd7c0d42 100644
--- a/test/functional/legacy/045_folding_spec.lua
+++ b/test/functional/legacy/045_folding_spec.lua
@@ -1,6 +1,6 @@
-- Tests for folding.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, clear, execute, expect =
helpers.feed, helpers.insert, helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/046_multi_line_regexps_spec.lua b/test/functional/legacy/046_multi_line_regexps_spec.lua
index b17ab42fe3..30ec76ea3e 100644
--- a/test/functional/legacy/046_multi_line_regexps_spec.lua
+++ b/test/functional/legacy/046_multi_line_regexps_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for multi-line regexps with ":s"
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local expect = helpers.expect
diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/051_highlight_spec.lua
index 94c42b73e5..5bf3b51b90 100644
--- a/test/functional/legacy/051_highlight_spec.lua
+++ b/test/functional/legacy/051_highlight_spec.lua
@@ -2,7 +2,7 @@
-- Tests for ":highlight".
local Screen = require('test.functional.ui.screen')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
local execute, expect = helpers.execute, helpers.expect
local wait = helpers.wait
diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
index bcedb26b7e..494ea8f927 100644
--- a/test/functional/legacy/054_buffer_local_autocommands_spec.lua
+++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
@@ -1,6 +1,6 @@
-- Some tests for buffer-local autocommands
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
local curbuf_contents = helpers.curbuf_contents
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
new file mode 100644
index 0000000000..dee138e6d8
--- /dev/null
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -0,0 +1,949 @@
+-- Tests for List and Dictionary types.
+
+local helpers = require('test.functional.helpers')(after_each)
+local feed, source = helpers.feed, helpers.source
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('list and dictionary types', function()
+ before_each(clear)
+
+ it('creating list directly with different types', function()
+ source([[
+ lang C
+ let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
+ $put =string(l)
+ $put =string(l[-1])
+ $put =string(l[-4])
+ try
+ $put =string(l[-5])
+ catch
+ $put =v:exception[:14]
+ endtry]])
+ expect([[
+
+ [1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
+ {'a': 1}
+ 1
+ Vim(put):E684: ]])
+ end)
+
+ it('list slices', function()
+ source([[
+ lang C
+ " The list from the first test repeated after splitting the tests.
+ let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
+ $put =string(l[:])
+ $put =string(l[1:])
+ $put =string(l[:-2])
+ $put =string(l[0:8])
+ $put =string(l[8:-1])]])
+ expect([=[
+
+ [1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
+ ['as''d', [1, 2, function('strlen')], {'a': 1}]
+ [1, 'as''d', [1, 2, function('strlen')]]
+ [1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
+ []]=])
+ end)
+
+ it('list identity', function()
+ source([[
+ lang C
+ " The list from the first test repeated after splitting the tests.
+ let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
+ let ll = l
+ let lx = copy(l)
+ try
+ $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) .
+ \ (l is lx) . (l isnot lx)
+ catch
+ $put =v:exception
+ endtry]])
+ expect('\n101101')
+ end)
+
+ it('creating dictionary directly with different types', function()
+ source([[
+ lang C
+ let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},}
+ $put =string(d) . d.1
+ $put =string(sort(keys(d)))
+ $put =string (values(d))
+ for [key, val] in items(d)
+ $put =key . ':' . string(val)
+ unlet key val
+ endfor
+ call extend (d, {3:33, 1:99})
+ call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
+ try
+ call extend(d, {3:333,4:444}, "error")
+ catch
+ $put =v:exception[:15] . v:exception[-1:-1]
+ endtry
+ $put =string(d)
+ call filter(d, 'v:key =~ ''[ac391]''')
+ $put =string(d)]])
+ expect([[
+
+ {'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd
+ ['-1', '1', 'b']
+ ['asd', [1, 2, function('strlen')], {'a': 1}]
+ 1:'asd'
+ b:[1, 2, function('strlen')]
+ -1:{'a': 1}
+ Vim(call):E737: 3
+ {'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}}
+ {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}]])
+ end)
+
+ it('dictionary identity', function()
+ source([[
+ lang C
+ " The dict from the first test repeated after splitting the tests.
+ let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
+ let dd = d
+ let dx = copy(d)
+ try
+ $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) .
+ \ (d isnot dx)
+ catch
+ $put =v:exception
+ endtry]])
+ expect('\n101101')
+ end)
+
+ it('changing var type should fail', function()
+ source([[
+ lang C
+ " The list from the first test repeated after splitting the tests.
+ let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
+ " The dict from the first test repeated after splitting the tests.
+ let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
+ try
+ let d = []
+ catch
+ $put =v:exception[:14] . v:exception[-1:-1]
+ endtry
+ try
+ let l = {}
+ catch
+ $put =v:exception[:14] . v:exception[-1:-1]
+ endtry]])
+ expect([[
+
+ Vim(let):E706: d
+ Vim(let):E706: l]])
+ end)
+
+ it('removing items with :unlet', function()
+ source([[
+ lang C
+ " The list from the first test repeated after splitting the tests.
+ let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
+ " The dict from the first test repeated after splitting the tests.
+ let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
+ unlet l[2]
+ $put =string(l)
+ let l = range(8)
+ try
+ unlet l[:3]
+ unlet l[1:]
+ catch
+ $put =v:exception
+ endtry
+ $put =string(l)
+
+ unlet d.c
+ unlet d[-1]
+ $put =string(d)]])
+ expect([[
+
+ [1, 'as''d', {'a': 1}]
+ [4]
+ {'1': 99, '3': 33}]])
+ end)
+
+ it("removing items out of range: silently skip items that don't exist", function()
+ -- We can not use source() here as we want to ignore all errors.
+ execute('lang C')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[2:1]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[2:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[2:3]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[2:4]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[2:5]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-1:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-2:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-3:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-4:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-5:2]')
+ execute('$put =string(l)')
+ execute('let l = [0, 1, 2, 3]')
+ execute('unlet l[-6:2]')
+ execute('$put =string(l)')
+ expect([=[
+
+ [0, 1, 2, 3]
+ [0, 1, 3]
+ [0, 1]
+ [0, 1]
+ [0, 1]
+ [0, 1, 2, 3]
+ [0, 1, 3]
+ [0, 3]
+ [3]
+ [3]
+ [3]]=])
+ end)
+
+ it('assignment to a list', function()
+ source([[
+ let l = [0, 1, 2, 3]
+ let [va, vb] = l[2:3]
+ $put =va
+ $put =vb
+ try
+ let [va, vb] = l
+ catch
+ $put =v:exception[:14]
+ endtry
+ try
+ let [va, vb] = l[1:1]
+ catch
+ $put =v:exception[:14]
+ endtry]])
+ expect([[
+
+ 2
+ 3
+ Vim(let):E687:
+ Vim(let):E688: ]])
+ end)
+
+ it('manipulating a big dictionary', function()
+ -- Manipulating a big Dictionary (hashtable.c has a border of 1000
+ -- entries).
+ source([[
+ let d = {}
+ for i in range(1500)
+ let d[i] = 3000 - i
+ endfor
+ $put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' .
+ \ d[1499]
+ try
+ let n = d[1500]
+ catch
+ $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '')
+ endtry
+ " Lookup each items.
+ for i in range(1500)
+ if d[i] != 3000 - i
+ $put =d[i]
+ endif
+ endfor
+ let i += 1
+ " Delete even items.
+ while i >= 2
+ let i -= 2
+ unlet d[i]
+ endwhile
+ $put =get(d, 1500 - 100, 'NONE') . ' ' . d[1]
+ " Delete odd items, checking value, one intentionally wrong.
+ let d[33] = 999
+ let i = 1
+ while i < 1500
+ if d[i] != 3000 - i
+ $put =i . '=' . d[i]
+ else
+ unlet d[i]
+ endif
+ let i += 2
+ endwhile
+ " Must be almost empty now.
+ $put =string(d)]])
+ expect([[
+
+ 3000 2900 2001 1600 1501
+ Vim(let):E716: 1500
+ NONE 2999
+ 33=999
+ {'33': 999}]])
+ end)
+
+ it('dictionary function', function()
+ source([[
+ let dict = {}
+ func dict.func(a) dict
+ $put =a:a . len(self.data)
+ endfunc
+ let dict.data = [1,2,3]
+ call dict.func("len: ")
+ let x = dict.func("again: ")
+ try
+ let Fn = dict.func
+ call Fn('xxx')
+ catch
+ $put =v:exception[:15]
+ endtry]])
+ expect([[
+
+ len: 3
+ again: 3
+ Vim(call):E725: ]])
+ end)
+
+ it('Function in script-local List or Dict', function()
+ source([[
+ let g:dict = {}
+ function g:dict.func() dict
+ $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf')
+ endfunc
+ let g:dict.foo = ['-', 2, 3]
+ call insert(g:dict.foo, function('strlen'))
+ call g:dict.func()]])
+ expect('\ng:dict.func-4')
+ end)
+
+ it("remove func from dict that's being called (works)", function()
+ source([[
+ let d = {1:1}
+ func d.func(a)
+ return "a:". a:a
+ endfunc
+ $put =d.func(string(remove(d, 'func')))]])
+ -- The function number changed from 3 to 1 because we split the test.
+ -- There were two other functions in the old test before this.
+ expect("\na:function('1')")
+ end)
+
+ it('deepcopy() dict that refers to itself', function()
+ -- Nasty: deepcopy() dict that refers to itself (fails when noref used).
+ source([[
+ let d = {1:1, 2:2}
+ let l = [4, d, 6]
+ let d[3] = l
+ let dc = deepcopy(d)
+ try
+ let dc = deepcopy(d, 1)
+ catch
+ $put =v:exception[:14]
+ endtry
+ let l2 = [0, l, l, 3]
+ let l[1] = l2
+ let l3 = deepcopy(l2)
+ $put ='same list: ' . (l3[1] is l3[2])]])
+ expect([[
+
+ Vim(let):E698:
+ same list: 1]])
+ end)
+
+ it('locked variables (part 1)', function()
+ source([=[
+ let l = []
+ for depth in range(5)
+ $put ='depth is ' . depth
+ for u in range(3)
+ unlet l
+ let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
+ exe "lockvar " . depth . " l"
+ if u == 1
+ exe "unlockvar l"
+ elseif u == 2
+ exe "unlockvar " . depth . " l"
+ endif
+ let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
+ \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
+ \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
+ $put =ps
+ let ps = ''
+ try
+ let l[1][1][0] = 99
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l[1][1] = [99]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l[1] = [99]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l[2]['6'][7] = 99
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l[2][6] = {99: 99}
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l[2] = {99: 99}
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ let l = [99]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ $put =ps
+ endfor
+ endfor]=])
+ expect([[
+
+ depth is 0
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 1
+ 1000-000
+ ppppppF
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 2
+ 1100-100
+ ppFppFF
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 3
+ 1110-110
+ pFFpFFF
+ 0010-010
+ pFppFpp
+ 0000-000
+ ppppppp
+ depth is 4
+ 1111-111
+ FFFFFFF
+ 0011-011
+ FFpFFpp
+ 0000-000
+ ppppppp]])
+ end)
+
+ -- TODO In the original test the 5th line of this source() call was used.
+ -- But now the test only passes if I comment it.
+ it('unletting locked variables', function()
+ source([=[
+ let l = []
+ for depth in range(5)
+ $put ='depth is ' . depth
+ for u in range(3)
+ "unlet l
+ let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
+ exe "lockvar " . depth . " l"
+ if u == 1
+ exe "unlockvar l"
+ elseif u == 2
+ exe "unlockvar " . depth . " l"
+ endif
+ let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
+ \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
+ \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
+ $put =ps
+ let ps = ''
+ try
+ unlet l[2]['6'][7]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l[2][6]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l[2]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l[1][1][0]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l[1][1]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l[1]
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ try
+ unlet l
+ let ps .= 'p'
+ catch
+ let ps .= 'F'
+ endtry
+ $put =ps
+ endfor
+ endfor]=])
+ expect([[
+
+ depth is 0
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 1
+ 1000-000
+ ppFppFp
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 2
+ 1100-100
+ pFFpFFp
+ 0000-000
+ ppppppp
+ 0000-000
+ ppppppp
+ depth is 3
+ 1110-110
+ FFFFFFp
+ 0010-010
+ FppFppp
+ 0000-000
+ ppppppp
+ depth is 4
+ 1111-111
+ FFFFFFp
+ 0011-011
+ FppFppp
+ 0000-000
+ ppppppp]])
+ end)
+
+ it('locked variables and :unlet or list / dict functions', function()
+ source([[
+ $put ='Locks and commands or functions:'
+
+ $put ='No :unlet after lock on dict:'
+ unlet! d
+ let d = {'a': 99, 'b': 100}
+ lockvar 1 d
+ try
+ unlet d.a
+ $put ='did :unlet'
+ catch
+ $put =v:exception[:16]
+ endtry
+ $put =string(d)
+
+ $put =':unlet after lock on dict item:'
+ unlet! d
+ let d = {'a': 99, 'b': 100}
+ lockvar d.a
+ try
+ unlet d.a
+ $put ='did :unlet'
+ catch
+ $put =v:exception[:16]
+ endtry
+ $put =string(d)
+
+ $put ='filter() after lock on dict item:'
+ unlet! d
+ let d = {'a': 99, 'b': 100}
+ lockvar d.a
+ try
+ call filter(d, 'v:key != "a"')
+ $put ='did filter()'
+ catch
+ $put =v:exception[:16]
+ endtry
+ $put =string(d)
+
+ $put ='map() after lock on dict:'
+ unlet! d
+ let d = {'a': 99, 'b': 100}
+ lockvar 1 d
+ try
+ call map(d, 'v:val + 200')
+ $put ='did map()'
+ catch
+ $put =v:exception[:16]
+ endtry
+ $put =string(d)
+
+ $put ='No extend() after lock on dict item:'
+ unlet! d
+ let d = {'a': 99, 'b': 100}
+ lockvar d.a
+ try
+ $put =string(extend(d, {'a': 123}))
+ $put ='did extend()'
+ catch
+ $put =v:exception[:14]
+ endtry
+ $put =string(d)
+
+ $put ='No remove() of write-protected scope-level variable:'
+ fun! Tfunc(this_is_a_loooooooooong_parameter_name)
+ try
+ $put =string(remove(a:, 'this_is_a_loooooooooong_parameter_name'))
+ $put ='did remove()'
+ catch
+ $put =v:exception[:14]
+ endtry
+ endfun
+ call Tfunc('testval')
+
+ $put ='No extend() of write-protected scope-level variable:'
+ fun! Tfunc(this_is_a_loooooooooong_parameter_name)
+ try
+ $put =string(extend(a:, {'this_is_a_loooooooooong_parameter_name': 1234}))
+ $put ='did extend()'
+ catch
+ $put =v:exception[:14]
+ endtry
+ endfun
+ call Tfunc('testval')
+
+ $put ='No :unlet of variable in locked scope:'
+ let b:testvar = 123
+ lockvar 1 b:
+ try
+ unlet b:testvar
+ $put ='b:testvar was :unlet: '. (!exists('b:testvar'))
+ catch
+ $put =v:exception[:16]
+ endtry
+ unlockvar 1 b:
+ unlet! b:testvar
+
+ $put ='No :let += of locked list variable:'
+ let l = ['a', 'b', 3]
+ lockvar 1 l
+ try
+ let l += ['x']
+ $put ='did :let +='
+ catch
+ $put =v:exception[:14]
+ endtry
+ $put =string(l)]])
+
+ expect([=[
+
+ Locks and commands or functions:
+ No :unlet after lock on dict:
+ Vim(unlet):E741:
+ {'a': 99, 'b': 100}
+ :unlet after lock on dict item:
+ did :unlet
+ {'b': 100}
+ filter() after lock on dict item:
+ did filter()
+ {'b': 100}
+ map() after lock on dict:
+ did map()
+ {'a': 299, 'b': 300}
+ No extend() after lock on dict item:
+ Vim(put):E741:
+ {'a': 99, 'b': 100}
+ No remove() of write-protected scope-level variable:
+ Vim(put):E795:
+ No extend() of write-protected scope-level variable:
+ Vim(put):E742:
+ No :unlet of variable in locked scope:
+ Vim(unlet):E741:
+ No :let += of locked list variable:
+ Vim(let):E741:
+ ['a', 'b', 3]]=])
+ end)
+
+ it('locked variables (part 2)', function()
+ execute(
+ 'let l = [1, 2, 3, 4]',
+ 'lockvar! l',
+ '$put =string(l)',
+ 'unlockvar l[1]',
+ 'unlet l[0:1]',
+ '$put =string(l)',
+ 'unlet l[1:2]',
+ '$put =string(l)',
+ 'unlockvar l[1]',
+ 'let l[0:1] = [0, 1]',
+ '$put =string(l)',
+ 'let l[1:2] = [0, 1]',
+ '$put =string(l)')
+ expect([=[
+
+ [1, 2, 3, 4]
+ [1, 2, 3, 4]
+ [1, 2, 3, 4]
+ [1, 2, 3, 4]
+ [1, 2, 3, 4]]=])
+ end)
+
+ it(':lockvar/islocked() triggering script autoloading.', function()
+ source([[
+ set rtp+=test/functional/fixtures
+ lockvar g:footest#x
+ unlockvar g:footest#x
+ $put ='locked g:footest#x:'.islocked('g:footest#x')
+ $put ='exists g:footest#x:'.exists('g:footest#x')
+ $put ='g:footest#x: '.g:footest#x]])
+ expect([[
+
+ locked g:footest#x:-1
+ exists g:footest#x:0
+ g:footest#x: 1]])
+ end)
+
+ it('a:000 function argument', function()
+ source([[
+ function Test(...)
+ " First the tests that should fail.
+ try
+ let a:000 = [1, 2]
+ catch
+ $put ='caught a:000'
+ endtry
+ try
+ let a:000[0] = 9
+ catch
+ $put ='caught a:000[0]'
+ endtry
+ try
+ let a:000[2] = [9, 10]
+ catch
+ $put ='caught a:000[2]'
+ endtry
+ try
+ let a:000[3] = {9: 10}
+ catch
+ $put ='caught a:000[3]'
+ endtry
+ " Now the tests that should pass.
+ try
+ let a:000[2][1] = 9
+ call extend(a:000[2], [5, 6])
+ let a:000[3][5] = 8
+ let a:000[3]['a'] = 12
+ $put =string(a:000)
+ catch
+ $put ='caught ' . v:exception
+ endtry
+ endfunction]])
+ execute('call Test(1, 2, [3, 4], {5: 6})')
+ expect([=[
+
+ caught a:000
+ caught a:000[0]
+ caught a:000[2]
+ caught a:000[3]
+ [1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}]]=])
+ end)
+
+ it('reverse(), sort(), uniq()', function()
+ source([=[
+ let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo',
+ \ [0, 1, 2], 'x8', [0, 1, 2], 1.5]
+ $put =string(uniq(copy(l)))
+ $put =string(reverse(l))
+ $put =string(reverse(reverse(l)))
+ $put =string(sort(l))
+ $put =string(reverse(sort(l)))
+ $put =string(sort(reverse(sort(l))))
+ $put =string(uniq(sort(l)))
+ let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff,
+ \ 0.22, 'four']
+ $put =string(sort(copy(l), 'n'))
+ let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar',
+ \ 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []]
+ $put =string(sort(copy(l), 1))
+ $put =string(sort(copy(l), 'i'))
+ $put =string(sort(copy(l)))]=])
+ expect([=[
+
+ ['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5]
+ [1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
+ [1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0']
+ ['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]]
+ [[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0']
+ ['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]]
+ ['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]]
+ [-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255]
+ ['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
+ ['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]
+ ['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]]=])
+ end)
+
+ it('splitting a string to a list', function()
+ source([[
+ $put =string(split(' aa bb '))
+ $put =string(split(' aa bb ', '\W\+', 0))
+ $put =string(split(' aa bb ', '\W\+', 1))
+ $put =string(split(' aa bb ', '\W', 1))
+ $put =string(split(':aa::bb:', ':', 0))
+ $put =string(split(':aa::bb:', ':', 1))
+ $put =string(split('aa,,bb, cc,', ',\s*', 1))
+ $put =string(split('abc', '\zs'))
+ $put =string(split('abc', '\zs', 1))]])
+ expect([=[
+
+ ['aa', 'bb']
+ ['aa', 'bb']
+ ['', 'aa', 'bb', '']
+ ['', '', 'aa', '', 'bb', '', '']
+ ['aa', '', 'bb']
+ ['', 'aa', '', 'bb', '']
+ ['aa', '', 'bb', 'cc', '']
+ ['a', 'b', 'c']
+ ['', 'a', '', 'b', '', 'c', '']]=])
+ end)
+
+ it('compare recursively linked list and dict', function()
+ source([[
+ let l = [1, 2, 3, 4]
+ let d = {'1': 1, '2': l, '3': 3}
+ let l[1] = d
+ $put =(l == l)
+ $put =(d == d)
+ $put =(l != deepcopy(l))
+ $put =(d != deepcopy(d))]])
+ expect([[
+
+ 1
+ 1
+ 0
+ 0]])
+ end)
+
+ it('compare complex recursively linked list and dict', function()
+ source([[
+ let l = []
+ call add(l, l)
+ let dict4 = {"l": l}
+ call add(dict4.l, dict4)
+ let lcopy = deepcopy(l)
+ let dict4copy = deepcopy(dict4)
+ $put =(l == lcopy)
+ $put =(dict4 == dict4copy)]])
+ expect([[
+
+ 1
+ 1]])
+ end)
+
+ it('pass the same list to extend()', function()
+ source([[
+ let l = [1, 2, 3, 4, 5]
+ call extend(l, l)
+ $put =string(l)]])
+ expect([=[
+
+ [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]]=])
+ end)
+
+ it('pass the same dict to extend()', function()
+ source([[
+ let d = { 'a': {'b': 'B'}}
+ call extend(d, d)
+ $put =string(d)]])
+ expect([[
+
+ {'a': {'b': 'B'}}]])
+ end)
+
+ it('pass the same dict to extend() with "error"', function()
+ source([[
+ " Copy dict from previous test.
+ let d = { 'a': {'b': 'B'}}
+ try
+ call extend(d, d, "error")
+ catch
+ $put =v:exception[:15] . v:exception[-1:-1]
+ endtry
+ $put =string(d)]])
+ expect([[
+
+ Vim(call):E737: a
+ {'a': {'b': 'B'}}]])
+ end)
+
+ it('test for range assign', function()
+ source([[
+ let l = [0]
+ let l[:] = [1, 2]
+ $put =string(l)]])
+ expect([=[
+
+ [1, 2]]=])
+ end)
+
+ it('vim patch 7.3.637', function()
+ execute('let a = "No error caught"')
+ execute('try')
+ execute(' foldopen')
+ execute('catch')
+ execute(" let a = matchstr(v:exception,'^[^ ]*')")
+ execute('endtry')
+ feed('o<C-R>=a<CR><esc>')
+ execute('lang C')
+ execute('redir => a')
+ -- The test failes if this is not in one line.
+ execute("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
+ execute('redir END')
+ feed('o<C-R>=a<CR><esc>')
+ expect([[
+
+ Vim(foldopen):E490:
+
+
+ Error detected while processing :
+ E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/056_script_local_function_spec.lua b/test/functional/legacy/056_script_local_function_spec.lua
index dec88e8001..084817ad7a 100644
--- a/test/functional/legacy/056_script_local_function_spec.lua
+++ b/test/functional/legacy/056_script_local_function_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Test for script-local function.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local expect = helpers.expect
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua
index 36062ded3a..6984ad0de2 100644
--- a/test/functional/legacy/057_sort_spec.lua
+++ b/test/functional/legacy/057_sort_spec.lua
@@ -1,6 +1,6 @@
-- Tests for :sort command.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, execute, clear, expect, eq, eval, source = helpers.insert,
helpers.execute, helpers.clear, helpers.expect, helpers.eq, helpers.eval,
helpers.source
diff --git a/test/functional/legacy/059_utf8_spell_checking_spec.lua b/test/functional/legacy/059_utf8_spell_checking_spec.lua
index 63df387be3..c44ab44b3c 100644
--- a/test/functional/legacy/059_utf8_spell_checking_spec.lua
+++ b/test/functional/legacy/059_utf8_spell_checking_spec.lua
@@ -1,6 +1,6 @@
-- Tests for spell checking with 'encoding' set to "utf-8".
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
local write_file, call = helpers.write_file, helpers.call
diff --git a/test/functional/legacy/060_exists_and_has_functions_spec.lua b/test/functional/legacy/060_exists_and_has_functions_spec.lua
index 7f44b35a4e..cbd857c524 100644
--- a/test/functional/legacy/060_exists_and_has_functions_spec.lua
+++ b/test/functional/legacy/060_exists_and_has_functions_spec.lua
@@ -1,6 +1,6 @@
-- Tests for the exists() and has() functions.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
local clear, expect = helpers.clear, helpers.expect
local write_file = helpers.write_file
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index 350a77b2c5..9bf69ccba1 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -1,9 +1,15 @@
-- Tests for undo tree and :earlier and :later.
+local helpers = require('test.functional.helpers')(after_each)
-local helpers = require('test.functional.helpers')
-local expect, feed, source = helpers.expect, helpers.feed, helpers.source
-local eval, clear, execute = helpers.eval, helpers.clear, helpers.execute
-local write_file, command, eq = helpers.write_file, helpers.command, helpers.eq
+local write_file = helpers.write_file
+local execute = helpers.execute
+local command = helpers.command
+local source = helpers.source
+local expect = helpers.expect
+local clear = helpers.clear
+local feed = helpers.feed
+local eval = helpers.eval
+local eq = helpers.eq
local function expect_empty_buffer()
-- The space will be removed by helpers.dedent but is needed because dedent
diff --git a/test/functional/legacy/062_tab_pages_spec.lua b/test/functional/legacy/062_tab_pages_spec.lua
index f1c8b8d58b..d5b10b160e 100644
--- a/test/functional/legacy/062_tab_pages_spec.lua
+++ b/test/functional/legacy/062_tab_pages_spec.lua
@@ -1,6 +1,6 @@
-- Tests for tab pages
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source, clear, execute, expect, eval, eq =
helpers.feed, helpers.insert, helpers.source, helpers.clear,
helpers.execute, helpers.expect, helpers.eval, helpers.eq
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index 23b4f4551b..298e0a31ea 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -1,6 +1,6 @@
-- Tests for adjusting window and contents
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local feed, insert = helpers.feed, helpers.insert
local eval, clear, execute = helpers.eval, helpers.clear, helpers.execute
diff --git a/test/functional/legacy/065_float_and_logic_operators_spec.lua b/test/functional/legacy/065_float_and_logic_operators_spec.lua
index e78b230956..d12ea502f3 100644
--- a/test/functional/legacy/065_float_and_logic_operators_spec.lua
+++ b/test/functional/legacy/065_float_and_logic_operators_spec.lua
@@ -1,6 +1,6 @@
-- Test for floating point and logical operators.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/066_visual_block_tab_spec.lua b/test/functional/legacy/066_visual_block_tab_spec.lua
index 82bb988c67..72fa7d881b 100644
--- a/test/functional/legacy/066_visual_block_tab_spec.lua
+++ b/test/functional/legacy/066_visual_block_tab_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Test for visual block shift and tab characters.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/067_augroup_exists_spec.lua b/test/functional/legacy/067_augroup_exists_spec.lua
index dc4c9c7eeb..8f6b881ed8 100644
--- a/test/functional/legacy/067_augroup_exists_spec.lua
+++ b/test/functional/legacy/067_augroup_exists_spec.lua
@@ -1,7 +1,7 @@
-- Test that groups and patterns are tested correctly when calling exists() for
-- autocommands.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/068_text_formatting_spec.lua b/test/functional/legacy/068_text_formatting_spec.lua
index cac8be77f3..e232e5073d 100644
--- a/test/functional/legacy/068_text_formatting_spec.lua
+++ b/test/functional/legacy/068_text_formatting_spec.lua
@@ -1,6 +1,10 @@
-local helpers = require('test.functional.helpers')
-local feed, insert = helpers.feed, helpers.insert
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local helpers = require('test.functional.helpers')(after_each)
+
+local feed = helpers.feed
+local clear = helpers.clear
+local insert = helpers.insert
+local execute = helpers.execute
+local expect = helpers.expect
describe('text formatting', function()
setup(clear)
diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua
index efcc2f2cc3..4682a82008 100644
--- a/test/functional/legacy/072_undo_file_spec.lua
+++ b/test/functional/legacy/072_undo_file_spec.lua
@@ -2,7 +2,7 @@
-- Since this script is sourced we need to explicitly break changes up in
-- undo-able pieces. Do that by setting 'undolevels'.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index 49c4827613..2fc30c9d83 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,6 +1,7 @@
-- Tests for storing global variables in the .shada file
-local helpers, lfs = require('test.functional.helpers'), require('lfs')
+local helpers = require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
local clear, execute, eq, neq, eval, wait, spawn =
helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.eval,
helpers.wait, helpers.spawn
diff --git a/test/functional/legacy/075_maparg_spec.lua b/test/functional/legacy/075_maparg_spec.lua
index 82965f5cb2..e9d2acdaf5 100644
--- a/test/functional/legacy/075_maparg_spec.lua
+++ b/test/functional/legacy/075_maparg_spec.lua
@@ -1,7 +1,7 @@
-- Tests for maparg().
-- Also test utf8 map with a 0x80 byte.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/076_completefunc_spec.lua b/test/functional/legacy/076_completefunc_spec.lua
index 8af3be003e..bf3f56eb84 100644
--- a/test/functional/legacy/076_completefunc_spec.lua
+++ b/test/functional/legacy/076_completefunc_spec.lua
@@ -1,6 +1,6 @@
-- Tests for completefunc/omnifunc.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, expect, execute = helpers.clear, helpers.expect, helpers.execute
diff --git a/test/functional/legacy/077_mf_hash_grow_spec.lua b/test/functional/legacy/077_mf_hash_grow_spec.lua
index 029fe98fe9..b43263300d 100644
--- a/test/functional/legacy/077_mf_hash_grow_spec.lua
+++ b/test/functional/legacy/077_mf_hash_grow_spec.lua
@@ -6,7 +6,7 @@
-- cksum is part of POSIX and so should be available on most Unixes.
-- If it isn't available then the test will be skipped.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/078_swapfile_recover_spec.lua b/test/functional/legacy/078_swapfile_recover_spec.lua
index e48fddaac1..4390ba2ca8 100644
--- a/test/functional/legacy/078_swapfile_recover_spec.lua
+++ b/test/functional/legacy/078_swapfile_recover_spec.lua
@@ -3,7 +3,7 @@
-- restored. We need about 10000 lines of 100 characters to get two levels of
-- pointer blocks.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, expect, source = helpers.clear, helpers.expect, helpers.source
describe('78', function()
diff --git a/test/functional/legacy/080_substitute_spec.lua b/test/functional/legacy/080_substitute_spec.lua
index 96082364e0..1bdae9be59 100644
--- a/test/functional/legacy/080_substitute_spec.lua
+++ b/test/functional/legacy/080_substitute_spec.lua
@@ -2,7 +2,7 @@
-- Test for submatch() on substitue().
-- Test for *:s%* on :substitute.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
local eq, eval = helpers.eq, helpers.eval
diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua
index f27667b976..2ac1332687 100644
--- a/test/functional/legacy/081_coptions_movement_spec.lua
+++ b/test/functional/legacy/081_coptions_movement_spec.lua
@@ -1,6 +1,6 @@
-- Test for t movement command and 'cpo-;' setting
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/082_string_comparison_spec.lua b/test/functional/legacy/082_string_comparison_spec.lua
index 933c6c8fa3..d6f3c45e1f 100644
--- a/test/functional/legacy/082_string_comparison_spec.lua
+++ b/test/functional/legacy/082_string_comparison_spec.lua
@@ -1,7 +1,7 @@
-- Tests for case-insensitive UTF-8 comparisons (utf_strnicmp() in mbyte.c)
-- Also test "g~ap".
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, source = helpers.feed, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index 6b5ee60568..e94b46ca66 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -1,6 +1,6 @@
-- Tests for tag search with !_TAG_FILE_ENCODING.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source, clear, expect, write_file = helpers.insert,
helpers.source, helpers.clear, helpers.expect, helpers.write_file
diff --git a/test/functional/legacy/084_curswant_spec.lua b/test/functional/legacy/084_curswant_spec.lua
index 946dd5e501..818914eeb9 100644
--- a/test/functional/legacy/084_curswant_spec.lua
+++ b/test/functional/legacy/084_curswant_spec.lua
@@ -1,6 +1,6 @@
-- Tests for curswant not changing when setting an option.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/088_conceal_tabs_spec.lua b/test/functional/legacy/088_conceal_tabs_spec.lua
index c78f4e5c3e..00e7312bf8 100644
--- a/test/functional/legacy/088_conceal_tabs_spec.lua
+++ b/test/functional/legacy/088_conceal_tabs_spec.lua
@@ -1,7 +1,7 @@
-- Tests for correct display (cursor column position) with +conceal and
-- tabulators.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, clear, execute =
helpers.feed, helpers.insert, helpers.clear, helpers.execute
diff --git a/test/functional/legacy/089_number_relnumber_findfile_spec.lua b/test/functional/legacy/089_number_relnumber_findfile_spec.lua
index f72ebf3f72..7a87fc8603 100644
--- a/test/functional/legacy/089_number_relnumber_findfile_spec.lua
+++ b/test/functional/legacy/089_number_relnumber_findfile_spec.lua
@@ -2,7 +2,7 @@
-- This is not all that useful now that the options are no longer reset when
-- setting the other.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
local clear, expect, source = helpers.clear, helpers.expect, helpers.source
diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua
index 95e50063a1..e364af9400 100644
--- a/test/functional/legacy/090_sha256_spec.lua
+++ b/test/functional/legacy/090_sha256_spec.lua
@@ -1,6 +1,6 @@
-- Tests for sha256() function.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua
index 2c46ef643c..edf497d397 100644
--- a/test/functional/legacy/091_context_variables_spec.lua
+++ b/test/functional/legacy/091_context_variables_spec.lua
@@ -1,6 +1,6 @@
-- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar().
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
index f76ba25d7a..f8564384e9 100644
--- a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
+++ b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
@@ -3,7 +3,7 @@
--
-- Same as legacy test 93 but using UTF-8 file encoding.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
index bf3af1a827..719ce25099 100644
--- a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
+++ b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
@@ -3,7 +3,7 @@
--
-- Same as legacy test 92 but using Latin-1 file encoding.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/094_visual_mode_operators_spec.lua b/test/functional/legacy/094_visual_mode_operators_spec.lua
index 4dce39b8d2..a52fa00672 100644
--- a/test/functional/legacy/094_visual_mode_operators_spec.lua
+++ b/test/functional/legacy/094_visual_mode_operators_spec.lua
@@ -4,7 +4,7 @@
-- followed by an operator and those executed via Operator-pending mode. Also
-- part of the test are mappings, counts, and repetition with the . command.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua
index a80a247612..845ebaaad7 100644
--- a/test/functional/legacy/095_regexp_multibyte_spec.lua
+++ b/test/functional/legacy/095_regexp_multibyte_spec.lua
@@ -3,7 +3,7 @@
-- A pattern that gives the expected result produces OK, so that we know it was
-- actually tried.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua
index 6e2f22ea33..eac8d6356d 100644
--- a/test/functional/legacy/096_location_list_spec.lua
+++ b/test/functional/legacy/096_location_list_spec.lua
@@ -6,7 +6,7 @@
-- C. make sure that the location list window is not reused instead of the window
-- it belongs to.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
index 5c467fbb20..a6c146891a 100644
--- a/test/functional/legacy/097_glob_path_spec.lua
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -2,7 +2,7 @@
-- Test whether glob()/globpath() return correct results with certain escaped
-- characters.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/098_scrollbind_spec.lua b/test/functional/legacy/098_scrollbind_spec.lua
index 6850e373ab..d22aefdcbc 100644
--- a/test/functional/legacy/098_scrollbind_spec.lua
+++ b/test/functional/legacy/098_scrollbind_spec.lua
@@ -1,6 +1,6 @@
-- Test for 'scrollbind' causing an unexpected scroll of one of the windows.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua
index 335d275c2a..0d88e99278 100644
--- a/test/functional/legacy/101_hlsearch_spec.lua
+++ b/test/functional/legacy/101_hlsearch_spec.lua
@@ -1,6 +1,6 @@
-- Test for v:hlsearch
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua
index a3b0313d7a..c1a6c57956 100644
--- a/test/functional/legacy/102_fnameescape_spec.lua
+++ b/test/functional/legacy/102_fnameescape_spec.lua
@@ -1,6 +1,6 @@
-- Test if fnameescape is correct for special chars like!
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/103_visual_mode_reset_spec.lua b/test/functional/legacy/103_visual_mode_reset_spec.lua
index c1407ef10a..d05b47fa32 100644
--- a/test/functional/legacy/103_visual_mode_reset_spec.lua
+++ b/test/functional/legacy/103_visual_mode_reset_spec.lua
@@ -1,6 +1,6 @@
-- Test for visual mode not being reset causing E315 error.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, source = helpers.feed, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/104_let_assignment_spec.lua b/test/functional/legacy/104_let_assignment_spec.lua
index a2431da835..27c3715231 100644
--- a/test/functional/legacy/104_let_assignment_spec.lua
+++ b/test/functional/legacy/104_let_assignment_spec.lua
@@ -1,6 +1,6 @@
-- Tests for :let.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua
index 5958f1aa7b..2b17d63378 100644
--- a/test/functional/legacy/106_errorformat_spec.lua
+++ b/test/functional/legacy/106_errorformat_spec.lua
@@ -1,6 +1,6 @@
-- Tests for errorformat.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/107_adjust_window_and_contents_spec.lua b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
index 7a6de3d748..ce8d967e00 100644
--- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua
+++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
@@ -1,6 +1,6 @@
-- Tests for adjusting window and contents
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local insert = helpers.insert
local clear, execute = helpers.clear, helpers.execute
diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
index 6df645d255..a03092e446 100644
--- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua
+++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
@@ -1,6 +1,6 @@
-- Tests for backtrace debug commands.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, clear = helpers.feed, helpers.clear
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index b13b621b2c..c128aaf115 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -1,6 +1,6 @@
-- Test argument list commands
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 63699387c1..cfa368c361 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim, call = helpers.meths, helpers.call
local clear, eq = helpers.clear, helpers.eq
local source, execute = helpers.source, helpers.execute
@@ -141,6 +141,18 @@ describe('assert function:', function()
tmpname_two .. " line 1: 'file two'",
})
end)
+
+ it('is reset to a list by assert functions', function()
+ source([[
+ let save_verrors = v:errors
+ let v:['errors'] = {'foo': 3}
+ call assert_equal('yes', 'no')
+ let verrors = v:errors
+ let v:errors = save_verrors
+ call assert_equal(type([]), type(verrors))
+ ]])
+ expected_empty()
+ end)
end)
-- assert_fails({cmd}, [, {error}])
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 6349371808..28037e17c5 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim = helpers.meths
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
local curbuf, buf = helpers.curbuf, helpers.bufmeths
diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua
index a99cabca24..4110d66f5b 100644
--- a/test/functional/legacy/autoformat_join_spec.lua
+++ b/test/functional/legacy/autoformat_join_spec.lua
@@ -1,7 +1,7 @@
-- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for setting the '[,'] marks when joining lines.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/backspace_opt_spec.lua b/test/functional/legacy/backspace_opt_spec.lua
index b40019a410..90bc6f74f0 100644
--- a/test/functional/legacy/backspace_opt_spec.lua
+++ b/test/functional/legacy/backspace_opt_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local call, clear = helpers.call, helpers.clear
local source, eq, nvim = helpers.source, helpers.eq, helpers.meths
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index a12d4add10..2504fe8e51 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -1,6 +1,6 @@
-- Test for breakindent
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/cdo_spec.lua b/test/functional/legacy/cdo_spec.lua
index 4b313ede3f..5e46431cc1 100644
--- a/test/functional/legacy/cdo_spec.lua
+++ b/test/functional/legacy/cdo_spec.lua
@@ -1,6 +1,6 @@
-- Tests for the :cdo, :cfdo, :ldo and :lfdo commands
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim, clear = helpers.meths, helpers.clear
local call, feed = helpers.call, helpers.feed
local source, eq = helpers.source, helpers.eq
diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua
index 7c696369d4..c718da3736 100644
--- a/test/functional/legacy/changelist_spec.lua
+++ b/test/functional/legacy/changelist_spec.lua
@@ -1,7 +1,7 @@
-- Test changelist position after splitting window
-- Set 'undolevels' to make changelist for sourced file
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/charsearch_spec.lua b/test/functional/legacy/charsearch_spec.lua
index 4a83801cfc..ef3369728d 100644
--- a/test/functional/legacy/charsearch_spec.lua
+++ b/test/functional/legacy/charsearch_spec.lua
@@ -1,6 +1,6 @@
-- Test for character searches
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert = helpers.feed, helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/close_count_spec.lua b/test/functional/legacy/close_count_spec.lua
index ee6b29c618..ad1812f22e 100644
--- a/test/functional/legacy/close_count_spec.lua
+++ b/test/functional/legacy/close_count_spec.lua
@@ -1,6 +1,6 @@
-- Tests for :[count]close! and :[count]hide
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, eval, eq, clear, execute =
helpers.feed, helpers.eval, helpers.eq, helpers.clear, helpers.execute
diff --git a/test/functional/legacy/command_count_spec.lua b/test/functional/legacy/command_count_spec.lua
index d9b4f09263..618dc1dc99 100644
--- a/test/functional/legacy/command_count_spec.lua
+++ b/test/functional/legacy/command_count_spec.lua
@@ -1,6 +1,6 @@
-- Test for user command counts
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, source, expect = helpers.clear, helpers.source, helpers.expect
local execute, spawn = helpers.execute, helpers.spawn
local nvim_prog = helpers.nvim_prog
diff --git a/test/functional/legacy/comparators_spec.lua b/test/functional/legacy/comparators_spec.lua
index e3fa3eea23..27879b0f65 100644
--- a/test/functional/legacy/comparators_spec.lua
+++ b/test/functional/legacy/comparators_spec.lua
@@ -1,6 +1,6 @@
-- " Test for expression comparators.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
local eval, execute = helpers.eval, helpers.execute
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index cd18a8f750..42238b3a9e 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
local eq, eval, execute = helpers.eq, helpers.eval, helpers.execute
diff --git a/test/functional/legacy/erasebackword_spec.lua b/test/functional/legacy/erasebackword_spec.lua
index cb3967b763..33b7704b65 100644
--- a/test/functional/legacy/erasebackword_spec.lua
+++ b/test/functional/legacy/erasebackword_spec.lua
@@ -1,6 +1,6 @@
-- Test for CTRL-W in Insert mode
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, expect = helpers.clear, helpers.feed, helpers.expect
describe('CTRL-W in Insert mode', function()
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 3ff1092a4b..3684fe714d 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -1,15 +1,10 @@
-- Test for various eval features.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file
-local function has_clipboard()
- clear()
- return 1 == eval("has('clipboard')")
-end
-
describe('eval', function()
setup(function()
write_file('test_eval_setup.vim', [[
@@ -539,8 +534,13 @@ describe('eval', function()
=: type v; value: abc/]].."\000 (['abc/\000"..[[']), expr: "abc/]]..'\000'..[[" (['"abc/]]..'\000'..[["'])]])
end)
- if has_clipboard() then
- it('system clipboard', function()
+ describe('system clipboard', function()
+ before_each(function()
+ execute('let &runtimepath = "test/functional/fixtures,".&runtimepath')
+ execute('call getreg("*")') -- force load of provider
+ end)
+
+ it('works', function()
insert([[
Some first line (this text was at the top of the old test_eval.in).
@@ -570,9 +570,7 @@ describe('eval', function()
*: type V; value: clipboard contents]]..'\00'..[[ (['clipboard contents']), expr: clipboard contents]]..'\00'..[[ (['clipboard contents'])
*: type V; value: something else]]..'\00'..[[ (['something else']), expr: something else]]..'\00'..[[ (['something else'])]])
end)
- else
- pending('system clipboard not available', function() end)
- end
+ end)
it('errors', function()
source([[
diff --git a/test/functional/legacy/expand_spec.lua b/test/functional/legacy/expand_spec.lua
new file mode 100644
index 0000000000..5a2d46706a
--- /dev/null
+++ b/test/functional/legacy/expand_spec.lua
@@ -0,0 +1,72 @@
+-- Test for expanding file names
+
+local helpers = require('test.functional.helpers')(after_each)
+local eq = helpers.eq
+local call = helpers.call
+local nvim = helpers.meths
+local clear = helpers.clear
+local source = helpers.source
+
+local function expected_empty()
+ eq({}, nvim.get_vvar('errors'))
+end
+
+describe('expand file name', function()
+ after_each(function()
+ helpers.rmdir('Xdir1')
+ helpers.rmdir('Xdir2')
+ helpers.rmdir('Xdir3')
+ helpers.rmdir('Xdir4')
+ end)
+
+ before_each(function()
+ clear()
+
+ source([[
+ func Test_with_directories()
+ call mkdir('Xdir1')
+ call mkdir('Xdir2')
+ call mkdir('Xdir3')
+ cd Xdir3
+ call mkdir('Xdir4')
+ cd ..
+
+ split Xdir1/file
+ call setline(1, ['a', 'b'])
+ w
+ w Xdir3/Xdir4/file
+ close
+
+ next Xdir?/*/file
+ call assert_equal('Xdir3/Xdir4/file', expand('%'))
+ next! Xdir?/*/nofile
+ call assert_equal('Xdir?/*/nofile', expand('%'))
+
+ call delete('Xdir1', 'rf')
+ call delete('Xdir2', 'rf')
+ call delete('Xdir3', 'rf')
+ endfunc
+
+ func Test_with_tilde()
+ let dir = getcwd()
+ call mkdir('Xdir ~ dir')
+ call assert_true(isdirectory('Xdir ~ dir'))
+ cd Xdir\ ~\ dir
+ call assert_true(getcwd() =~ 'Xdir \~ dir')
+ exe 'cd ' . fnameescape(dir)
+ call delete('Xdir ~ dir', 'd')
+ call assert_false(isdirectory('Xdir ~ dir'))
+ endfunc
+ ]])
+ end)
+
+ it('works with directories', function()
+ call('Test_with_directories')
+ expected_empty()
+ end)
+
+ it('works with tilde', function()
+ call('Test_with_tilde')
+ expected_empty()
+ end)
+end)
diff --git a/test/functional/legacy/file_perm_spec.lua b/test/functional/legacy/file_perm_spec.lua
index cabeecdc9c..98bdf630dd 100644
--- a/test/functional/legacy/file_perm_spec.lua
+++ b/test/functional/legacy/file_perm_spec.lua
@@ -1,7 +1,7 @@
-- Test getting and setting file permissions.
require('os')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, call, eq = helpers.clear, helpers.call, helpers.eq
local neq, exc_exec = helpers.neq, helpers.exc_exec
diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua
index 2d1824c8cd..bba1415535 100644
--- a/test/functional/legacy/fixeol_spec.lua
+++ b/test/functional/legacy/fixeol_spec.lua
@@ -1,6 +1,6 @@
-- Tests for 'fixeol'
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/fnamemodify_spec.lua b/test/functional/legacy/fnamemodify_spec.lua
index 2a32aea127..f614b07b36 100644
--- a/test/functional/legacy/fnamemodify_spec.lua
+++ b/test/functional/legacy/fnamemodify_spec.lua
@@ -1,6 +1,6 @@
-- Test filename modifiers.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua
index 9083911021..1b65f1ce95 100644
--- a/test/functional/legacy/function_sort_spec.lua
+++ b/test/functional/legacy/function_sort_spec.lua
@@ -1,7 +1,10 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local eval = helpers.eval
+local execute = helpers.execute
+local exc_exec = helpers.exc_exec
+local neq = helpers.neq
describe('sort', function()
before_each(clear)
@@ -26,4 +29,25 @@ describe('sort', function()
it('numbers compared as float', function()
eq({0.28, 3, 13.5}, eval("sort([13.5, 0.28, 3], 'f')"))
end)
+
+ it('ability to call sort() from a compare function', function()
+ execute('func Compare1(a, b) abort')
+ execute([[call sort(range(3), 'Compare2')]])
+ execute('return a:a - a:b')
+ execute('endfunc')
+
+ execute('func Compare2(a, b) abort')
+ execute('return a:a - a:b')
+ execute('endfunc')
+ eq({1, 3, 5}, eval("sort([3, 1, 5], 'Compare1')"))
+ end)
+
+ it('default sort', function()
+ -- docs say omitted, empty or zero argument sorts on string representation
+ eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"])'))
+ eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval([[sort([3.3, 1, "2", "A", "a", "AA"], '')]]))
+ eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 0)'))
+ eq({'2', 'A', 'a', 'AA', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 1)'))
+ neq(exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'), nil)
+ end)
end)
diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua
index 0492143616..82e7e3010f 100644
--- a/test/functional/legacy/glob2regpat_spec.lua
+++ b/test/functional/legacy/glob2regpat_spec.lua
@@ -1,6 +1,6 @@
-- Tests for signs
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute = helpers.clear, helpers.execute
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
index 4aa24c0d53..0483edc934 100644
--- a/test/functional/legacy/increment_spec.lua
+++ b/test/functional/legacy/increment_spec.lua
@@ -1,6 +1,6 @@
-- Tests for using Ctrl-A/Ctrl-X on visual selections
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source, execute = helpers.source, helpers.execute
local call, clear = helpers.call, helpers.clear
local eq, nvim = helpers.eq, helpers.meths
diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua
index 01236e1afe..3142f040b3 100644
--- a/test/functional/legacy/insertcount_spec.lua
+++ b/test/functional/legacy/insertcount_spec.lua
@@ -1,6 +1,6 @@
-- Tests for repeating insert and replace.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
diff --git a/test/functional/legacy/join_spec.lua b/test/functional/legacy/join_spec.lua
index 17ff2e71ad..3c4da8119c 100644
--- a/test/functional/legacy/join_spec.lua
+++ b/test/functional/legacy/join_spec.lua
@@ -1,6 +1,6 @@
-- Test for joining lines
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
local eval, execute = helpers.eval, helpers.execute
diff --git a/test/functional/legacy/lispwords_spec.lua b/test/functional/legacy/lispwords_spec.lua
index 48df4de55e..2ec51dca1b 100644
--- a/test/functional/legacy/lispwords_spec.lua
+++ b/test/functional/legacy/lispwords_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local eval = helpers.eval
diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua
index 89ed90178b..d2838cddb6 100644
--- a/test/functional/legacy/listchars_spec.lua
+++ b/test/functional/legacy/listchars_spec.lua
@@ -1,6 +1,6 @@
-- Tests for 'listchars' display with 'list' and :list.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua
index 6601a922ef..eb979edc69 100644
--- a/test/functional/legacy/listlbr_spec.lua
+++ b/test/functional/legacy/listlbr_spec.lua
@@ -1,6 +1,6 @@
-- Test for linebreak and list option (non-utf8)
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua
index df0e817533..f06bca72ba 100644
--- a/test/functional/legacy/listlbr_utf8_spec.lua
+++ b/test/functional/legacy/listlbr_utf8_spec.lua
@@ -1,6 +1,6 @@
-- Test for linebreak and list option in utf-8 mode
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
local feed = helpers.feed
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index a0d19926cb..1712219d04 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -1,6 +1,6 @@
-- Test for mappings and abbreviations
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect, wait = helpers.execute, helpers.expect, helpers.wait
diff --git a/test/functional/legacy/marks_spec.lua b/test/functional/legacy/marks_spec.lua
index 8e9ceb1653..6ecba70f08 100644
--- a/test/functional/legacy/marks_spec.lua
+++ b/test/functional/legacy/marks_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/match_conceal_spec.lua b/test/functional/legacy/match_conceal_spec.lua
index 0ffa3cae7a..d95b07d695 100644
--- a/test/functional/legacy/match_conceal_spec.lua
+++ b/test/functional/legacy/match_conceal_spec.lua
@@ -1,6 +1,6 @@
-- Test for matchadd() and conceal feature
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local expect = helpers.expect
local source = helpers.source
diff --git a/test/functional/legacy/nested_function_spec.lua b/test/functional/legacy/nested_function_spec.lua
index fac3b03191..be9b66ee38 100644
--- a/test/functional/legacy/nested_function_spec.lua
+++ b/test/functional/legacy/nested_function_spec.lua
@@ -1,6 +1,6 @@
-- Tests for nested function.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, insert = helpers.clear, helpers.insert
local execute, expect, source = helpers.execute, helpers.expect, helpers.source
diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua
index 21e99c4aa1..4f4d4ceaf9 100644
--- a/test/functional/legacy/options_spec.lua
+++ b/test/functional/legacy/options_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local command, clear = helpers.command, helpers.clear
local source, expect = helpers.source, helpers.expect
diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua
index 01c781cc05..9f97eb27b2 100644
--- a/test/functional/legacy/qf_title_spec.lua
+++ b/test/functional/legacy/qf_title_spec.lua
@@ -1,6 +1,6 @@
-- Tests for quickfix window's title
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
local clear, expect = helpers.clear, helpers.expect
diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua
index 315b8ca682..ca98765336 100644
--- a/test/functional/legacy/quickfix_spec.lua
+++ b/test/functional/legacy/quickfix_spec.lua
@@ -1,8 +1,10 @@
-- Test for the quickfix commands.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source, clear = helpers.source, helpers.clear
local eq, nvim, call = helpers.eq, helpers.meths, helpers.call
+local eval = helpers.eval
+local execute = helpers.execute
local function expected_empty()
eq({}, nvim.get_vvar('errors'))
@@ -306,4 +308,11 @@ describe('helpgrep', function()
call('XbufferTests', 'l')
expected_empty()
end)
+
+ it('autocommands triggered by quickfix can get title', function()
+ execute('au FileType qf let g:foo = get(w:, "quickfix_title", "NONE")')
+ execute('call setqflist([])')
+ execute('copen')
+ eq(':setqflist()', eval('g:foo'))
+ end)
end)
diff --git a/test/functional/legacy/search_mbyte_spec.lua b/test/functional/legacy/search_mbyte_spec.lua
index 075b24b897..a5a5822a45 100644
--- a/test/functional/legacy/search_mbyte_spec.lua
+++ b/test/functional/legacy/search_mbyte_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert = helpers.insert
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
diff --git a/test/functional/legacy/searchpos_spec.lua b/test/functional/legacy/searchpos_spec.lua
index 1c9b1ccee6..7d4b7a3734 100644
--- a/test/functional/legacy/searchpos_spec.lua
+++ b/test/functional/legacy/searchpos_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local call = helpers.call
local clear = helpers.clear
local execute = helpers.execute
diff --git a/test/functional/legacy/set_spec.lua b/test/functional/legacy/set_spec.lua
index f2c907084e..11f371569d 100644
--- a/test/functional/legacy/set_spec.lua
+++ b/test/functional/legacy/set_spec.lua
@@ -1,6 +1,6 @@
-- Tests for :set
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, eval, eq =
helpers.clear, helpers.execute, helpers.eval, helpers.eq
diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua
index 5a834c39e3..e80a32455a 100644
--- a/test/functional/legacy/signs_spec.lua
+++ b/test/functional/legacy/signs_spec.lua
@@ -1,6 +1,6 @@
-- Tests for signs
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
describe('signs', function()
diff --git a/test/functional/legacy/tagcase_spec.lua b/test/functional/legacy/tagcase_spec.lua
index 9a8c6fbe42..ed2876a375 100644
--- a/test/functional/legacy/tagcase_spec.lua
+++ b/test/functional/legacy/tagcase_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local eval = helpers.eval
diff --git a/test/functional/legacy/textobjects_spec.lua b/test/functional/legacy/textobjects_spec.lua
index 1e8e0b0bcb..15a93e3819 100644
--- a/test/functional/legacy/textobjects_spec.lua
+++ b/test/functional/legacy/textobjects_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local call = helpers.call
local clear = helpers.clear
local execute = helpers.execute
diff --git a/test/functional/legacy/undolevels_spec.lua b/test/functional/legacy/undolevels_spec.lua
index 41274b3a04..9902b101f6 100644
--- a/test/functional/legacy/undolevels_spec.lua
+++ b/test/functional/legacy/undolevels_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local source, clear = helpers.source, helpers.clear
local eq, nvim = helpers.eq, helpers.meths
diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua
index d33ba6b5fd..4d4f55b9eb 100644
--- a/test/functional/legacy/utf8_spec.lua
+++ b/test/functional/legacy/utf8_spec.lua
@@ -1,6 +1,6 @@
-- Tests for Unicode manipulations
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
local eq, eval = helpers.eq, helpers.eval
diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua
index ba7be8f21b..300a777772 100644
--- a/test/functional/legacy/wordcount_spec.lua
+++ b/test/functional/legacy/wordcount_spec.lua
@@ -1,6 +1,6 @@
-- Test for wordcount() function
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute = helpers.clear, helpers.execute
local eq, eval = helpers.eq, helpers.eval
diff --git a/test/functional/legacy/writefile_spec.lua b/test/functional/legacy/writefile_spec.lua
index efdfc1d09f..f096aa23b9 100644
--- a/test/functional/legacy/writefile_spec.lua
+++ b/test/functional/legacy/writefile_spec.lua
@@ -1,6 +1,6 @@
-- Tests for writefile()
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
describe('writefile', function()
diff --git a/test/functional/normal/K_spec.lua b/test/functional/normal/K_spec.lua
index df6b429f50..af0f82ef9a 100644
--- a/test/functional/normal/K_spec.lua
+++ b/test/functional/normal/K_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq, clear, eval, feed =
helpers.eq, helpers.clear, helpers.eval, helpers.feed
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index d4c3267997..ed978cd17e 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
local execute = helpers.execute
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 4455ef663f..d531e47e28 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, execute = helpers.clear, helpers.execute
diff --git a/test/functional/plugin/helpers.lua b/test/functional/plugin/helpers.lua
index 5b6ea88c34..7580670149 100644
--- a/test/functional/plugin/helpers.lua
+++ b/test/functional/plugin/helpers.lua
@@ -1,6 +1,6 @@
local paths = require('test.config.paths')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(nil)
local spawn, set_session, nvim_prog, merge_args =
helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.merge_args
diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua
index d8c1f2d392..810b273fd8 100644
--- a/test/functional/plugin/matchparen_spec.lua
+++ b/test/functional/plugin/matchparen_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 60ba88e55b..c8da8e8f6c 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local meths = helpers.meths
local eq, nvim_eval, nvim_command, exc_exec =
helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index aad0e366bf..e18e9ef428 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq, nvim_eval, nvim_command, nvim, exc_exec, funcs, nvim_feed, curbuf =
helpers.eq, helpers.eval, helpers.command, helpers.nvim, helpers.exc_exec,
helpers.funcs, helpers.feed, helpers.curbuf
diff --git a/test/functional/preload.lua b/test/functional/preload.lua
index 1971ef77cc..1107b45d54 100644
--- a/test/functional/preload.lua
+++ b/test/functional/preload.lua
@@ -1,4 +1,4 @@
-- Modules loaded here will not be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation. See issue #62
-- for more information about this.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(nil)
diff --git a/test/functional/provider/define_spec.lua b/test/functional/provider/define_spec.lua
index c30ad6d8c2..b0363eb435 100644
--- a/test/functional/provider/define_spec.lua
+++ b/test/functional/provider/define_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eval, command, nvim = helpers.eval, helpers.command, helpers.nvim
local eq, run, stop = helpers.eq, helpers.run, helpers.stop
local clear = helpers.clear
diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua
index a94880d4a2..a4e9a49c8a 100644
--- a/test/functional/provider/python3_spec.lua
+++ b/test/functional/provider/python3_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eval, command, feed = helpers.eval, helpers.command, helpers.feed
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
local expect, write_file = helpers.expect, helpers.write_file
diff --git a/test/functional/provider/python_spec.lua b/test/functional/provider/python_spec.lua
index 06fdbef669..94dfa90ea8 100644
--- a/test/functional/provider/python_spec.lua
+++ b/test/functional/provider/python_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local neq = helpers.neq
diff --git a/test/functional/shada/buffers_spec.lua b/test/functional/shada/buffers_spec.lua
index fd4809e01a..e4d02c268b 100644
--- a/test/functional/shada/buffers_spec.lua
+++ b/test/functional/shada/buffers_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa buffer list saving/reading support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, funcs, eq, curbufmeths =
helpers.command, helpers.funcs, helpers.eq, helpers.curbufmeths
diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua
index 1fa88c58e5..1287ac010c 100644
--- a/test/functional/shada/compatibility_spec.lua
+++ b/test/functional/shada/compatibility_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa compatibility support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq
local exc_exec = helpers.exc_exec
diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua
index e7951ee74c..98ead6cc3d 100644
--- a/test/functional/shada/errors_spec.lua
+++ b/test/functional/shada/errors_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa errors handling support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, eq, exc_exec, redir_exec =
helpers.command, helpers.eq, helpers.exc_exec, helpers.redir_exec
diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua
index d4eb7f57bd..bb2919d4fb 100644
--- a/test/functional/shada/helpers.lua
+++ b/test/functional/shada/helpers.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(nil)
local spawn, set_session, meths, nvim_prog =
helpers.spawn, helpers.set_session, helpers.meths, helpers.nvim_prog
local write_file, merge_args = helpers.write_file, helpers.merge_args
diff --git a/test/functional/shada/history_spec.lua b/test/functional/shada/history_spec.lua
index 94513945d0..22e653b1d6 100644
--- a/test/functional/shada/history_spec.lua
+++ b/test/functional/shada/history_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa history saving/reading support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, funcs, meths, nvim_feed, eq =
helpers.command, helpers.funcs, helpers.meths, helpers.feed, helpers.eq
diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua
index 955a6f382b..ace3c74a62 100644
--- a/test/functional/shada/marks_spec.lua
+++ b/test/functional/shada/marks_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa marks saving/reading support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local meths, curwinmeths, curbufmeths, nvim_command, funcs, eq =
helpers.meths, helpers.curwinmeths, helpers.curbufmeths, helpers.command,
helpers.funcs, helpers.eq
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua
index 221f989409..25c73b99eb 100644
--- a/test/functional/shada/merging_spec.lua
+++ b/test/functional/shada/merging_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa merging data support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, funcs, curbufmeths, eq =
helpers.command, helpers.funcs,
helpers.curbufmeths, helpers.eq
diff --git a/test/functional/shada/registers_spec.lua b/test/functional/shada/registers_spec.lua
index 4043d94a69..f1c587c640 100644
--- a/test/functional/shada/registers_spec.lua
+++ b/test/functional/shada/registers_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa registers saving/reading support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local nvim_command, funcs, eq = helpers.command, helpers.funcs, helpers.eq
local shada_helpers = require('test.functional.shada.helpers')
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua
index 683d520627..32e7b16fc5 100644
--- a/test/functional/shada/shada_spec.lua
+++ b/test/functional/shada/shada_spec.lua
@@ -1,5 +1,5 @@
-- Other ShaDa tests
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local meths, nvim_command, funcs, eq =
helpers.meths, helpers.command, helpers.funcs, helpers.eq
local write_file, spawn, set_session, nvim_prog, exc_exec =
diff --git a/test/functional/shada/variables_spec.lua b/test/functional/shada/variables_spec.lua
index 7ceeafdc71..40101baf8f 100644
--- a/test/functional/shada/variables_spec.lua
+++ b/test/functional/shada/variables_spec.lua
@@ -1,5 +1,5 @@
-- ShaDa variables saving/reading support
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local meths, funcs, nvim_command, eq, exc_exec =
helpers.meths, helpers.funcs, helpers.command, helpers.eq, helpers.exc_exec
diff --git a/test/functional/shell/bang_filter_spec.lua b/test/functional/shell/bang_filter_spec.lua
index 964dbd1029..cd5325c4e1 100644
--- a/test/functional/shell/bang_filter_spec.lua
+++ b/test/functional/shell/bang_filter_spec.lua
@@ -1,6 +1,6 @@
-- Specs for bang/filter commands
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local feed, execute, clear = helpers.feed, helpers.execute, helpers.clear
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua
index 00b16e9158..3de022cbd9 100644
--- a/test/functional/shell/viml_system_spec.lua
+++ b/test/functional/shell/viml_system_spec.lua
@@ -2,7 +2,7 @@
-- - `system()`
-- - `systemlist()`
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local eq, clear, eval, feed, nvim =
helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.nvim
@@ -151,8 +151,8 @@ describe('system()', function()
describe('with output containing NULs', function()
local fname = 'Xtest'
- setup(create_file_with_nuls(fname))
- teardown(delete_file(fname))
+ before_each(create_file_with_nuls(fname))
+ after_each(delete_file(fname))
it('replaces NULs by SOH characters', function()
eq('part1\001part2\001part3\n', eval('system("cat '..fname..'")'))
@@ -310,8 +310,8 @@ describe('systemlist()', function()
describe('with output containing NULs', function()
local fname = 'Xtest'
- setup(create_file_with_nuls(fname))
- teardown(delete_file(fname))
+ before_each(create_file_with_nuls(fname))
+ after_each(delete_file(fname))
it('replaces NULs by newline characters', function()
eq({'part1\npart2\npart3'}, eval('systemlist("cat '..fname..'")'))
diff --git a/test/functional/terminal/altscreen_spec.lua b/test/functional/terminal/altscreen_spec.lua
index d9d96b25f9..e1760c8ad8 100644
--- a/test/functional/terminal/altscreen_spec.lua
+++ b/test/functional/terminal/altscreen_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local clear, eq, curbuf = helpers.clear, helpers.eq, helpers.curbuf
local feed = helpers.feed
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index cefb603a7e..8a535d6864 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
local wait = helpers.wait
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
index c15da2f760..461ddd0ec7 100644
--- a/test/functional/terminal/cursor_spec.lua
+++ b/test/functional/terminal/cursor_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local thelpers = require('test.functional.terminal.helpers')
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index dcc4a54610..c98aef70b1 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local screen = require('test.functional.ui.screen')
local curbufmeths = helpers.curbufmeths
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index d89092ff27..458fa02fca 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, wait, nvim = helpers.clear, helpers.wait, helpers.nvim
local nvim_dir, source, eq = helpers.nvim_dir, helpers.source, helpers.eq
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua
index a32ae650d6..3d1530bd90 100644
--- a/test/functional/terminal/helpers.lua
+++ b/test/functional/terminal/helpers.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(nil)
local Screen = require('test.functional.ui.screen')
local nvim_dir = helpers.nvim_dir
local execute, nvim, wait = helpers.execute, helpers.nvim, helpers.wait
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index 97875c5147..8876c68673 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local thelpers = require('test.functional.terminal.helpers')
local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index c4bd3c2663..0ac7165d6a 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local clear = helpers.clear
local feed, nvim = helpers.feed, helpers.nvim
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 4b56698520..7914e30a44 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -1,5 +1,5 @@
local Screen = require('test.functional.ui.screen')
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local clear, eq, curbuf = helpers.clear, helpers.eq, helpers.curbuf
local feed, nvim_dir, execute = helpers.feed, helpers.nvim_dir, helpers.execute
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 364ca327a4..91789d6575 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -1,6 +1,6 @@
-- Some sanity checks for the TUI using the builtin terminal emulator
-- as a simple way to send keys and assert screen state.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local feed = thelpers.feed_data
local execute = helpers.execute
diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua
index 6c236ed868..7bc739c548 100644
--- a/test/functional/terminal/window_spec.lua
+++ b/test/functional/terminal/window_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local feed, clear = helpers.feed, helpers.clear
local wait = helpers.wait
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
index 727eba2717..3696332940 100644
--- a/test/functional/terminal/window_split_tab_spec.lua
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
local clear = helpers.clear
local feed, nvim = helpers.feed, helpers.nvim
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 58f5b11de0..f91aa8d402 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, request, neq = helpers.execute, helpers.request, helpers.neq
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 85fca4d7ca..b156f13885 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index 6f5cadaf81..407c576002 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq
local expect = helpers.expect
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index 993bbd5b0e..a433143266 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths
local insert, execute = helpers.insert, helpers.execute
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 99b85caf10..d7af2a4fce 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -105,7 +105,7 @@
-- To generate a text-only test without highlight checks,
-- use `screen:snapshot_util({},true)`
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(nil)
local request, run = helpers.request, helpers.run
local dedent = helpers.dedent
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index a4545eeff0..9249be4aec 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
local feed, execute = helpers.feed, helpers.execute
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index e4217abcfe..894a75d355 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute = helpers.execute
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index c32a7b9381..2b6e294627 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index 66ea779011..c2ab0711c0 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
local insert = helpers.insert
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index c57d4abcbf..2a55d27567 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
local funcs = helpers.funcs
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 2b3844bf6d..33f481bae2 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed = helpers.clear, helpers.feed
local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq
diff --git a/test/functional/viml/errorlist_spec.lua b/test/functional/viml/errorlist_spec.lua
index 30cb86f8d1..56d08771b7 100644
--- a/test/functional/viml/errorlist_spec.lua
+++ b/test/functional/viml/errorlist_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
diff --git a/test/functional/viml/function_spec.lua b/test/functional/viml/function_spec.lua
index 665f5d4467..776e760aaf 100644
--- a/test/functional/viml/function_spec.lua
+++ b/test/functional/viml/function_spec.lua
@@ -1,4 +1,4 @@
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
diff --git a/test/helpers.lua b/test/helpers.lua
new file mode 100644
index 0000000000..4c50c7644f
--- /dev/null
+++ b/test/helpers.lua
@@ -0,0 +1,60 @@
+local assert = require('luassert')
+local lfs = require('lfs')
+
+local check_logs_useless_lines = {
+ ['Warning: noted but unhandled ioctl']=1,
+ ['could cause spurious value errors to appear']=2,
+ ['See README_MISSING_SYSCALL_OR_IOCTL for guidance']=3,
+}
+
+local eq = function(exp, act)
+ return assert.are.same(exp, act)
+end
+local neq = function(exp, act)
+ return assert.are_not.same(exp, act)
+end
+local ok = function(res)
+ return assert.is_true(res)
+end
+
+local function check_logs()
+ local log_dir = os.getenv('LOG_DIR')
+ local runtime_errors = 0
+ if log_dir and lfs.attributes(log_dir, 'mode') == 'directory' then
+ for tail in lfs.dir(log_dir) do
+ if tail:sub(1, 30) == 'valgrind-' or tail:find('san%.') then
+ local file = log_dir .. '/' .. tail
+ local fd = io.open(file)
+ local start_msg = ('='):rep(20) .. ' File ' .. file .. ' ' .. ('='):rep(20)
+ local lines = {}
+ local warning_line = 0
+ for line in fd:lines() do
+ local cur_warning_line = check_logs_useless_lines[line]
+ if cur_warning_line == warning_line + 1 then
+ warning_line = cur_warning_line
+ else
+ lines[#lines + 1] = line
+ end
+ end
+ fd:close()
+ os.remove(file)
+ if #lines > 0 then
+ -- local out = os.getenv('TRAVIS_CI_BUILD') and io.stdout or io.stderr
+ local out = io.stdout
+ out:write(start_msg .. '\n')
+ out:write('= ' .. table.concat(lines, '\n= ') .. '\n')
+ out:write(select(1, start_msg:gsub('.', '=')) .. '\n')
+ runtime_errors = runtime_errors + 1
+ end
+ end
+ end
+ end
+ assert(0 == runtime_errors)
+end
+
+return {
+ eq = eq,
+ neq = neq,
+ ok = ok,
+ check_logs = check_logs,
+}
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 426ae2d9e0..f0c193884e 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -1,9 +1,12 @@
-local assert = require('luassert')
local ffi = require('ffi')
local formatc = require('test.unit.formatc')
local Set = require('test.unit.set')
local Preprocess = require('test.unit.preprocess')
local Paths = require('test.config.paths')
+local global_helpers = require('test.helpers')
+
+local neq = global_helpers.neq
+local eq = global_helpers.eq
-- add some standard header locations
for _, p in ipairs(Paths.include_paths) do
@@ -153,12 +156,8 @@ return {
cimport = cimport,
cppimport = cppimport,
internalize = internalize,
- eq = function(expected, actual)
- return assert.are.same(expected, actual)
- end,
- neq = function(expected, actual)
- return assert.are_not.same(expected, actual)
- end,
+ eq = eq,
+ neq = neq,
ffi = ffi,
lib = libnvim,
cstr = cstr,
diff --git a/test/unit/os/shell_spec.lua b/test/unit/os/shell_spec.lua
index 93103e4e8c..906f950308 100644
--- a/test/unit/os/shell_spec.lua
+++ b/test/unit/os/shell_spec.lua
@@ -30,10 +30,6 @@ describe('shell functions', function()
cimported.p_shcf = to_cstr('-c')
end)
- teardown(function()
- cimported.event_teardown()
- end)
-
local function shell_build_argv(cmd, extra_args)
local res = cimported.shell_build_argv(
cmd and to_cstr(cmd),