aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml34
-rw-r--r--CMakeLists.txt16
-rw-r--r--CONTRIBUTING.md42
-rw-r--r--Makefile10
-rw-r--r--README.md2
-rw-r--r--appveyor.yml6
-rw-r--r--busted/outputHandlers/nvim.lua305
-rwxr-xr-xci/after_success.sh (renamed from .ci/after_success.sh)0
-rwxr-xr-xci/before_cache.sh (renamed from .ci/before_cache.sh)5
-rwxr-xr-xci/before_install.sh (renamed from .ci/before_install.sh)2
-rwxr-xr-xci/before_script.sh (renamed from .ci/before_script.sh)2
-rw-r--r--ci/build.bat (renamed from .ci/build.bat)2
-rw-r--r--ci/common/build.sh (renamed from .ci/common/build.sh)16
-rw-r--r--ci/common/suite.sh147
-rw-r--r--ci/common/test.sh (renamed from .ci/common/test.sh)68
-rwxr-xr-xci/install.sh (renamed from .ci/install.sh)2
-rwxr-xr-xci/run_lint.sh29
-rwxr-xr-xci/run_tests.sh (renamed from .ci/run_tests.sh)15
-rwxr-xr-xci/script.sh (renamed from .ci/script.sh)9
-rw-r--r--cmake/Download.cmake18
-rw-r--r--cmake/InstallClintErrors.cmake2
-rw-r--r--cmake/RunLint.cmake32
-rw-r--r--man/nvim.121
-rw-r--r--runtime/autoload/health.vim4
-rw-r--r--runtime/autoload/health/nvim.vim20
-rw-r--r--runtime/autoload/health/provider.vim8
-rw-r--r--runtime/autoload/provider/clipboard.vim2
-rw-r--r--runtime/autoload/provider/python.vim2
-rw-r--r--runtime/autoload/provider/python3.vim2
-rw-r--r--runtime/autoload/provider/pythonx.vim5
-rw-r--r--runtime/doc/api.txt25
-rw-r--r--runtime/doc/deprecated.txt1
-rw-r--r--runtime/doc/develop.txt61
-rw-r--r--runtime/doc/eval.txt217
-rw-r--r--runtime/doc/gui.txt37
-rw-r--r--runtime/doc/index.txt3
-rw-r--r--runtime/doc/map.txt51
-rw-r--r--runtime/doc/msgpack_rpc.txt69
-rw-r--r--runtime/doc/options.txt151
-rw-r--r--runtime/doc/quickref.txt3
-rw-r--r--runtime/doc/sign.txt6
-rw-r--r--runtime/doc/starting.txt26
-rw-r--r--runtime/doc/syntax.txt31
-rw-r--r--runtime/doc/tagsrch.txt38
-rw-r--r--runtime/doc/vi_diff.txt12
-rw-r--r--runtime/doc/vim_diff.txt5
-rw-r--r--runtime/doc/windows.txt6
-rw-r--r--runtime/filetype.vim16
-rw-r--r--runtime/ftplugin/rmd.vim16
-rw-r--r--runtime/ftplugin/scala.vim37
-rw-r--r--runtime/indent/fortran.vim10
-rw-r--r--runtime/indent/javascript.vim96
-rw-r--r--runtime/indent/rnoweb.vim14
-rw-r--r--runtime/indent/scala.vim609
-rw-r--r--runtime/indent/teraterm.vim10
-rw-r--r--runtime/indent/yaml.vim35
-rw-r--r--runtime/keymap/pinyin.vim2
-rw-r--r--runtime/keymap/russian-jcukenmac.vim94
-rw-r--r--runtime/optwin.vim8
-rw-r--r--runtime/plugin/matchit.vim24
-rw-r--r--runtime/syntax/fortran.vim34
-rw-r--r--runtime/syntax/muttrc.vim358
-rw-r--r--runtime/syntax/python.vim31
-rw-r--r--runtime/syntax/r.vim6
-rw-r--r--runtime/syntax/rhelp.vim3
-rw-r--r--runtime/syntax/rmd.vim4
-rw-r--r--runtime/syntax/rrst.vim4
-rw-r--r--runtime/syntax/rst.vim14
-rw-r--r--runtime/syntax/scala.vim231
-rw-r--r--runtime/syntax/sh.vim48
-rw-r--r--runtime/syntax/teraterm.vim6
-rw-r--r--runtime/syntax/vim.vim4
-rw-r--r--scripts/gendispatch.lua8
-rwxr-xr-xscripts/pvscheck.sh172
-rwxr-xr-xscripts/vim-patch.sh8
-rwxr-xr-xsrc/clint.py3
-rw-r--r--src/coverity-model.c2
-rw-r--r--src/nvim/CMakeLists.txt170
-rw-r--r--src/nvim/api/buffer.c53
-rw-r--r--src/nvim/api/private/defs.h8
-rw-r--r--src/nvim/api/private/dispatch.c3
-rw-r--r--src/nvim/api/private/handle.c3
-rw-r--r--src/nvim/api/private/helpers.c133
-rw-r--r--src/nvim/api/private/helpers.h9
-rw-r--r--src/nvim/api/tabpage.c7
-rw-r--r--src/nvim/api/ui.c64
-rw-r--r--src/nvim/api/vim.c57
-rw-r--r--src/nvim/api/window.c19
-rw-r--r--src/nvim/arabic.c3
-rw-r--r--src/nvim/buffer.c20
-rw-r--r--src/nvim/buffer.h3
-rw-r--r--src/nvim/charset.c75
-rw-r--r--src/nvim/cursor.c3
-rw-r--r--src/nvim/cursor_shape.c181
-rw-r--r--src/nvim/cursor_shape.h79
-rw-r--r--src/nvim/diff.c7
-rw-r--r--src/nvim/diff.h3
-rw-r--r--src/nvim/digraph.c24
-rw-r--r--src/nvim/digraph.h3
-rw-r--r--src/nvim/edit.c40
-rw-r--r--src/nvim/eval.c444
-rw-r--r--src/nvim/eval.lua5
-rw-r--r--src/nvim/eval/decode.c35
-rw-r--r--src/nvim/eval/encode.c71
-rw-r--r--src/nvim/eval/executor.c3
-rw-r--r--src/nvim/eval/gc.c3
-rw-r--r--src/nvim/eval/typval.c49
-rw-r--r--src/nvim/eval/typval.h18
-rw-r--r--src/nvim/eval/typval_encode.c.h6
-rw-r--r--src/nvim/event/libuv_process.c11
-rw-r--r--src/nvim/event/loop.c3
-rw-r--r--src/nvim/event/multiqueue.c3
-rw-r--r--src/nvim/event/process.c3
-rw-r--r--src/nvim/event/rstream.c3
-rw-r--r--src/nvim/event/signal.c3
-rw-r--r--src/nvim/event/socket.c3
-rw-r--r--src/nvim/event/stream.c3
-rw-r--r--src/nvim/event/time.c3
-rw-r--r--src/nvim/event/wstream.c3
-rw-r--r--src/nvim/ex_cmds.c15
-rw-r--r--src/nvim/ex_cmds.h2
-rw-r--r--src/nvim/ex_cmds2.c3
-rw-r--r--src/nvim/ex_docmd.c34
-rw-r--r--src/nvim/ex_eval.c3
-rw-r--r--src/nvim/ex_getln.c24
-rw-r--r--src/nvim/ex_getln.h3
-rw-r--r--src/nvim/farsi.c5
-rw-r--r--src/nvim/file_search.c5
-rw-r--r--src/nvim/file_search.h5
-rw-r--r--src/nvim/fileio.c268
-rw-r--r--src/nvim/fold.c103
-rw-r--r--src/nvim/fold.h5
-rw-r--r--src/nvim/garray.c3
-rw-r--r--src/nvim/getchar.c20
-rw-r--r--src/nvim/getchar.h5
-rw-r--r--src/nvim/globals.h4
-rw-r--r--src/nvim/hardcopy.c14
-rw-r--r--src/nvim/hardcopy.h4
-rw-r--r--src/nvim/hashtab.c3
-rw-r--r--src/nvim/iconv.h4
-rw-r--r--src/nvim/if_cscope.c3
-rw-r--r--src/nvim/if_cscope.h3
-rw-r--r--src/nvim/indent.c6
-rw-r--r--src/nvim/indent_c.c4
-rw-r--r--src/nvim/keymap.c43
-rw-r--r--src/nvim/log.c3
-rw-r--r--src/nvim/macros.h27
-rw-r--r--src/nvim/main.c5
-rw-r--r--src/nvim/map.c4
-rw-r--r--src/nvim/map.h1
-rw-r--r--src/nvim/mark.c3
-rw-r--r--src/nvim/mark.h41
-rw-r--r--src/nvim/mbyte.c85
-rw-r--r--src/nvim/mbyte.h1
-rw-r--r--src/nvim/memfile.c3
-rw-r--r--src/nvim/memfile_defs.h2
-rw-r--r--src/nvim/memline.c46
-rw-r--r--src/nvim/memline.h2
-rw-r--r--src/nvim/memory.c10
-rw-r--r--src/nvim/menu.c3
-rw-r--r--src/nvim/menu.h5
-rw-r--r--src/nvim/message.c39
-rw-r--r--src/nvim/misc1.c9
-rw-r--r--src/nvim/mouse.c4
-rw-r--r--src/nvim/move.c3
-rw-r--r--src/nvim/move.h2
-rw-r--r--src/nvim/msgpack_rpc/channel.c25
-rw-r--r--src/nvim/msgpack_rpc/helpers.c42
-rw-r--r--src/nvim/msgpack_rpc/server.c3
-rw-r--r--src/nvim/normal.c33
-rw-r--r--src/nvim/ops.c33
-rw-r--r--src/nvim/ops.h2
-rw-r--r--src/nvim/option.c46
-rw-r--r--src/nvim/option_defs.h5
-rw-r--r--src/nvim/options.lua21
-rw-r--r--src/nvim/os/dl.c3
-rw-r--r--src/nvim/os/env.c86
-rw-r--r--src/nvim/os/fileio.c57
-rw-r--r--src/nvim/os/fs.c5
-rw-r--r--src/nvim/os/input.c6
-rw-r--r--src/nvim/os/mem.c3
-rw-r--r--src/nvim/os/pty_process_unix.c3
-rw-r--r--src/nvim/os/shell.c7
-rw-r--r--src/nvim/os/signal.c3
-rw-r--r--src/nvim/os/stdpaths.c3
-rw-r--r--src/nvim/os/time.c3
-rw-r--r--src/nvim/os/users.c3
-rw-r--r--src/nvim/os_unix.c3
-rw-r--r--src/nvim/path.c23
-rw-r--r--src/nvim/po/fi.po7517
-rw-r--r--src/nvim/po/uk.po6
-rw-r--r--src/nvim/popupmnu.c3
-rw-r--r--src/nvim/profile.c3
-rw-r--r--src/nvim/quickfix.c9
-rw-r--r--src/nvim/rbuffer.c3
-rw-r--r--src/nvim/regexp.c61
-rw-r--r--src/nvim/regexp_nfa.c49
-rw-r--r--src/nvim/screen.c153
-rw-r--r--src/nvim/screen.h4
-rw-r--r--src/nvim/search.c28
-rw-r--r--src/nvim/search.h6
-rw-r--r--src/nvim/sha256.c3
-rw-r--r--src/nvim/shada.c235
-rw-r--r--src/nvim/spell.c48
-rw-r--r--src/nvim/spell_defs.h4
-rw-r--r--src/nvim/spellfile.c159
-rw-r--r--src/nvim/state.c3
-rw-r--r--src/nvim/strings.c90
-rw-r--r--src/nvim/syntax.c224
-rw-r--r--src/nvim/syntax.h10
-rw-r--r--src/nvim/tag.c31
-rw-r--r--src/nvim/terminal.c10
-rw-r--r--src/nvim/testdir/samples/memfile_test.c3
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_fold.vim118
-rw-r--r--src/nvim/testdir/test_functions.vim144
-rw-r--r--src/nvim/testdir/test_mapping.vim90
-rw-r--r--src/nvim/testdir/test_normal.vim46
-rw-r--r--src/nvim/testdir/test_taglist.vim58
-rw-r--r--src/nvim/testdir/test_timers.vim153
-rw-r--r--src/nvim/tui/input.c11
-rw-r--r--src/nvim/tui/tui.c251
-rw-r--r--src/nvim/tui/tui.h2
-rw-r--r--src/nvim/ugrid.c3
-rw-r--r--src/nvim/ui.c44
-rw-r--r--src/nvim/ui.h4
-rw-r--r--src/nvim/ui_bridge.c28
-rw-r--r--src/nvim/undo.c18
-rw-r--r--src/nvim/version.c41
-rw-r--r--src/nvim/version.h2
-rw-r--r--src/nvim/vim.h19
-rw-r--r--src/nvim/window.c3
-rw-r--r--src/nvim/window.h2
-rw-r--r--test/README.md13
-rw-r--r--test/benchmark/bench_re_freeze_spec.lua21
-rw-r--r--test/config/paths.lua.in3
-rw-r--r--test/functional/api/buffer_spec.lua8
-rw-r--r--test/functional/api/server_notifications_spec.lua8
-rw-r--r--test/functional/api/server_requests_spec.lua4
-rw-r--r--test/functional/api/tabpage_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua13
-rw-r--r--test/functional/api/window_spec.lua2
-rw-r--r--test/functional/autocmd/autocmd_spec.lua26
-rw-r--r--test/functional/autocmd/bufenter_spec.lua3
-rw-r--r--test/functional/autocmd/termclose_spec.lua14
-rw-r--r--test/functional/autocmd/textyankpost_spec.lua30
-rw-r--r--test/functional/clipboard/clipboard_provider_spec.lua86
-rw-r--r--test/functional/core/job_spec.lua12
-rw-r--r--test/functional/eval/api_functions_spec.lua22
-rw-r--r--test/functional/eval/glob_spec.lua4
-rw-r--r--test/functional/eval/hostname_spec.lua17
-rw-r--r--test/functional/eval/json_functions_spec.lua103
-rw-r--r--test/functional/eval/modeline_spec.lua4
-rw-r--r--test/functional/eval/msgpack_functions_spec.lua149
-rw-r--r--test/functional/eval/reltime_spec.lua4
-rw-r--r--test/functional/eval/setpos_spec.lua9
-rw-r--r--test/functional/eval/special_vars_spec.lua6
-rw-r--r--test/functional/eval/system_spec.lua126
-rw-r--r--test/functional/eval/timer_spec.lua26
-rw-r--r--test/functional/eval/writefile_spec.lua9
-rw-r--r--test/functional/ex_cmds/arg_spec.lua8
-rw-r--r--test/functional/ex_cmds/bang_filter_spec.lua4
-rw-r--r--test/functional/ex_cmds/cd_spec.lua54
-rw-r--r--test/functional/ex_cmds/ctrl_c_spec.lua8
-rw-r--r--test/functional/ex_cmds/drop_spec.lua22
-rw-r--r--test/functional/ex_cmds/edit_spec.lua9
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua6
-rw-r--r--test/functional/ex_cmds/file_spec.lua35
-rw-r--r--test/functional/ex_cmds/grep_spec.lua10
-rw-r--r--test/functional/ex_cmds/menu_spec.lua18
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua22
-rw-r--r--test/functional/ex_cmds/print_commands_spec.lua12
-rw-r--r--test/functional/ex_cmds/recover_spec.lua47
-rw-r--r--test/functional/ex_cmds/syntax_spec.lua17
-rw-r--r--test/functional/ex_cmds/undojoin_spec.lua8
-rw-r--r--test/functional/ex_cmds/write_spec.lua58
-rw-r--r--test/functional/ex_cmds/wundo_spec.lua15
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua12
-rw-r--r--test/functional/fixtures/printargs-test.c3
-rw-r--r--test/functional/fixtures/shell-test.c3
-rw-r--r--test/functional/fixtures/tty-test.c3
-rw-r--r--test/functional/helpers.lua86
-rw-r--r--test/functional/insert/ctrl_r_spec.lua19
-rw-r--r--test/functional/legacy/002_filename_recognition_spec.lua12
-rw-r--r--test/functional/legacy/003_cindent_spec.lua1134
-rw-r--r--test/functional/legacy/004_bufenter_with_modelines_spec.lua21
-rw-r--r--test/functional/legacy/005_bufleave_delete_buffer_spec.lua27
-rw-r--r--test/functional/legacy/006_argument_list_spec.lua38
-rw-r--r--test/functional/legacy/007_ball_buffer_list_spec.lua32
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua30
-rw-r--r--test/functional/legacy/009_bufleave_autocommand_spec.lua22
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua60
-rw-r--r--test/functional/legacy/012_directory_spec.lua40
-rw-r--r--test/functional/legacy/015_alignment_spec.lua30
-rw-r--r--test/functional/legacy/018_unset_smart_indenting_spec.lua14
-rw-r--r--test/functional/legacy/019_smarttab_expandtab_spec.lua18
-rw-r--r--test/functional/legacy/020_blockwise_visual_spec.lua13
-rw-r--r--test/functional/legacy/021_control_wi_spec.lua11
-rw-r--r--test/functional/legacy/022_line_ending_spec.lua6
-rw-r--r--test/functional/legacy/023_edit_arguments_spec.lua34
-rw-r--r--test/functional/legacy/025_jump_tag_hidden_spec.lua24
-rw-r--r--test/functional/legacy/026_execute_while_if_spec.lua6
-rw-r--r--test/functional/legacy/028_source_ctrl_v_spec.lua6
-rw-r--r--test/functional/legacy/029_join_spec.lua68
-rw-r--r--test/functional/legacy/030_fileformats_spec.lua343
-rw-r--r--test/functional/legacy/031_close_commands_spec.lua66
-rw-r--r--test/functional/legacy/033_lisp_indent_spec.lua27
-rw-r--r--test/functional/legacy/034_user_function_spec.lua22
-rw-r--r--test/functional/legacy/035_increment_and_decrement_spec.lua12
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua6
-rw-r--r--test/functional/legacy/038_virtual_replace_spec.lua12
-rw-r--r--test/functional/legacy/039_visual_block_mode_commands_spec.lua24
-rw-r--r--test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua25
-rw-r--r--test/functional/legacy/043_magic_settings_spec.lua21
-rw-r--r--test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua34
-rw-r--r--test/functional/legacy/045_folding_spec.lua84
-rw-r--r--test/functional/legacy/051_highlight_spec.lua72
-rw-r--r--test/functional/legacy/054_buffer_local_autocommands_spec.lua32
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua146
-rw-r--r--test/functional/legacy/057_sort_spec.lua146
-rw-r--r--test/functional/legacy/059_utf8_spell_checking_spec.lua242
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua46
-rw-r--r--test/functional/legacy/062_tab_pages_spec.lua69
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua98
-rw-r--r--test/functional/legacy/065_float_and_logic_operators_spec.lua16
-rw-r--r--test/functional/legacy/066_visual_block_tab_spec.lua16
-rw-r--r--test/functional/legacy/067_augroup_exists_spec.lua44
-rw-r--r--test/functional/legacy/068_text_formatting_spec.lua154
-rw-r--r--test/functional/legacy/069_multibyte_formatting_spec.lua44
-rw-r--r--test/functional/legacy/072_undo_file_spec.lua48
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua30
-rw-r--r--test/functional/legacy/075_maparg_spec.lua46
-rw-r--r--test/functional/legacy/077_mf_hash_grow_spec.lua18
-rw-r--r--test/functional/legacy/080_substitute_spec.lua28
-rw-r--r--test/functional/legacy/081_coptions_movement_spec.lua8
-rw-r--r--test/functional/legacy/082_string_comparison_spec.lua10
-rw-r--r--test/functional/legacy/084_curswant_spec.lua4
-rw-r--r--test/functional/legacy/088_conceal_tabs_spec.lua20
-rw-r--r--test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua22
-rw-r--r--test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua22
-rw-r--r--test/functional/legacy/094_visual_mode_operators_spec.lua86
-rw-r--r--test/functional/legacy/096_location_list_spec.lua144
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua28
-rw-r--r--test/functional/legacy/101_hlsearch_spec.lua74
-rw-r--r--test/functional/legacy/102_fnameescape_spec.lua12
-rw-r--r--test/functional/legacy/104_let_assignment_spec.lua6
-rw-r--r--test/functional/legacy/106_errorformat_spec.lua16
-rw-r--r--test/functional/legacy/107_adjust_window_and_contents_spec.lua60
-rw-r--r--test/functional/legacy/108_backtrace_debug_commands_spec.lua48
-rw-r--r--test/functional/legacy/arglist_spec.lua252
-rw-r--r--test/functional/legacy/assert_spec.lua8
-rw-r--r--test/functional/legacy/autochdir_spec.lua8
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua74
-rw-r--r--test/functional/legacy/autoformat_join_spec.lua15
-rw-r--r--test/functional/legacy/breakindent_spec.lua254
-rw-r--r--test/functional/legacy/changelist_spec.lua10
-rw-r--r--test/functional/legacy/charsearch_spec.lua18
-rw-r--r--test/functional/legacy/close_count_spec.lua199
-rw-r--r--test/functional/legacy/command_count_spec.lua60
-rw-r--r--test/functional/legacy/comparators_spec.lua4
-rw-r--r--test/functional/legacy/delete_spec.lua30
-rw-r--r--test/functional/legacy/eval_spec.lua353
-rw-r--r--test/functional/legacy/fixeol_spec.lua40
-rw-r--r--test/functional/legacy/function_sort_spec.lua26
-rw-r--r--test/functional/legacy/getcwd_spec.lua46
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua9
-rw-r--r--test/functional/legacy/increment_spec.lua6
-rw-r--r--test/functional/legacy/insertcount_spec.lua4
-rw-r--r--test/functional/legacy/join_spec.lua14
-rw-r--r--test/functional/legacy/lispwords_spec.lua4
-rw-r--r--test/functional/legacy/listchars_spec.lua40
-rw-r--r--test/functional/legacy/listlbr_spec.lua178
-rw-r--r--test/functional/legacy/mapping_spec.lua62
-rw-r--r--test/functional/legacy/marks_spec.lua12
-rw-r--r--test/functional/legacy/nested_function_spec.lua4
-rw-r--r--test/functional/legacy/packadd_spec.lua14
-rw-r--r--test/functional/legacy/search_mbyte_spec.lua15
-rw-r--r--test/functional/legacy/searchpos_spec.lua4
-rw-r--r--test/functional/legacy/set_spec.lua18
-rw-r--r--test/functional/legacy/signs_spec.lua14
-rw-r--r--test/functional/legacy/textobjects_spec.lua10
-rw-r--r--test/functional/legacy/utf8_spec.lua18
-rw-r--r--test/functional/legacy/wordcount_spec.lua85
-rw-r--r--test/functional/legacy/writefile_spec.lua24
-rw-r--r--test/functional/normal/count_spec.lua4
-rw-r--r--test/functional/normal/fold_spec.lua153
-rw-r--r--test/functional/normal/lang_spec.lua63
-rw-r--r--test/functional/normal/put_spec.lua24
-rw-r--r--test/functional/normal/undo_spec.lua4
-rw-r--r--test/functional/options/defaults_spec.lua4
-rw-r--r--test/functional/options/pastetoggle_spec.lua37
-rw-r--r--test/functional/options/shortmess_spec.lua8
-rw-r--r--test/functional/plugin/health_spec.lua10
-rw-r--r--test/functional/plugin/matchparen_spec.lua4
-rw-r--r--test/functional/provider/python3_spec.lua10
-rw-r--r--test/functional/spell/spellfile_spec.lua110
-rw-r--r--test/functional/terminal/buffer_spec.lua30
-rw-r--r--test/functional/terminal/cursor_spec.lua6
-rw-r--r--test/functional/terminal/edit_spec.lua5
-rw-r--r--test/functional/terminal/ex_terminal_spec.lua20
-rw-r--r--test/functional/terminal/helpers.lua8
-rw-r--r--test/functional/terminal/highlight_spec.lua18
-rw-r--r--test/functional/terminal/scrollback_spec.lua13
-rw-r--r--test/functional/terminal/tui_spec.lua114
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua8
-rw-r--r--test/functional/ui/bufhl_spec.lua19
-rw-r--r--test/functional/ui/cursor_spec.lua213
-rw-r--r--test/functional/ui/highlight_spec.lua256
-rw-r--r--test/functional/ui/inccommand_spec.lua144
-rw-r--r--test/functional/ui/input_spec.lua6
-rw-r--r--test/functional/ui/mode_spec.lua227
-rw-r--r--test/functional/ui/mouse_spec.lua74
-rw-r--r--test/functional/ui/quickfix_spec.lua52
-rw-r--r--test/functional/ui/screen.lua66
-rw-r--r--test/functional/ui/screen_basic_spec.lua215
-rw-r--r--test/functional/ui/searchhl_spec.lua34
-rw-r--r--test/functional/ui/sign_spec.lua14
-rw-r--r--test/functional/ui/syntax_conceal_spec.lua70
-rw-r--r--test/functional/ui/wildmode_spec.lua14
-rw-r--r--test/functional/viml/completion_spec.lua64
-rw-r--r--test/functional/viml/lang_spec.lua5
-rw-r--r--test/helpers.lua70
-rw-r--r--test/unit/eval/decode_spec.lua7
-rw-r--r--test/unit/eval/helpers.lua2
-rw-r--r--test/unit/eval/typval_spec.lua87
-rw-r--r--test/unit/fixtures/multiqueue.c3
-rw-r--r--test/unit/fixtures/rbuffer.c3
-rw-r--r--test/unit/helpers.lua266
-rw-r--r--test/unit/os/env_spec.lua27
-rw-r--r--test/unit/os/fileio_spec.lua85
-rw-r--r--test/unit/testtest_spec.lua19
-rw-r--r--third-party/CMakeLists.txt4
-rw-r--r--third-party/cmake/BuildLuarocks.cmake2
-rw-r--r--third-party/cmake/BuildMsgpack.cmake3
-rw-r--r--third-party/cmake/DownloadAndExtractFile.cmake2
435 files changed, 15082 insertions, 11059 deletions
diff --git a/.travis.yml b/.travis.yml
index d28fc9d7f1..1f00b5c880 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,7 +10,7 @@ env:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- MAKE_CMD="make -j2"
# Update PATH for pip.
- - PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-3.8/bin:$PATH"
+ - PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-3.9/bin:$PATH"
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
@@ -25,7 +25,7 @@ env:
- CMAKE_FLAGS="-DTRAVIS_CI_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
- -DBUSTED_OUTPUT_TYPE=gtest
+ -DBUSTED_OUTPUT_TYPE=nvim
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
-DMIN_LOG_LEVEL=2"
- DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR"
@@ -43,13 +43,9 @@ env:
# If this file exists, we know that the cache contains compiled
# dependencies and we can use it.
- CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker"
- # Test success marker. If this file exists, we know that all tests
- # were successful. Required because we only want to update the cache
- # if the tests were successful, but don't have this information
- # available in before_cache (which is run before after_success).
- - SUCCESS_MARKER="$BUILD_DIR/.tests_successful"
# default target name for functional tests
- FUNCTIONALTEST=functionaltest
+ - CI_TARGET=tests
matrix:
include:
@@ -68,10 +64,10 @@ matrix:
compiler: gcc-5 -m32
env: BUILD_32BIT=ON
- os: linux
- compiler: clang-3.8
+ compiler: clang-3.9
env: CLANG_SANITIZER=ASAN_UBSAN
- os: linux
- compiler: clang-3.8
+ compiler: clang-3.9
env: CLANG_SANITIZER=TSAN
- os: osx
compiler: clang
@@ -83,24 +79,24 @@ matrix:
- env: GCOV=gcov-5 CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
fast_finish: true
-before_install: .ci/before_install.sh
-install: .ci/install.sh
-before_script: .ci/before_script.sh
-script: .ci/script.sh
-before_cache: .ci/before_cache.sh
-after_success: .ci/after_success.sh
+before_install: ci/before_install.sh
+install: ci/install.sh
+before_script: ci/before_script.sh
+script: ci/script.sh
+before_cache: ci/before_cache.sh
+after_success: ci/after_success.sh
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- - llvm-toolchain-precise-3.8
+ - llvm-toolchain-trusty-3.9
packages:
- autoconf
- automake
- apport
- build-essential
- - clang-3.8
+ - clang-3.9
- cmake
- cscope
- g++-5-multilib
@@ -108,9 +104,11 @@ addons:
- gcc-5-multilib
- gcc-multilib
- gdb
+ - language-pack-tr
- libc6-dev-i386
- libtool
- - llvm-3.8-dev
+ - llvm-3.9-dev
+ - locales
- pkg-config
- unzip
- valgrind
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a058f2bff..2232543cc8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,7 +275,6 @@ else()
endif()
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
-add_definitions(-DHAVE_CONFIG_H)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
@@ -310,6 +309,21 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
+list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
+check_c_source_compiles("
+#include <msgpack.h>
+
+int
+main(void)
+{
+ return MSGPACK_OBJECT_FLOAT32;
+}
+" MSGPACK_HAS_FLOAT32)
+
+if(MSGPACK_HAS_FLOAT32)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_MSGPACK_HAS_FLOAT32")
+endif()
+
if(UNIX)
option(FEAT_TUI "Enable the Terminal UI" ON)
else()
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f7389ece75..f442ceb672 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,10 +6,15 @@ Getting started
If you want to help but don't know where to start, here are some
low-risk/isolated tasks:
-- Help us [review pull requests](#reviewing)!
- Merge a [Vim patch].
- Try a [complexity:low] issue.
-- Fix [clang-scan] or [coverity](#coverity) warnings.
+- Fix [clang-scan], [coverity](#coverity), and [PVS](#pvs-studio) warnings.
+
+Developer guidelines
+--------------------
+
+- Nvim developers should read `:help dev-help`.
+- External UI developers should read `:help dev-ui`.
Reporting problems
------------------
@@ -26,17 +31,25 @@ Reporting problems
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.
+- To avoid duplicate work, create a `[WIP]` pull request as soon as possible.
+- Avoid cosmetic changes to unrelated files in the same commit: noise makes
+ reviews take longer.
- 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.
+- Use a **rebase workflow** for small PRs.
+ - After addressing review comments, it's fine to rebase and force-push.
+- Use a **merge workflow** for big, high-risk PRs.
+ - Merge `master` into your PR when there are conflicts or when master
+ introduces breaking changes.
+ - Use the `ri` git alias:
+ ```
+ [alias]
+ ri = "!sh -c 't=\"${1:-master}\" ; s=\"${2:-HEAD}\" ; if git merge-base --is-ancestor \"$t\" \"$s\" ; then o=\"$t\" ; else mb=\"$(git merge-base \"$t\" \"$s\")\" ; if test \"x$mb\" = x ; then o=\"$t\" ; else lm=\"$(git log -n1 --merges \"$t..$s\" --pretty=%H)\" ; if test \"x$lm\" = x ; then o=\"$mb\" ; else o=\"$lm\" ; fi ; fi ; fi ; [ $# -gt 0 ] && shift ; [ $# -gt 0 ] && shift ; git rebase --interactive \"$o\" \"$@\"' -"
+ ```
+ This avoids unnecessary rebases yet still allows you to combine related
+ commits, separate monolithic commits, etc.
+ - Do not edit commits that come before the merge commit.
+- During a squash/fixup, use `exec make -C build unittest` between each
+ pick/edit/reword.
### Stages: WIP, RFC, RDY
@@ -111,6 +124,11 @@ Use this commit-message format for coverity fixes:
where `<id>` is the Coverity ID (CID). For example see [#804](https://github.com/neovim/neovim/pull/804).
+### PVS-Studio
+
+Run `scripts/pvscheck.sh` to check the codebase with [PVS
+Studio](https://www.viva64.com/en/pvs-studio/).
+
Reviewing
---------
diff --git a/Makefile b/Makefile
index d2f6c11b19..0c057f5656 100644
--- a/Makefile
+++ b/Makefile
@@ -126,11 +126,11 @@ distclean: clean
install: | nvim
+$(BUILD_CMD) -C build install
-clint:
- $(CMAKE_PRG) -DLINT_PRG=./src/clint.py \
- -DLINT_DIR=src \
- -DLINT_SUPPRESS_URL="$(DOC_DOWNLOAD_URL_BASE)$(CLINT_ERRORS_FILE_PATH)" \
- -P cmake/RunLint.cmake
+clint: build/.ran-cmake
+ +$(BUILD_CMD) -C build clint
+
+clint-full: build/.ran-cmake
+ +$(BUILD_CMD) -C build clint-full
check-single-includes: build/.ran-cmake
+$(BUILD_CMD) -C build check-single-includes
diff --git a/README.md b/README.md
index dcead08331..bfa0216a0f 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ Packages are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], and
Project layout
--------------
-- `.ci/`: Build server scripts
+- `ci/`: Build server scripts
- `cmake/`: Build scripts
- `runtime/`: Application files
- [`src/`](src/nvim/README.md): Application source code
diff --git a/appveyor.yml b/appveyor.yml
index ed5e06e3ee..edb679d223 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,10 +4,10 @@ configuration:
- MINGW_32
install: []
build_script:
-- call .ci\build.bat
+- call ci\build.bat
cache:
-- C:\msys64\var\cache\pacman\pkg -> .ci\build.bat
-- .deps -> third-party/CMakeLists.txt
+- C:\msys64\var\cache\pacman\pkg -> ci\build.bat
+- .deps -> third-party\**
artifacts:
- path: build/Neovim.zip
- path: build/bin/nvim.exe
diff --git a/busted/outputHandlers/nvim.lua b/busted/outputHandlers/nvim.lua
new file mode 100644
index 0000000000..b612ead070
--- /dev/null
+++ b/busted/outputHandlers/nvim.lua
@@ -0,0 +1,305 @@
+local s = require 'say'
+local pretty = require 'pl.pretty'
+local term = require 'term'
+
+local colors
+
+local isWindows = package.config:sub(1,1) == '\\'
+
+if isWindows then
+ colors = setmetatable({}, {__index = function() return function(s) return s end end})
+else
+ colors = require 'term.colors'
+end
+
+return function(options)
+ local busted = require 'busted'
+ local handler = require 'busted.outputHandlers.base'()
+
+ local c = {
+ succ = function(s) return colors.bright(colors.green(s)) end,
+ skip = function(s) return colors.bright(colors.yellow(s)) end,
+ fail = function(s) return colors.bright(colors.magenta(s)) end,
+ errr = function(s) return colors.bright(colors.red(s)) end,
+ test = tostring,
+ file = colors.cyan,
+ time = colors.dim,
+ note = colors.yellow,
+ sect = function(s) return colors.green(colors.dim(s)) end,
+ nmbr = colors.bright,
+ }
+
+ local repeatSuiteString = '\nRepeating all tests (run %d of %d) . . .\n\n'
+ local randomizeString = c.note('Note: Randomizing test order with a seed of %d.\n')
+ local globalSetup = c.sect('[----------]') .. ' Global test environment setup.\n'
+ local fileStartString = c.sect('[----------]') .. ' Running tests from ' .. c.file('%s') .. '\n'
+ local runString = c.sect('[ RUN ]') .. ' ' .. c.test('%s') .. ': '
+ local successString = c.succ('OK') .. '\n'
+ local skippedString = c.skip('SKIP') .. '\n'
+ local failureString = c.fail('FAIL') .. '\n'
+ local errorString = c.errr('ERR') .. '\n'
+ local fileEndString = c.sect('[----------]') .. ' '.. c.nmbr('%d') .. ' %s from ' .. c.file('%s') .. ' ' .. c.time('(%.2f ms total)') .. '\n\n'
+ local globalTeardown = c.sect('[----------]') .. ' Global test environment teardown.\n'
+ local suiteEndString = c.sect('[==========]') .. ' ' .. c.nmbr('%d') .. ' %s from ' .. c.nmbr('%d') .. ' test %s ran. ' .. c.time('(%.2f ms total)') .. '\n'
+ local successStatus = c.succ('[ PASSED ]') .. ' ' .. c.nmbr('%d') .. ' %s.\n'
+ local timeString = c.time('%.2f ms')
+
+ local summaryStrings = {
+ skipped = {
+ header = c.skip('[ SKIPPED ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
+ test = c.skip('[ SKIPPED ]') .. ' %s\n',
+ footer = ' ' .. c.nmbr('%d') .. ' SKIPPED %s\n',
+ },
+
+ failure = {
+ header = c.fail('[ FAILED ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
+ test = c.fail('[ FAILED ]') .. ' %s\n',
+ footer = ' ' .. c.nmbr('%d') .. ' FAILED %s\n',
+ },
+
+ error = {
+ header = c.errr('[ ERROR ]') .. ' ' .. c.nmbr('%d') .. ' %s, listed below:\n',
+ test = c.errr('[ ERROR ]') .. ' %s\n',
+ footer = ' ' .. c.nmbr('%d') .. ' %s\n',
+ },
+ }
+
+ c = nil
+
+ local fileCount = 0
+ local fileTestCount = 0
+ local testCount = 0
+ local successCount = 0
+ local skippedCount = 0
+ local failureCount = 0
+ local errorCount = 0
+
+ local pendingDescription = function(pending)
+ local name = pending.name
+ local string = ''
+
+ if type(pending.message) == 'string' then
+ string = string .. pending.message .. '\n'
+ elseif pending.message ~= nil then
+ string = string .. pretty.write(pending.message) .. '\n'
+ end
+
+ return string
+ end
+
+ local failureDescription = function(failure)
+ local string = failure.randomseed and ('Random seed: ' .. failure.randomseed .. '\n') or ''
+ if type(failure.message) == 'string' then
+ string = string .. failure.message
+ elseif failure.message == nil then
+ string = string .. 'Nil error'
+ else
+ string = string .. pretty.write(failure.message)
+ end
+
+ string = string .. '\n'
+
+ if options.verbose and failure.trace and failure.trace.traceback then
+ string = string .. failure.trace.traceback .. '\n'
+ end
+
+ return string
+ end
+
+ local getFileLine = function(element)
+ local fileline = ''
+ if element.trace or element.trace.short_src then
+ fileline = colors.cyan(element.trace.short_src) .. ' @ ' ..
+ colors.cyan(element.trace.currentline) .. ': '
+ end
+ return fileline
+ end
+
+ local getTestList = function(status, count, list, getDescription)
+ local string = ''
+ local header = summaryStrings[status].header
+ if count > 0 and header then
+ local tests = (count == 1 and 'test' or 'tests')
+ local errors = (count == 1 and 'error' or 'errors')
+ string = header:format(count, status == 'error' and errors or tests)
+
+ local testString = summaryStrings[status].test
+ if testString then
+ for _, t in ipairs(list) do
+ local fullname = getFileLine(t.element) .. colors.bright(t.name)
+ string = string .. testString:format(fullname)
+ string = string .. getDescription(t)
+ end
+ end
+ end
+ return string
+ end
+
+ local getSummary = function(status, count)
+ local string = ''
+ local footer = summaryStrings[status].footer
+ if count > 0 and footer then
+ local tests = (count == 1 and 'TEST' or 'TESTS')
+ local errors = (count == 1 and 'ERROR' or 'ERRORS')
+ string = footer:format(count, status == 'error' and errors or tests)
+ end
+ return string
+ end
+
+ local getSummaryString = function()
+ local tests = (successCount == 1 and 'test' or 'tests')
+ local string = successStatus:format(successCount, tests)
+
+ string = string .. getTestList('skipped', skippedCount, handler.pendings, pendingDescription)
+ string = string .. getTestList('failure', failureCount, handler.failures, failureDescription)
+ string = string .. getTestList('error', errorCount, handler.errors, failureDescription)
+
+ string = string .. ((skippedCount + failureCount + errorCount) > 0 and '\n' or '')
+ string = string .. getSummary('skipped', skippedCount)
+ string = string .. getSummary('failure', failureCount)
+ string = string .. getSummary('error', errorCount)
+
+ return string
+ end
+
+ handler.suiteReset = function()
+ fileCount = 0
+ fileTestCount = 0
+ testCount = 0
+ successCount = 0
+ skippedCount = 0
+ failureCount = 0
+ errorCount = 0
+
+ return nil, true
+ end
+
+ handler.suiteStart = function(suite, count, total, randomseed)
+ if total > 1 then
+ io.write(repeatSuiteString:format(count, total))
+ end
+ if randomseed then
+ io.write(randomizeString:format(randomseed))
+ end
+ io.write(globalSetup)
+ io.flush()
+
+ return nil, true
+ end
+
+ local function getElapsedTime(tbl)
+ if tbl.duration then
+ return tbl.duration * 1000
+ else
+ return tonumber('nan')
+ end
+ end
+
+ handler.suiteEnd = function(suite, count, total)
+ local elapsedTime_ms = getElapsedTime(suite)
+ local tests = (testCount == 1 and 'test' or 'tests')
+ local files = (fileCount == 1 and 'file' or 'files')
+ io.write(globalTeardown)
+ io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms))
+ io.write(getSummaryString())
+ io.flush()
+
+ return nil, true
+ end
+
+ handler.fileStart = function(file)
+ fileTestCount = 0
+ io.write(fileStartString:format(file.name))
+ io.flush()
+ return nil, true
+ end
+
+ handler.fileEnd = function(file)
+ local elapsedTime_ms = getElapsedTime(file)
+ local tests = (fileTestCount == 1 and 'test' or 'tests')
+ fileCount = fileCount + 1
+ io.write(fileEndString:format(fileTestCount, tests, file.name, elapsedTime_ms))
+ io.flush()
+ return nil, true
+ end
+
+ handler.testStart = function(element, parent)
+ io.write(runString:format(handler.getFullName(element)))
+ io.flush()
+
+ return nil, true
+ end
+
+ handler.testEnd = function(element, parent, status, debug)
+ local elapsedTime_ms = getElapsedTime(element)
+ local string
+
+ fileTestCount = fileTestCount + 1
+ testCount = testCount + 1
+ if status == 'success' then
+ successCount = successCount + 1
+ string = successString
+ elseif status == 'pending' then
+ skippedCount = skippedCount + 1
+ string = skippedString
+ elseif status == 'failure' then
+ failureCount = failureCount + 1
+ string = nil
+ elseif status == 'error' then
+ errorCount = errorCount + 1
+ string = nil
+ end
+
+ if string ~= nil then
+ if elapsedTime_ms == elapsedTime_ms then
+ string = timeString:format(elapsedTime_ms) .. ' ' .. string
+ end
+ io.write(string)
+ io.flush()
+ end
+
+ return nil, true
+ end
+
+ handler.testFailure = function(element, parent, message, debug)
+ io.write(failureString)
+ io.flush()
+
+ io.write(failureDescription(handler.failures[#handler.failures]))
+ io.flush()
+ return nil, true
+ end
+
+ handler.testError = function(element, parent, message, debug)
+ io.write(errorString)
+ io.flush()
+
+ io.write(failureDescription(handler.errors[#handler.errors]))
+ io.flush()
+ return nil, true
+ end
+
+ handler.error = function(element, parent, message, debug)
+ if element.descriptor ~= 'it' then
+ io.write(failureDescription(handler.errors[#handler.errors]))
+ io.flush()
+ errorCount = errorCount + 1
+ end
+
+ return nil, true
+ end
+
+ busted.subscribe({ 'suite', 'reset' }, handler.suiteReset)
+ busted.subscribe({ 'suite', 'start' }, handler.suiteStart)
+ busted.subscribe({ 'suite', 'end' }, handler.suiteEnd)
+ busted.subscribe({ 'file', 'start' }, handler.fileStart)
+ busted.subscribe({ 'file', 'end' }, handler.fileEnd)
+ busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
+ busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending })
+ busted.subscribe({ 'failure', 'it' }, handler.testFailure)
+ busted.subscribe({ 'error', 'it' }, handler.testError)
+ busted.subscribe({ 'failure' }, handler.error)
+ busted.subscribe({ 'error' }, handler.error)
+
+ return handler
+end
diff --git a/.ci/after_success.sh b/ci/after_success.sh
index 0215eb139b..0215eb139b 100755
--- a/.ci/after_success.sh
+++ b/ci/after_success.sh
diff --git a/.ci/before_cache.sh b/ci/before_cache.sh
index dd1fcf2bf7..3d7cc0ec5a 100755
--- a/.ci/before_cache.sh
+++ b/ci/before_cache.sh
@@ -3,12 +3,15 @@
set -e
set -o pipefail
+CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "${CI_DIR}/common/suite.sh"
+
# Don't cache pip's log and selfcheck.
rm -rf "${HOME}/.cache/pip/log"
rm -f "${HOME}/.cache/pip/selfcheck.json"
# Update the third-party dependency cache only if the build was successful.
-if [[ -f "${SUCCESS_MARKER}" ]]; then
+if ended_successfully; then
rm -rf "${HOME}/.cache/nvim-deps"
mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps"
touch "${CACHE_MARKER}"
diff --git a/.ci/before_install.sh b/ci/before_install.sh
index 9aac37de12..5b36adaef2 100755
--- a/.ci/before_install.sh
+++ b/ci/before_install.sh
@@ -3,7 +3,7 @@
set -e
set -o pipefail
-if [[ -n "${CI_TARGET}" ]]; then
+if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
diff --git a/.ci/before_script.sh b/ci/before_script.sh
index 4a75e89fbe..445996a8df 100755
--- a/.ci/before_script.sh
+++ b/ci/before_script.sh
@@ -3,7 +3,7 @@
set -e
set -o pipefail
-if [[ -n "${CI_TARGET}" ]]; then
+if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
diff --git a/.ci/build.bat b/ci/build.bat
index 87a171b994..9071c0864e 100644
--- a/.ci/build.bat
+++ b/ci/build.bat
@@ -38,7 +38,7 @@ cd ..
:: Build Neovim
mkdir build
cd build
-cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUSTED_OUTPUT_TYPE=gtest -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
+cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUSTED_OUTPUT_TYPE=nvim -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
mingw32-make VERBOSE=1 || goto :error
bin\nvim --version || goto :error
diff --git a/.ci/common/build.sh b/ci/common/build.sh
index 44087513ee..129622b522 100644
--- a/.ci/common/build.sh
+++ b/ci/common/build.sh
@@ -1,3 +1,11 @@
+top_make() {
+ ${MAKE_CMD} "$@"
+}
+
+build_make() {
+ top_make -C "${BUILD_DIR}" "$@"
+}
+
build_deps() {
if [[ "${BUILD_32BIT}" == ON ]]; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
@@ -30,7 +38,7 @@ build_deps() {
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
CC= cmake ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
- if ! ${MAKE_CMD}; then
+ if ! top_make; then
exit 1
fi
@@ -53,18 +61,18 @@ prepare_build() {
build_nvim() {
echo "Building nvim."
- if ! ${MAKE_CMD} nvim; then
+ if ! top_make nvim; then
exit 1
fi
if [ "$CLANG_SANITIZER" != "TSAN" ]; then
echo "Building libnvim."
- if ! ${MAKE_CMD} libnvim; then
+ if ! top_make libnvim; then
exit 1
fi
echo "Building nvim-test."
- if ! ${MAKE_CMD} nvim-test; then
+ if ! top_make nvim-test; then
exit 1
fi
fi
diff --git a/ci/common/suite.sh b/ci/common/suite.sh
new file mode 100644
index 0000000000..568d5d5bee
--- /dev/null
+++ b/ci/common/suite.sh
@@ -0,0 +1,147 @@
+# HACK: get newline for use in strings given that "\n" and $'' do not work.
+NL="$(printf '\nE')"
+NL="${NL%E}"
+
+FAIL_SUMMARY=""
+
+# Test success marker. If END_MARKER file exists, we know that all tests
+# finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this
+# file will contain information about failed tests. Build is considered
+# successful if tests ended without any of them failing.
+END_MARKER="$BUILD_DIR/.tests_finished"
+FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
+
+enter_suite() {
+ FAILED=0
+ rm -f "${END_MARKER}"
+ local suite_name="$1"
+ export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
+}
+
+exit_suite() {
+ if test $FAILED -ne 0 ; then
+ echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
+ echo "${FAIL_SUMMARY}"
+ fi
+ export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
+ if test "x$1" != "x--continue" ; then
+ exit $FAILED
+ else
+ local saved_failed=$FAILED
+ FAILED=0
+ return $saved_failed
+ fi
+}
+
+fail() {
+ local test_name="$1"
+ local fail_char="$2"
+ local message="$3"
+
+ : ${fail_char:=F}
+ : ${message:=Test $test_name failed}
+
+ local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message"
+ FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}"
+ echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}"
+ echo "Failed: $full_msg"
+ FAILED=1
+}
+
+run_test() {
+ local cmd="$1"
+ test $# -gt 0 && shift
+ local test_name="$1"
+ : ${test_name:=$cmd}
+ test $# -gt 0 && shift
+ if ! eval "$cmd" ; then
+ fail "${test_name}" "$@"
+ fi
+}
+
+run_test_wd() {
+ local hang_ok=
+ if test "x$1" = "x--allow-hang" ; then
+ hang_ok=1
+ shift
+ fi
+
+ local timeout="$1"
+ test $# -gt 0 && shift
+
+ local cmd="$1"
+ test $# -gt 0 && shift
+
+ local restart_cmd="$1"
+ : ${restart_cmd:=true}
+ test $# -gt 0 && shift
+
+ local test_name="$1"
+ : ${test_name:=$cmd}
+ test $# -gt 0 && shift
+
+ local output_file="$(mktemp)"
+ local status_file="$(mktemp)"
+
+ local restarts=5
+ local prev_tmpsize=-1
+ while test $restarts -gt 0 ; do
+ : > "${status_file}"
+ (
+ set -o pipefail
+ ret=0
+ if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then
+ ret=1
+ fi
+ echo "$ret" > "$status_file"
+ exit $ret
+ ) &
+ local pid=$!
+ while test "$(stat -c "%s" "$status_file")" -eq 0 ; do
+ prev_tmpsize=$tmpsize
+ sleep $timeout
+ tmpsize="$(stat -c "%s" "$output_file")"
+ if test $tempsize -eq $prev_temsize ; then
+ # no output, assuming either hang or exit
+ break
+ fi
+ done
+ restarts=$[ restarts - 1 ]
+ if test "$(stat -c "%s" "$status_file")" -eq 0 ; then
+ # status file not updated, assuming hang
+ kill -KILL $pid
+ if test $restarts -eq 0 ; then
+ if test "x$hang_ok" = "x" ; then
+ fail "${test_name}" E "Test hang up"
+ fi
+ else
+ echo "Test ${test_name} hang up, restarting"
+ eval "$restart_cmd"
+ fi
+ else
+ local new_failed="$(cat "$status_file")"
+ if test "x$new_failed" != "x0" ; then
+ fail "${test_name}" F "Test failed in run_test_wd"
+ fi
+ return 0
+ fi
+ done
+}
+
+ended_successfully() {
+ if [[ -f "${FAIL_SUMMARY_FILE}" ]]; then
+ echo 'Test failed, complete summary:'
+ cat "${FAIL_SUMMARY_FILE}"
+ return 1
+ fi
+ if ! [[ -f "${END_MARKER}" ]] ; then
+ echo 'ended_successfully called before end marker was touched'
+ return 1
+ fi
+ return 0
+}
+
+end_tests() {
+ touch "${END_MARKER}"
+ ended_successfully
+}
diff --git a/.ci/common/test.sh b/ci/common/test.sh
index b28e46a4df..d911d9bc18 100644
--- a/.ci/common/test.sh
+++ b/ci/common/test.sh
@@ -1,3 +1,6 @@
+source "${CI_DIR}/common/build.sh"
+source "${CI_DIR}/common/suite.sh"
+
print_core() {
local app="$1"
local core="$2"
@@ -38,10 +41,9 @@ check_core_dumps() {
print_core "$app" "$core"
fi
done
- if test "$app" = quiet ; then
- return 0
+ if test "$app" != quiet ; then
+ fail 'cores' E 'Core dumps found'
fi
- exit 1
}
check_logs() {
@@ -60,8 +62,7 @@ check_logs() {
err=1
done
if [[ -n "${err}" ]]; then
- echo "Runtime errors detected."
- exit 1
+ fail 'logs' E 'Runtime errors detected.'
fi
}
@@ -73,50 +74,53 @@ asan_check() {
check_logs "${1}" "*san.*"
}
-run_unittests() {
+run_unittests() {(
+ enter_suite unittests
ulimit -c unlimited
- if ! ${MAKE_CMD} -C "${BUILD_DIR}" unittest ; then
- check_core_dumps "$(which luajit)"
- exit 1
+ if ! build_make unittest ; then
+ fail 'unittests' F 'Unit tests failed'
fi
check_core_dumps "$(which luajit)"
-}
+ exit_suite
+)}
-run_functionaltests() {
+run_functionaltests() {(
+ enter_suite functionaltests
ulimit -c unlimited
- if ! ${MAKE_CMD} -C "${BUILD_DIR}" ${FUNCTIONALTEST}; then
- asan_check "${LOG_DIR}"
- valgrind_check "${LOG_DIR}"
- check_core_dumps
- exit 1
+ if ! build_make ${FUNCTIONALTEST}; then
+ fail 'functionaltests' F 'Functional tests failed'
fi
asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
-}
+ exit_suite
+)}
-run_oldtests() {
+run_oldtests() {(
+ enter_suite oldtests
ulimit -c unlimited
if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
reset
- asan_check "${LOG_DIR}"
- valgrind_check "${LOG_DIR}"
- check_core_dumps
- exit 1
+ fail 'oldtests' F 'Legacy tests failed'
fi
asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
-}
+ exit_suite
+)}
-install_nvim() {
- ${MAKE_CMD} -C "${BUILD_DIR}" install
+install_nvim() {(
+ enter_suite 'install_nvim'
+ if ! build_make install ; then
+ fail 'install' E 'make install failed'
+ exit_suite
+ fi
"${INSTALL_PREFIX}/bin/nvim" --version
"${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' || {
echo "Running ':help' in the installed nvim failed."
echo "Maybe the helptags have not been generated properly."
- exit 1
+ fail 'help' F 'Failed running :help'
}
local genvimsynf=syntax/vim/generated.vim
@@ -125,24 +129,22 @@ install_nvim() {
cd runtime ; git ls-files | grep -e '.vim$' -e '.ps$' -e '.dict$' -e '.py$' -e '.tutor$'
) ; do
if ! test -e "${INSTALL_PREFIX}/share/nvim/runtime/$file" ; then
- echo "It appears that $file is not installed."
- exit 1
+ fail 'runtime-install' F "It appears that $file is not installed."
fi
done
# Check that generated syntax file has function names, #5060.
local gpat='syn keyword vimFuncName .*eval'
if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf"; then
- echo "It appears that $genvimsynf does not contain $gpat."
- exit 1
+ fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat."
fi
for file in $(
cd runtime ; git ls-files | grep -e '.awk$' -e '.sh$' -e '.bat$'
) ; do
if ! test -x "${INSTALL_PREFIX}/share/nvim/runtime/$file" ; then
- echo "It appears that $file is not installed or is not executable."
- exit 1
+ fail 'not-exe' F "It appears that $file is not installed or is not executable."
fi
done
-}
+ exit_suite
+)}
diff --git a/.ci/install.sh b/ci/install.sh
index 98d3dc01cb..4ee99e1e44 100755
--- a/.ci/install.sh
+++ b/ci/install.sh
@@ -3,7 +3,7 @@
set -e
set -o pipefail
-if [[ -n "${CI_TARGET}" ]]; then
+if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
diff --git a/ci/run_lint.sh b/ci/run_lint.sh
new file mode 100755
index 0000000000..5639b4c3db
--- /dev/null
+++ b/ci/run_lint.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+source "${CI_DIR}/common/build.sh"
+source "${CI_DIR}/common/suite.sh"
+
+enter_suite 'lint'
+
+set -x
+
+csi_clean() {
+ find "${BUILD_DIR}/bin" -name 'test-includes-*' -delete
+ find "${BUILD_DIR}" -name '*test-include*.o' -delete
+}
+
+run_test 'top_make clint-full' clint
+run_test 'top_make testlint' testlint
+CLICOLOR_FORCE=1 run_test_wd \
+ --allow-hang \
+ 10s \
+ 'top_make check-single-includes' \
+ 'csi_clean' \
+ single-includes
+
+end_tests
diff --git a/.ci/run_tests.sh b/ci/run_tests.sh
index 6347ac15d4..4abc9eea9f 100755
--- a/.ci/run_tests.sh
+++ b/ci/run_tests.sh
@@ -6,6 +6,11 @@ set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/test.sh"
+source "${CI_DIR}/common/suite.sh"
+
+set -x
+
+enter_suite tests
check_core_dumps --delete quiet
@@ -15,11 +20,11 @@ build_nvim
if [ "$CLANG_SANITIZER" != "TSAN" ]; then
# Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests
- run_unittests
- run_functionaltests
+ run_test run_unittests
+ run_test run_functionaltests
fi
-run_oldtests
+run_test run_oldtests
-install_nvim
+run_test install_nvim
-touch "${SUCCESS_MARKER}"
+end_tests
diff --git a/.ci/script.sh b/ci/script.sh
index 46c4eecf38..a59c40cd2d 100755
--- a/.ci/script.sh
+++ b/ci/script.sh
@@ -3,16 +3,11 @@
set -e
set -o pipefail
-if [[ -n "${CI_TARGET}" ]]; then
- make "${CI_TARGET}"
- exit 0
-fi
-
# This will pass the environment variables down to a bash process which runs
# as $USER, while retaining the environment variables defined and belonging
# to secondary groups given above in usermod.
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
- sudo -E su "${USER}" -c ".ci/run_tests.sh"
+ sudo -E su "${USER}" -c "ci/run_${CI_TARGET}.sh"
else
- .ci/run_tests.sh
+ ci/run_${CI_TARGET}.sh
fi
diff --git a/cmake/Download.cmake b/cmake/Download.cmake
new file mode 100644
index 0000000000..50a77816bc
--- /dev/null
+++ b/cmake/Download.cmake
@@ -0,0 +1,18 @@
+file(
+ DOWNLOAD "${URL}" "${FILE}"
+ STATUS status
+ LOG log
+)
+
+list(GET status 0 status_code)
+list(GET status 1 status_string)
+
+if(NOT status_code EQUAL 0)
+ if(NOT ALLOW_FAILURE)
+ message(FATAL_ERROR "error: downloading '${URL}' failed
+ status_code: ${status_code}
+ status_string: ${status_string}
+ log: ${log}
+ ")
+ endif()
+endif()
diff --git a/cmake/InstallClintErrors.cmake b/cmake/InstallClintErrors.cmake
new file mode 100644
index 0000000000..bd5ca07828
--- /dev/null
+++ b/cmake/InstallClintErrors.cmake
@@ -0,0 +1,2 @@
+file(GLOB_RECURSE JSON_FILES *.json)
+file(COPY ${JSON_FILES} DESTINATION "${TARGET}")
diff --git a/cmake/RunLint.cmake b/cmake/RunLint.cmake
deleted file mode 100644
index 306e938232..0000000000
--- a/cmake/RunLint.cmake
+++ /dev/null
@@ -1,32 +0,0 @@
-get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE)
-get_filename_component(LINT_PREFIX ${LINT_DIR} PATH)
-set(LINT_SUPPRESS_FILE "${LINT_PREFIX}/errors.json")
-
-if(DEFINED ENV{LINT_FILE})
- file(GLOB_RECURSE LINT_FILES "$ENV{LINT_FILE}")
-else()
- file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h)
-endif()
-
-set(LINT_ARGS)
-
-if(LINT_SUPPRESS_URL)
- file(DOWNLOAD ${LINT_SUPPRESS_URL} ${LINT_SUPPRESS_FILE})
- list(APPEND LINT_ARGS "--suppress-errors=${LINT_SUPPRESS_FILE}")
-endif()
-
-foreach(lint_file ${LINT_FILES})
- file(RELATIVE_PATH lint_file "${LINT_PREFIX}" "${lint_file}")
- list(APPEND LINT_ARGS "${lint_file}")
-endforeach()
-
-execute_process(
- COMMAND ${LINT_PRG} ${LINT_ARGS}
- RESULT_VARIABLE res
- WORKING_DIRECTORY "${LINT_PREFIX}")
-
-file(REMOVE ${LINT_SUPPRESS_FILE})
-
-if(NOT res EQUAL 0)
- message(FATAL_ERROR "Linting failed: ${res}.")
-endif()
diff --git a/man/nvim.1 b/man/nvim.1
index 98d97c2d5a..d2a3ea5c43 100644
--- a/man/nvim.1
+++ b/man/nvim.1
@@ -371,27 +371,6 @@ See
Used to set the 'shell' option, which determines the shell used by the
.Ic :terminal
command.
-.It Ev NVIM_TUI_ENABLE_CURSOR_SHAPE
-Set to 0 to prevent Nvim from changing the cursor shape.
-Set to 1 to enable non-blinking mode-sensitive cursor (this is the default).
-Set to 2 to enable blinking mode-sensitive cursor.
-Host terminal must support the DECSCUSR CSI escape sequence.
-.Pp
-Depending on the terminal emulator, using this option with
-.Nm
-under
-.Xr tmux 1
-might require adding the following to
-.Pa ~/.tmux.conf :
-.Bd -literal -offset indent
-set -ga terminal-overrides ',*:Ss=\eE[%p1%d q:Se=\eE[2 q'
-.Ed
-.Pp
-See
-.Ic terminal-overrides
-in the
-.Xr tmux 1
-manual page for more information.
.El
.Sh FILES
.Bl -tag -width "~/.config/nvim/init.vim"
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index b0791eb19d..8f45adcff1 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -33,7 +33,7 @@ function! health#check(plugin_names) abort
setlocal wrap breakindent
setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc
- setlocal keywordprg=:help
+ setlocal keywordprg=:help iskeyword=@,48-57,_,192-255,-,#
call s:enhance_syntax()
if empty(healthchecks)
@@ -88,7 +88,7 @@ endfunction
" Changes ':h clipboard' to ':help |clipboard|'.
function! s:help_to_link(s) abort
- return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '":help |\1|"', 'g')
+ return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n]+)', ':help |\1|', 'g')
endfunction
" Format a message for a specific report item
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index ca62de84d8..4c6aa0eb04 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -1,16 +1,28 @@
-let s:suggest_faq = 'See https://github.com/neovim/neovim/wiki/FAQ'
+let s:suggest_faq = 'https://github.com/neovim/neovim/wiki/FAQ'
function! s:check_config() abort
+ let ok = v:true
call health#report_start('Configuration')
- if !get(g:, 'loaded_sensible', 0)
- call health#report_ok('no issues found')
- else
+
+ if get(g:, 'loaded_sensible', 0)
+ let ok = v:false
let sensible_pi = globpath(&runtimepath, '**/sensible.vim', 1, 1)
call health#report_info("found sensible.vim plugin:\n".join(sensible_pi, "\n"))
call health#report_error("sensible.vim plugin is not needed; Nvim has the same defaults built-in."
\ ." Also, sensible.vim sets 'ttimeoutlen' to a sub-optimal value.",
\ ["Remove sensible.vim plugin, or wrap it in a `if !has('nvim')` check."])
endif
+
+ if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE')
+ let ok = v:false
+ call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+",
+ \ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
+ \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
+ endif
+
+ if ok
+ call health#report_ok('no issues found')
+ endif
endfunction
" Load the remote plugin manifest file and check for unregistered plugins
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 9f3f492ef6..2506c8216b 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -111,13 +111,13 @@ endfunction
" Check for clipboard tools.
function! s:check_clipboard() abort
- call health#report_start('Clipboard')
+ call health#report_start('Clipboard (optional)')
let clipboard_tool = provider#clipboard#Executable()
if empty(clipboard_tool)
call health#report_warn(
\ "No clipboard tool found. Clipboard registers will not work.",
- \ ['See ":help clipboard".'])
+ \ [':help clipboard'])
else
call health#report_ok('Clipboard tool found: '. clipboard_tool)
endif
@@ -224,7 +224,7 @@ function! s:check_bin(bin) abort
endfunction
function! s:check_python(version) abort
- call health#report_start('Python ' . a:version . ' provider')
+ call health#report_start('Python ' . a:version . ' provider (optional)')
let pyname = 'python'.(a:version == 2 ? '' : '3')
let pyenv = resolve(exepath('pyenv'))
@@ -419,7 +419,7 @@ function! s:check_python(version) abort
endfunction
function! s:check_ruby() abort
- call health#report_start('Ruby provider')
+ call health#report_start('Ruby provider (optional)')
let loaded_var = 'g:loaded_ruby_provider'
if exists(loaded_var) && !exists('*provider#ruby#Call')
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 1bcc1dea74..a3210046b1 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -86,7 +86,7 @@ function! provider#clipboard#Executable() abort
return 'win32yank'
endif
- let s:err = 'clipboard: No clipboard tool available. See :help clipboard'
+ let s:err = 'clipboard: No clipboard tool available. :help clipboard'
return ''
endfunction
diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim
index b99a046375..81fe194cb9 100644
--- a/runtime/autoload/provider/python.vim
+++ b/runtime/autoload/provider/python.vim
@@ -1,5 +1,5 @@
" The Python provider uses a Python host to emulate an environment for running
-" python-vim plugins. See ":help provider".
+" python-vim plugins. :help provider
"
" Associating the plugin with the Python host is the first step because plugins
" will be passed as command-line arguments
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim
index 4f47a03a9b..0c3b75b73d 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -1,5 +1,5 @@
" The Python3 provider uses a Python3 host to emulate an environment for running
-" python3 plugins. See ":help provider".
+" python3 plugins. :help provider
"
" Associating the plugin with the Python3 host is the first step because
" plugins will be passed as command-line arguments
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 08a0f39b01..2f64c22c71 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -112,15 +112,14 @@ function! s:check_interpreter(prog, major_ver) abort
endif
if v:shell_error == 2
- return [0, prog_path . ' does not have the neovim module installed. '
- \ . 'See ":help provider-python".']
+ return [0, prog_path.' does not have the "neovim" module. :help provider-python']
elseif v:shell_error == 127
" This can happen with pyenv's shims.
return [0, prog_path . ' does not exist: ' . prog_ver]
elseif v:shell_error
return [0, 'Checking ' . prog_path . ' caused an unknown error. '
\ . '(' . v:shell_error . ', output: ' . prog_ver . ')'
- \ . ' Please report this at github.com/neovim/neovim.']
+ \ . ' Report this at https://github.com/neovim/neovim']
endif
return [1, '']
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 2bcc996d8b..a118690876 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -9,8 +9,7 @@ Nvim API *API* *api*
Nvim exposes a powerful API that can be used by plugins and external processes
via |msgpack-rpc|, Lua and VimL (|eval-api|).
-Nvim can also be embedded in C applications as libnvim, so the application
-can control the embedded instance by calling the C API directly.
+Applications can also embed libnvim to work with the C API directly.
==============================================================================
API Types *api-types*
@@ -55,6 +54,28 @@ error_types Possible error types returned by API functions
External programs ("clients") can use the metadata to discover the |rpc-api|.
==============================================================================
+API contract *api-contract*
+
+The API is made of functions and events. Clients call functions like those
+described at |api-global|, and may "attach" in order to receive rich events,
+described at |rpc-remote-ui|.
+
+As Nvim develops, its API may change only according the following "contract":
+
+- New functions and events may be added.
+ - Any such extensions are OPTIONAL: old clients may ignore them.
+- Function signatures will NOT CHANGE (after release).
+ - Functions introduced in the development (unreleased) version MAY CHANGE.
+ (Clients can dynamically check `api_prerelease`, etc. |api-metadata|)
+- Event parameters will not be removed or reordered (after release).
+- Events may be EXTENDED: new parameters may be added.
+- New items may be ADDED to map/list parameters/results of functions and
+ events.
+ - Any such new items are OPTIONAL: old clients may ignore them.
+ - Existing items will not be removed (after release).
+- Deprecated functions will not be removed until Nvim version 2.0
+
+==============================================================================
Buffer highlighting *api-highlights*
Nvim allows plugins to add position-based highlights to buffers. This is
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 822019340a..e77d20172e 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -44,6 +44,7 @@ Functions ~
Options ~
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
+*'langnoremap'* Deprecated alias to 'nolangremap'.
*'vi'*
*'viminfo'* Deprecated alias to 'shada' option.
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 76ccc42546..0e909aac65 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -6,22 +6,20 @@
Development of Nvim. *development*
-1. Design goals |design-goals|
-2. Design decisions |design-decisions|
+1. Design goals |design-goals|
+2. Developer guidelines |dev-help|
Nvim is open source software. Everybody is encouraged to contribute.
https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md
-See src/nvim/README.md for a high-level overview of the source code:
- https://github.com/neovim/neovim/blob/master/src/nvim/README.md
+See src/nvim/README.md for an overview of the source code.
==============================================================================
-1. Design goals *design-goals*
+Design goals *design-goals*
Most important things come first (roughly).
-Note that quite a few items are contradicting. This is intentional. A
-balance must be found between them.
+Note that some items conflict; this is intentional. A balance must be found.
NVIM IS... IMPROVED *design-improved*
@@ -41,7 +39,7 @@ completely different editor. Extensions are done with a "Vi spirit".
- There are many first-time and inexperienced Vim users. Make it easy for
them to start using Vim and learn more over time.
- There is no limit to the features that can be added. Selecting new features
- is one based on (1) what users ask for, (2) how much effort it takes to
+ is based on (1) what users ask for, (2) how much effort it takes to
implement and (3) someone actually implementing it.
@@ -56,20 +54,14 @@ Vim tries to help as many users on as many platforms as possible.
- Support many compilers and libraries. Not everybody is able or allowed to
install another compiler or GUI library.
- People switch from one platform to another, and from GUI to terminal
- version. Features should be present in all versions, or at least in as many
- as possible with a reasonable effort. Try to avoid that users must switch
- between platforms to accomplish their work efficiently.
-- That a feature is not possible on some platforms, or only possible on one
- platform, does not mean it cannot be implemented. [This intentionally
- contradicts the previous item, these two must be balanced.]
+ version. Features should be present in all versions.
NVIM IS... WELL DOCUMENTED *design-documented*
- A feature that isn't documented is a useless feature. A patch for a new
feature must include the documentation.
-- Documentation should be comprehensive and understandable. Using examples is
- recommended.
+- Documentation should be comprehensive and understandable. Use examples.
- Don't make the text unnecessarily long. Less documentation means that an
item is easier to find.
- Do not prefix doc-tags with "nvim-". Use |vim_diff.txt| to document
@@ -77,12 +69,12 @@ NVIM IS... WELL DOCUMENTED *design-documented*
to mark a specific feature. No other distinction is necessary.
- If a feature is removed, delete its doc entry and move its tag to
|vim_diff.txt|.
+- Move deprecated features to |deprecated.txt|.
NVIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size*
-Using Vim must not be a big attack on system resources. Keep it small and
-fast.
+Keep Nvim small and fast.
- Computers are becoming faster and bigger each year. Vim can grow too, but
no faster than computers are growing. Keep Vim usable on older systems.
- Many users start Vim from a shell very often. Startup time must be short.
@@ -118,13 +110,14 @@ NVIM IS... NOT *design-not*
Nvim is not an operating system; instead it should be composed with other
tools or hosted as a component. Marvim once said: "Unlike Emacs, Nvim does not
-include the kitchen sink... but you can use it for plumbing."
+include the kitchen sink... but it's good for plumbing."
==============================================================================
-2. Design decisions *design-decisions*
+Developer guidelines *dev-help*
-JARGON *dev-jargon*
+
+JARGON *dev-jargon*
API client ~
All external UIs and remote plugins (as opposed to regular Vim plugins) are
@@ -150,15 +143,14 @@ the xterm window, a window inside Vim to view a buffer.
To avoid confusion, other items that are sometimes called window have been
given another name. Here is an overview of the related items:
-screen The whole display. For the GUI it's something like 1024x768
- pixels. The Vim shell can use the whole screen or part of it.
+screen The whole display.
shell The Vim application. This can cover the whole screen (e.g.,
when running in a console) or part of it (xterm or GUI).
window View on a buffer. There can be several windows in Vim,
together with the command line, menubar, toolbar, etc. they
fit in the shell.
-PROVIDERS *dev-provider*
+PROVIDERS *dev-provider*
A goal of Nvim is to allow extension of the editor without special knowledge
in the core. But some Vim components are too tightly coupled; in those cases
@@ -202,7 +194,7 @@ Python host isn't installed then the plugin will "think" it is running in
a Vim compiled without the |+python| feature.
-API *dev-api*
+API *dev-api*
Use this pattern to name new API functions:
nvim_{thing}_{action}_{arbitrary-qualifiers}
@@ -233,4 +225,23 @@ _not_ a Buffer). The common {action} "list" indicates that it lists all
bufs (plural) in the global context.
+EXTERNAL UI *dev-ui*
+
+External UIs should be aware of the |api-contract|. In particular, future
+versions of Nvim may add optional, new items to existing events. The API is
+strongly backwards-compatible, but clients must not break if new fields are
+added to existing events.
+
+External UIs are expected to implement some common features.
+
+- Users may want to configure UI-specific options. The UI should publish the
+ |GUIEnter| autocmd after attaching to Nvim: >
+ doautocmd GUIEnter
+- Options can be monitored for changes by the |OptionSet| autocmd. E.g. if the
+ user sets the 'guifont' option, this autocmd notifies channel 42: >
+ autocmd OptionSet guifont call rpcnotify(42, 'option-changed', 'guifont', &guifont)
+- cursor-shape change: 'guicursor' properties are sent in the mode_info_set UI
+ event.
+
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 9a86e13d95..107dd28ecd 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -38,7 +38,7 @@ done, the features in this document are not available. See |+eval| and
There are six types of variables:
Number A 32 or 64 bit signed number. |expr-number| *Number*
- Examples: -123 0x10 0177
+ Examples: -123 0x10 0177 0b1011
Float A floating point number. |floating-point-format| *Float*
Examples: 123.456 1.15e-6 -1.1e3
@@ -1022,9 +1022,10 @@ When expr8 is a |Funcref| type variable, invoke the function it refers to.
number
------
number number constant *expr-number*
- *hex-number* *octal-number*
+ *hex-number* *octal-number* *binary-number*
-Decimal, Hexadecimal (starting with 0x or 0X), or Octal (starting with 0).
+Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
+and Octal (starting with 0).
*floating-point-format*
Floating point numbers can be written in two forms:
@@ -1214,7 +1215,7 @@ The arguments are optional. Example: >
*closure*
Lambda expressions can access outer scope variables and arguments. This is
often called a closure. Example where "i" a and "a:arg" are used in a lambda
-while they exists in the function scope. They remain valid even after the
+while they exist in the function scope. They remain valid even after the
function returns: >
:function Foo(arg)
: let i = 3
@@ -1425,8 +1426,8 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
window gets a number).
*v:beval_winid* *beval_winid-variable*
-v:beval_winid The window ID of the window, over which the mouse pointer is.
- Otherwise like v:beval_winnr.
+v:beval_winid The |window-ID| of the window, over which the mouse pointer
+ is. Otherwise like v:beval_winnr.
*v:char* *char-variable*
v:char Argument for evaluating 'formatexpr' and used for the typed
@@ -1524,13 +1525,18 @@ v:errors Errors found by assert functions, such as |assert_true()|.
list by the assert function.
*v:event* *event-variable*
-v:event Dictionary of event data for the current |autocommand|. The
- available keys differ per event type and are specified at the
- documentation for each |event|. The possible keys are:
- operator The operation performed. Unlike
- |v:operator|, it is set also for an Ex
- mode command. For instance, |:yank| is
- translated to "|y|".
+v:event Dictionary of event data for the current |autocommand|. Valid
+ only during the autocommand lifetime: storing or passing
+ `v:event` is invalid. Copy it instead: >
+ au TextYankPost * let g:foo = deepcopy(v:event)
+< Keys vary by event; see the documentation for the specific
+ event, e.g. |TextYankPost|.
+ KEY DESCRIPTION ~
+ operator The current |operator|. Also set for
+ Ex commands (unlike |v:operator|). For
+ example if |TextYankPost| is triggered
+ by the |:yank| Ex command then
+ `v:event['operator']` is "y".
regcontents Text stored in the register as a
|readfile()|-style list of lines.
regname Requested register (e.g "x" for "xyy)
@@ -1681,7 +1687,7 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|.
zero when there was no mouse button click.
*v:mouse_winid* *mouse_winid-variable*
-v:mouse_winid Window ID for a mouse click obtained with |getchar()|.
+v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|.
The value is zero when there was no mouse button click.
*v:mouse_lnum* *mouse_lnum-variable*
@@ -1917,9 +1923,10 @@ v:vim_did_enter Zero until most of startup is done. It is set to one just
v:warningmsg Last given warning message. It's allowed to set this variable.
*v:windowid* *windowid-variable*
-v:windowid Application-specific window ID ("window handle" in MS-Windows)
- which may be set by any attached UI. Defaults to zero.
- Note: for windows inside Vim use |winnr()| or |win_getid()|.
+v:windowid Application-specific window "handle" which may be set by any
+ attached UI. Defaults to zero.
+ Note: For Nvim |windows| use |winnr()| or |win_getid()|, see
+ |window-ID|.
==============================================================================
4. Builtin Functions *functions*
@@ -1947,7 +1954,7 @@ 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_inrange({lower}, {upper}, {actual} [, {msg}])
- none assert {actual} is inside the range
+ none assert {actual} is inside the range
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
@@ -1963,7 +1970,7 @@ buflisted({expr}) Number |TRUE| if buffer {expr} is listed
bufloaded({expr}) Number |TRUE| if buffer {expr} is loaded
bufname({expr}) String Name of the buffer {expr}
bufnr({expr} [, {create}]) Number Number of the buffer {expr}
-bufwinid({expr}) Number window ID of buffer {expr}
+bufwinid({expr}) Number |window-ID| of buffer {expr}
bufwinnr({expr}) Number window number of buffer {expr}
byte2line({byte}) Number line number at byte count {byte}
byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
@@ -1986,7 +1993,7 @@ cos({expr}) Float cosine of {expr}
cosh({expr}) Float hyperbolic cosine of {expr}
count({list}, {expr} [, {ic} [, {start}]])
Number count how many {expr} are in {list}
-cscope_connection([{num} , {dbpath} [, {prepend}]])
+cscope_connection([{num}, {dbpath} [, {prepend}]])
Number checks existence of cscope connection
cursor({lnum}, {col} [, {off}])
Number move cursor to {lnum}, {col}, {off}
@@ -2291,15 +2298,18 @@ tabpagebuflist([{arg}]) List list of buffer numbers in tab page
tabpagenr([{arg}]) Number number of current or last tab page
tabpagewinnr({tabarg}[, {arg}])
Number number of current window in tab page
-taglist({expr}) List list of tags matching {expr}
+taglist({expr}[, {filename}]) List list of tags matching {expr}
tagfiles() List tags files used
tan({expr}) Float tangent of {expr}
tanh({expr}) Float hyperbolic tangent of {expr}
tempname() String name for a temporary file
test_garbagecollect_now() none free memory right now for testing
+timer_info([{id}]) List information about timers
+timer_pause({id}, {pause}) none pause or unpause a timer
timer_start({time}, {callback} [, {options}])
Number create a timer
timer_stop({timer}) none stop a timer
+timer_stopall() none stop all timers
tolower({expr}) String the String {expr} switched to lowercase
toupper({expr}) String the String {expr} switched to uppercase
tr({src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
@@ -2315,10 +2325,10 @@ virtcol({expr}) Number screen column of cursor or mark
visualmode([expr]) String last visual mode used
wildmenumode() Number whether 'wildmenu' mode is active
win_findbuf({bufnr}) List find windows containing {bufnr}
-win_getid([{win} [, {tab}]]) Number get window ID for {win} in {tab}
-win_gotoid({expr}) Number go to window with ID {expr}
-win_id2tabwin({expr}) List get tab and window nr from window ID
-win_id2win({expr}) Number get window nr from window ID
+win_getid([{win} [, {tab}]]) Number get |window-ID| for {win} in {tab}
+win_gotoid({expr}) Number go to |window-ID| {expr}
+win_id2tabwin({expr}) List get tab and window nr from |window-ID|
+win_id2win({expr}) Number get window nr from |window-ID|
winbufnr({nr}) Number buffer number of window {nr}
wincol() Number window column of the cursor
winheight({nr}) Number height of window {nr}
@@ -2409,7 +2419,7 @@ arglistid([{winnr} [, {tabnr}]])
With {winnr} only use this window in the current tab page.
With {winnr} and {tabnr} use the window in the specified tab
page.
- {winnr} can be the window number or the window ID.
+ {winnr} can be the window number or the |window-ID|.
*argv()*
argv([{nr}]) The result is the {nr}th file in the argument list of the
@@ -2644,7 +2654,7 @@ bufnr({expr} [, {create}])
them. Use bufexists() to test for the existence of a buffer.
bufwinid({expr}) *bufwinid()*
- The result is a Number, which is the window ID of the first
+ The result is a Number, which is the |window-ID| of the first
window associated with buffer {expr}. For the use of {expr},
see |bufname()| above. If buffer {expr} doesn't exist or
there is no such window, -1 is returned. Example: >
@@ -3198,8 +3208,12 @@ exepath({expr}) *exepath()*
*exists()*
exists({expr}) The result is a Number, which is |TRUE| if {expr} is
- defined, zero otherwise. The {expr} argument is a string,
- which contains one of these:
+ defined, zero otherwise.
+
+ For checking for a supported feature use |has()|.
+ For checking if a file exists use |filereadable()|.
+
+ The {expr} argument is a string, which contains one of these:
&option-name Vim option (only checks if it exists,
not if it really works)
+option-name Vim option that works.
@@ -3247,7 +3261,6 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
event and pattern.
##event autocommand for this event is
supported.
- For checking for a supported feature use |has()|.
Examples: >
exists("&mouse")
@@ -4060,7 +4073,7 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()*
getcwd(0)
getcwd(0, 0)
< If {winnr} is -1 it is ignored, only the tab is resolved.
- {winnr} can be the window number or the window ID.
+ {winnr} can be the window number or the |window-ID|.
getfsize({fname}) *getfsize()*
@@ -4155,7 +4168,7 @@ getline({lnum} [, {end}])
getloclist({nr},[, {what}]) *getloclist()*
Returns a list with all the entries in the location list for
- window {nr}. {nr} can be the window number or the window ID.
+ window {nr}. {nr} can be the window number or the |window-ID|.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
@@ -4230,7 +4243,7 @@ getqflist([{what}]) *getqflist()*
type type of the error, 'E', '1', etc.
valid |TRUE|: recognized error message
- When there is no error list or it's empty an empty list is
+ When there is no error list or it's empty, an empty list is
returned. Quickfix list entries with non-existing buffer
number are returned with "bufnr" set to zero.
@@ -4245,8 +4258,8 @@ getqflist([{what}]) *getqflist()*
returns only the items listed in {what} as a dictionary. The
following string items are supported in {what}:
nr get information for this quickfix list
- title get list title
- winid get window id (if opened)
+ title get the list title
+ winid get the |window-ID| (if opened)
all all of the above quickfix properties
Non-string items in {what} are ignored.
If "nr" is not present then the current quickfix list is used.
@@ -4256,7 +4269,7 @@ getqflist([{what}]) *getqflist()*
The returned dictionary contains the following entries:
nr quickfix list number
title quickfix list title text
- winid quickfix window id (if opened)
+ winid quickfix |window-ID| (if opened)
Examples: >
:echo getqflist({'all': 1})
@@ -4267,7 +4280,7 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()*
The result is a String, which is the contents of register
{regname}. Example: >
:let cliptext = getreg('*')
-< When {regname} was not set the result is a empty string.
+< When {regname} was not set the result is an empty string.
getreg('=') returns the last evaluated value of the expression
register. (For use in maps.)
@@ -4303,10 +4316,10 @@ gettabinfo([{arg}]) *gettabinfo()*
empty List is returned.
Each List item is a Dictionary with the following entries:
- nr tab page number.
+ tabnr tab page number.
variables a reference to the dictionary with
tabpage-local variables
- windows List of window IDs in the tag page.
+ windows List of |window-ID|s in the tag page.
gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
Get the value of a tab-local variable {varname} in tab page
@@ -4330,7 +4343,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Note that {varname} must be the name without "w:".
Tabs are numbered starting with one. For the current tabpage
use |getwinvar()|.
- {winnr} can be the window number or the window ID.
+ {winnr} can be the window number or the |window-ID|.
When {winnr} is zero the current window is used.
This also works for a global option, buffer-local option and
window-local option, but it doesn't work for a global variable
@@ -4358,20 +4371,20 @@ getwininfo([{winid}]) *getwininfo()*
is returned. If the window does not exist the result is an
empty list.
- Without an information about all the windows in all the tab
- pages is returned.
+ Without {winid} information about all the windows in all the
+ tab pages is returned.
Each List item is a Dictionary with the following entries:
- bufnum number of buffer in the window
+ bufnr number of buffer in the window
height window height
loclist 1 if showing a location list
- nr window number
quickfix 1 if quickfix or location list window
- tpnr tab page number
+ tabnr tab page number
variables a reference to the dictionary with
window-local variables
width window width
- winid window ID
+ winid |window-ID|
+ winnr window number
To obtain all window-local variables use: >
gettabwinvar({tabnr}, {winnr}, '&')
@@ -4475,9 +4488,8 @@ has_key({dict}, {key}) *has_key()*
an entry with key {key}. Zero otherwise.
haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()*
- The result is a Number, which is 1 when the specified tabpage
- or window has a local path set via |:lcd| or |:tcd|, and
- 0 otherwise.
+ The result is a Number, which is 1 when the tabpage or window
+ has set a local path via |:tcd| or |:lcd|, otherwise 0.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
@@ -4485,7 +4497,9 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()*
haslocaldir()
haslocaldir(0)
haslocaldir(0, 0)
-< {winnr} can be the window number or the window ID.
+< With {winnr} use that window in the current tabpage.
+ With {winnr} and {tabnr} use the window in that tabpage.
+ {winnr} can be the window number or the |window-ID|.
If {winnr} is -1 it is ignored, only the tab is resolved.
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
@@ -4847,16 +4861,18 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()*
Spawns {cmd} as a job. If {cmd} is a |List| it is run
directly. If {cmd} is a |String| it is processed like this: >
:call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'])
-< NOTE: This only shows the idea; see |shell-unquoting| before
- constructing lists with 'shell' or 'shellcmdflag'.
-
- NOTE: On Windows if {cmd} is a List, cmd[0] must be a valid
- executable (.exe, .com). If the executable is in $PATH it can
- be called by name, with or without an extension: >
- :call jobstart(['ping', 'neovim.io'])
-< If it is a path (not a name), it must include the extension: >
- :call jobstart(['System32\ping.exe', 'neovim.io'])
-<
+< (Only shows the idea; see |shell-unquoting| for full details.)
+
+ NOTE: on Windows if {cmd} is a List:
+ - cmd[0] must be an executable (not a "built-in"). If it is
+ in $PATH it can be called by name, without an extension: >
+ :call jobstart(['ping', 'neovim.io'])
+< If it is a full or partial path, extension is required: >
+ :call jobstart(['System32\ping.exe', 'neovim.io'])
+< - {cmd} is collapsed to a string of quoted args as expected
+ by CommandLineToArgvW https://msdn.microsoft.com/bb776391
+ unless cmd[0] is some form of "cmd.exe".
+
{opts} is a dictionary with these keys:
on_stdout: stdout event handler (function name or |Funcref|)
on_stderr: stderr event handler (function name or |Funcref|)
@@ -4944,8 +4960,8 @@ json_decode({expr}) *json_decode()*
json_encode({expr}) *json_encode()*
Convert {expr} into a JSON string. Accepts
- |msgpack-special-dict| as the input. Will not convert |Funcref|s,
- mappings with non-string keys (can be created as
+ |msgpack-special-dict| as the input. Will not convert
+ |Funcref|s, mappings with non-string keys (can be created as
|msgpack-special-dict|), values with self-referencing
containers, strings which contain non-UTF-8 characters,
pseudo-UTF-8 strings which contain codepoints reserved for
@@ -5330,7 +5346,8 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
available from |getmatches()|. All matches can be deleted in
one operation by |clearmatches()|.
-matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) *matchaddpos()*
+ *matchaddpos()*
+matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]])
Same as |matchadd()|, but requires a list of positions {pos}
instead of a pattern. This command is faster than |matchadd()|
because it does not require to handle regular expressions and
@@ -5800,6 +5817,9 @@ printf({fmt}, {expr1} ...) *printf()*
s The text of the String argument is used. If a
precision is specified, no more bytes than the number
specified are used.
+ If the argument is not a String type, it is
+ automatically converted to text with the same format
+ as ":echo".
*printf-S*
S The text of the String argument is used. If a
precision is specified, no more display cells than the
@@ -6523,7 +6543,7 @@ setline({lnum}, {text}) *setline()*
setloclist({nr}, {list} [, {action}[, {what}]]) *setloclist()*
Create or replace or add to the location list for window {nr}.
- {nr} can be the window number or the window ID.
+ {nr} can be the window number or the |window-ID|.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
@@ -6715,7 +6735,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
{val}.
Tabs are numbered starting with one. For the current tabpage
use |setwinvar()|.
- {winnr} can be the window number or the window ID.
+ {winnr} can be the window number or the |window-ID|.
When {winnr} is zero the current window is used.
This also works for a global or local buffer option, but it
doesn't work for a global or local buffer variable.
@@ -7166,7 +7186,7 @@ strwidth({expr}) *strwidth()*
Ambiguous, this function's return value depends on 'ambiwidth'.
Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
-submatch({nr}[, {list}]) *submatch()*
+submatch({nr}[, {list}]) *submatch()* *E935*
Only for an expression in a |:substitute| command or
substitute() function.
Returns the {nr}'th submatch of the matched text. When {nr}
@@ -7390,7 +7410,7 @@ systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()*
tabpagebuflist([{arg}]) *tabpagebuflist()*
The result is a |List|, where each item is the number of the
buffer associated with each window in the current tab page.
- {arg} specifies the number of tab page to be used. When
+ {arg} specifies the number of the tab page to be used. When
omitted the current tab page is used.
When {arg} is invalid the number zero is returned.
To get a list of all buffers in all tabs use this: >
@@ -7427,8 +7447,13 @@ tagfiles() Returns a |List| with the file names used to search for tags
for the current buffer. This is the 'tags' option expanded.
-taglist({expr}) *taglist()*
+taglist({expr}[, {filename}]) *taglist()*
Returns a list of tags matching the regular expression {expr}.
+
+ If {filename} is passed it is used to prioritize the results
+ in the same way that |:tselect| does. See |tag-priority|.
+ {filename} should be the full path of the file.
+
Each list item is a dictionary with at least the following
entries:
name Name of the tag.
@@ -7516,7 +7541,36 @@ tanh({expr}) *tanh()*
< -0.761594
- *timer_start()*
+ *timer_info()*
+timer_info([{id}])
+ Return a list with information about timers.
+ When {id} is given only information about this timer is
+ returned. When timer {id} does not exist an empty list is
+ returned.
+ When {id} is omitted information about all timers is returned.
+
+ For each timer the information is stored in a Dictionary with
+ these items:
+ "id" the timer ID
+ "time" time the timer was started with
+ "repeat" number of times the timer will still fire;
+ -1 means forever
+ "callback" the callback
+
+timer_pause({timer}, {paused}) *timer_pause()*
+ Pause or unpause a timer. A paused timer does not invoke its
+ callback when its time expires. Unpausing a timer may cause
+ the callback to be invoked almost immediately if enough time
+ has passed.
+
+ Pausing a timer is useful to avoid the callback to be called
+ for a short time.
+
+ If {paused} evaluates to a non-zero Number or a non-empty
+ String, then the timer is paused, otherwise it is unpaused.
+ See |non-zero-arg|.
+
+ *timer_start()* *timer* *timers*
timer_start({time}, {callback} [, {options}])
Create a timer and return the timer ID.
@@ -7545,7 +7599,12 @@ timer_start({time}, {callback} [, {options}])
timer_stop({timer}) *timer_stop()*
Stop a timer. The timer callback will no longer be invoked.
{timer} is an ID returned by timer_start(), thus it must be a
- Number.
+ Number. If {timer} does not exist there is no error.
+
+timer_stopall() *timer_stopall()*
+ Stop all timers. The timer callbacks will no longer be
+ invoked. Useful if some timers is misbehaving. If there are
+ no timers there is no error.
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
@@ -7747,11 +7806,11 @@ wildmenumode() *wildmenumode()*
win_findbuf({bufnr}) *win_findbuf()*
- Returns a list with window IDs for windows that contain buffer
- {bufnr}. When there is none the list is empty.
+ Returns a list with |window-ID|s for windows that contain
+ buffer {bufnr}. When there is none the list is empty.
win_getid([{win} [, {tab}]]) *win_getid()*
- Get the window ID for the specified window.
+ Get the |window-ID| for the specified window.
When {win} is missing use the current window.
With {win} this is the window number. The top window has
number 1.
@@ -7776,7 +7835,7 @@ win_id2win({expr}) *win_id2win()*
*winbufnr()*
winbufnr({nr}) The result is a Number, which is the number of the buffer
associated with window {nr}. {nr} can be the window number or
- the window ID.
+ the |window-ID|.
When {nr} is zero, the number of the buffer in the current
window is returned.
When window {nr} doesn't exist, -1 is returned.
@@ -7790,7 +7849,7 @@ wincol() The result is a Number, which is the virtual column of the
winheight({nr}) *winheight()*
The result is a Number, which is the height of window {nr}.
- {nr} can be the window number or the window ID.
+ {nr} can be the window number or the |window-ID|.
When {nr} is zero, the height of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a height of zero or more.
@@ -7870,7 +7929,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore
winwidth({nr}) *winwidth()*
The result is a Number, which is the width of window {nr}.
- {nr} can be the window number or the window ID.
+ {nr} can be the window number or the |window-ID|.
When {nr} is zero, the width of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a width of zero or more.
@@ -7915,6 +7974,12 @@ writefile({list}, {fname} [, {flags}])
appended to the file: >
:call writefile(["foo"], "event.log", "a")
:call writefile(["bar"], "event.log", "a")
+<
+ When {flags} contains "S" fsync() call is not used, with "s"
+ it is used, 'fsync' option applies by default. No fsync()
+ means that writefile() will finish faster, but writes may be
+ left in OS buffers and not yet written to disk. Such changes
+ will disappear if system crashes before OS does writing.
All NL characters are replaced with a NUL character.
Inserting CR characters needs to be done before passing {list}
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index 12b86e5d73..4b89cd0d35 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -83,28 +83,6 @@ Recommended place for your personal GUI initializations:
The personal initialization files are searched in the order specified above
and only the first one that is found is read.
-There are a number of options which only have meaning in the GUI version of
-Vim. These are 'guicursor', 'guifont', and 'guioptions'. They are
-documented in |options.txt| with all the other options.
-
-Another way to set the colors for different occasions is with highlight
-groups. The "Normal" group is used to set the background and foreground
-colors. Example (which looks nice): >
-
- :highlight Normal guibg=grey90
-
-The "guibg" and "guifg" settings override the normal background and
-foreground settings. The other settings for the Normal highlight group are
-not used. Use the 'guifont' option to set the font.
-
-Also check out the 'guicursor' option, to set the colors for the cursor in
-various modes.
-
-Vim tries to make the window fit on the screen when it starts up. This avoids
-that you can't see part of it. On the X Window System this requires a bit of
-guesswork. You can change the height that is used for the window title and a
-task bar with the 'guiheadroom' option.
-
*:winp* *:winpos* *E188*
:winp[os]
Display current position of the top left corner of the GUI vim
@@ -124,21 +102,6 @@ task bar with the 'guiheadroom' option.
:win[size] {width} {height}
Set the window height to {width} by {height} characters.
Obsolete, use ":set lines=11 columns=22".
- If you get less lines than expected, check the 'guiheadroom'
- option.
-
-If you are running the X Window System, you can get information about the
-window Vim is running in with these commands: >
- :!xwininfo -id $WINDOWID
- :!xprop -id $WINDOWID
- :execute '!xwininfo -id ' . v:windowid
- :execute '!xprop -id ' . v:windowid
-<
- *gui-IME* *iBus*
-Input methods for international characters in X that rely on the XIM
-framework, most notably iBus, have been known to produce undesirable results
-in gVim. These may include an inability to enter spaces, or long delays
-between typing a character and it being recognized by the application.
==============================================================================
2. Scrollbars *gui-scrollbars*
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index bab15bcbb6..0dc8fff975 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1202,7 +1202,7 @@ tag command action ~
|:display| :di[splay] display registers
|:djump| :dj[ump] jump to #define
|:dl| :dl short for |:delete| with the 'l' flag
-|:dl| :del[ete]l short for |:delete| with the 'l' flag
+|:del| :del[ete]l short for |:delete| with the 'l' flag
|:dlist| :dli[st] list #defines
|:doautocmd| :do[autocmd] apply autocommands to current buffer
|:doautoall| :doautoa[ll] apply autocommands for all loaded buffers
@@ -1234,6 +1234,7 @@ tag command action ~
|:file| :f[ile] show or set the current file name
|:files| :files list all files in the buffer list
|:filetype| :filet[ype] switch file type detection on/off
+|:filter| :filt[er] filter output of following command
|:find| :fin[d] find file in 'path' and edit it
|:finally| :fina[lly] part of a :try command
|:finish| :fini[sh] quit sourcing a Vim script
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index db349eca71..3ba1ce1f17 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -720,9 +720,6 @@ special key: >
Don't type a real <Esc>, Vim will recognize the key code and replace it with
<F1> anyway.
-Another problem may be that when keeping ALT or Meta pressed the terminal
-prepends ESC instead of setting the 8th bit. See |:map-alt-keys|.
-
*recursive_mapping*
If you include the {lhs} in the {rhs} you have a recursive mapping. When
{lhs} is typed, it will be replaced with {rhs}. When the {lhs} which is
@@ -762,46 +759,14 @@ in the original Vi, you would get back the text before the first undo).
1.10 MAPPING ALT-KEYS *:map-alt-keys*
-In the GUI Vim handles the Alt key itself, thus mapping keys with ALT should
-always work. But in a terminal Vim gets a sequence of bytes and has to figure
-out whether ALT was pressed or not.
-
-By default Vim assumes that pressing the ALT key sets the 8th bit of a typed
-character. Most decent terminals can work that way, such as xterm, aterm and
-rxvt. If your <A-k> mappings don't work it might be that the terminal is
-prefixing the character with an ESC character. But you can just as well type
-ESC before a character, thus Vim doesn't know what happened (except for
-checking the delay between characters, which is not reliable).
-
-As of this writing, some mainstream terminals like gnome-terminal and konsole
-use the ESC prefix. There doesn't appear a way to have them use the 8th bit
-instead. Xterm should work well by default. Aterm and rxvt should work well
-when started with the "--meta8" argument. You can also tweak resources like
-"metaSendsEscape", "eightBitInput" and "eightBitOutput".
-
-On the Linux console, this behavior can be toggled with the "setmetamode"
-command. Bear in mind that not using an ESC prefix could get you in trouble
-with other programs. You should make sure that bash has the "convert-meta"
-option set to "on" in order for your Meta keybindings to still work on it
-(it's the default readline behavior, unless changed by specific system
-configuration). For that, you can add the line: >
-
- set convert-meta on
-
-to your ~/.inputrc file. If you're creating the file, you might want to use: >
-
- $include /etc/inputrc
-
-as the first line, if that file exists on your system, to keep global options.
-This may cause a problem for entering special characters, such as the umlaut.
-Then you should use CTRL-V before that character.
-
-Bear in mind that convert-meta has been reported to have troubles when used in
-UTF-8 locales. On terminals like xterm, the "metaSendsEscape" resource can be
-toggled on the fly through the "Main Options" menu, by pressing Ctrl-LeftClick
-on the terminal; that's a good last resource in case you want to send ESC when
-using other applications but not when inside VIM.
-
+In the GUI Nvim handles the |ALT| key itself, thus mapping keys with ALT
+should always work. But in a terminal Nvim gets a sequence of bytes and has
+to figure out whether ALT was pressed. Terminals may use ESC to indicate that
+ALT was pressed. If ESC is followed by a {key} within 'ttimeoutlen'
+milliseconds, the ESC is interpreted as:
+ <ALT-{key}>
+otherwise it is interpreted as two key presses:
+ <ESC> {key}
1.11 MAPPING AN OPERATOR *:map-operator*
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt
index 02086e24fd..77cbc2f3d8 100644
--- a/runtime/doc/msgpack_rpc.txt
+++ b/runtime/doc/msgpack_rpc.txt
@@ -250,35 +250,37 @@ connect to another with different type codes.
==============================================================================
6. Remote UIs *rpc-remote-ui*
-Nvim allows Graphical user interfaces to be implemented by separate processes
-communicating with Nvim over the RPC API. Currently the ui model conists of a
-terminal-like grid with one single, monospace font size, with a few elements
-that could be drawn separately from the grid (for the momemnt only the popup
-menu)
-
-After connecting to a nvim instance (typically a spawned, embedded instance)
-use the |nvim_ui_attach|(width, height, options) API method to tell nvim that your
-program wants to draw the nvim screen on a grid with "width" times
-"height" cells. "options" should be a dictionary with the following (all
-optional) keys:
- `rgb`: Controls what color format to use.
+GUIs can be implemented as external processes communicating with Nvim over the
+RPC API. Currently the UI model consists of a terminal-like grid with one
+single, monospace font size. Some elements (UI "widgets") can be drawn
+separately from the grid.
+
+After connecting to Nvim (usually a spawned, embedded instance) use the
+|nvim_ui_attach| API method to tell Nvim that your program wants to draw the
+Nvim screen on a grid of width × height cells. `options` must be
+a dictionary with these (optional) keys:
+ `rgb` Controls what color format to use.
Set to true (default) to use 24-bit rgb
colors.
Set to false to use terminal color codes (at
most 256 different colors).
- `popupmenu_external`: Instead of drawing the completion popupmenu on
+ `popupmenu_external` Instead of drawing the completion popupmenu on
the grid, Nvim will send higher-level events to
the ui and let it draw the popupmenu.
Defaults to false.
Nvim will then send msgpack-rpc notifications, with the method name "redraw"
-and a single argument, an array of screen updates (described below).
-These should be processed in order. Preferably the user should only be able to
-see the screen state after all updates are processed (not any intermediate
-state after processing only a part of the array).
+and a single argument, an array of screen updates (described below). These
+should be processed in order. Preferably the user should only be able to see
+the screen state after all updates in the same "redraw" event are processed
+(not any intermediate state after processing only a part of the array).
-Screen updates are arrays. The first element a string describing the kind
-of update.
+Future versions of Nvim may add new update kinds and may append new parameters
+to existing update kinds. Clients must be prepared to ignore such extensions
+to be forward-compatible. |api-contract|
+
+Screen updates are tuples whose first element is the string name of the update
+kind.
["resize", width, height]
The grid is resized to `width` and `height` cells.
@@ -389,10 +391,31 @@ of update.
["update_menu"]
The menu mappings changed.
-["mode_change", mode]
- The mode changed. Currently sent when "insert", "replace", "cmdline" and
- "normal" modes are entered. A client could for instance change the cursor
- shape.
+["mode_info_set", cursor_style_enabled, mode_info]
+`cursor_style_enabled` is a boolean indicating if the UI should set the cursor
+style. `mode_info` is a list of mode property maps. The current mode is given
+by the `mode_idx` field of the `mode_change` event.
+
+Each mode property map may contain these keys:
+ KEY DESCRIPTION ~
+ `cursor_shape`: "block", "horizontal", "vertical"
+ `cell_percentage`: Cell % occupied by the cursor.
+ `blinkwait`, `blinkon`, `blinkoff`: See |cursor-blinking|.
+ `hl_id`: Cursor highlight group.
+ `hl_lm`: Cursor highlight group if 'langmap' is active.
+ `short_name`: Mode code name, see 'guicursor'.
+ `name`: Mode descriptive name.
+ `mouse_shape`: (To be implemented.)
+
+Some keys are missing in some modes.
+
+["mode_change", mode, mode_idx]
+The mode changed. The first parameter `mode` is a string representing the
+current mode. `mode_idx` is an index into the array received in the
+`mode_info_set` event. UIs should change the cursor style according to the
+properties specified in the corresponding item. The set of modes reported will
+change in new versions of Nvim, for instance more submodes and temporary
+states might be represented as separate modes.
["popupmenu_show", items, selected, row, col]
When `popupmenu_external` is set to true, nvim will not draw the
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index c31ebf4ebc..6b96271c4a 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2740,6 +2740,9 @@ A jump table for the options with a short description can be found at |Q_op|.
mode, so it may be undesirable in some situations. Be warned that
turning this off increases the chances of data loss after a crash.
+ Currently applies only to writing the buffer with e.g. |:w| and
+ |writefile()|.
+
*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
'gdefault' 'gd' boolean (default off)
global
@@ -2762,8 +2765,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'grepprg'* *'gp'*
'grepprg' 'gp' string (default "grep -n ",
- Unix: "grep -n $* /dev/null",
- Win32: "findstr /n" or "grep -n")
+ Unix: "grep -n $* /dev/null")
global or local to buffer |global-local|
Program to use for the |:grep| command. This option may contain '%'
and '#' characters, which are expanded like when used in a command-
@@ -2778,8 +2780,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|.
See also the section |:make_makeprg|, since most of the comments there
apply equally to 'grepprg'.
- For Win32, the default is "findstr /n" if "findstr.exe" can be found,
- otherwise it's "grep -n".
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -2790,21 +2790,17 @@ A jump table for the options with a short description can be found at |Q_op|.
i-ci:ver25-Cursor/lCursor,
r-cr:hor20-Cursor/lCursor,
sm:block-Cursor
- -blinkwait175-blinkoff150-blinkon175",
- for Windows console:
- "n-v-c:block,o:hor50,i-ci:hor15,
- r-cr:hor30,sm:block")
- global
- {only available when compiled with GUI enabled, and
- for Windows console}
- This option tells Vim what the cursor should look like in different
- modes. It fully works in the GUI. In a Windows console, only
- the height of the cursor can be changed. This can be done by
- specifying a block cursor, or a percentage for a vertical or
- horizontal cursor.
- For a console the 't_SI' and 't_EI' escape sequences are used.
-
- The option is a comma separated list of parts. Each part consist of a
+ -blinkwait175-blinkoff150-blinkon175")
+ global
+ Configures the cursor style for each mode. Works in the GUI and some
+ terminals. Unset to disable: >
+ :set guicursor=
+<
+ With tmux you might need this in ~/.tmux.conf (see terminal-overrides
+ in the tmux(1) manual page): >
+ set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
+<
+ The option is a comma separated list of parts. Each part consists of a
mode-list and an argument-list:
mode-list:argument-list,mode-list:argument-list,..
The mode-list is a dash separated list of these modes:
@@ -2977,18 +2973,6 @@ A jump table for the options with a short description can be found at |Q_op|.
If set and valid, 'guifontwide' is used for IME instead of 'guifont'.
- *'guiheadroom'* *'ghr'*
-'guiheadroom' 'ghr' number (default 50)
- global
- {only for X11 GUI}
- The number of pixels subtracted from the screen height when fitting
- the GUI window on the screen. Set this before the GUI is started,
- e.g., in your |gvimrc| file. When zero, the whole screen height will
- be used by the window. When positive, the specified number of pixel
- lines will be left for window decorations and other items on the
- screen. Set it to a negative value to allow windows taller than the
- screen.
-
*'guioptions'* *'go'*
'guioptions' 'go' string (default "egmrLT" (MS-Windows))
global
@@ -3172,29 +3156,17 @@ A jump table for the options with a short description can be found at |Q_op|.
Think twice when using ":q!" or ":qa!".
*'highlight'* *'hl'*
-'highlight' 'hl' string (default (as a single string):
- "8:SpecialKey,~:EndOfBuffer,z:TermCursor,
- Z:TermCursorNC,@:NonText,d:Directory,
- e:ErrorMsg,i:IncSearch,l:Search,
- m:MoreMsg,M:ModeMsg,n:LineNr,
- N:CursorLineNr,r:Question,s:StatusLine,
- S:StatusLineNC,c:VertSplit,t:Title,
- v:Visual,w:WarningMsg,W:WildMenu,
- f:Folded,F:FoldColumn,A:DiffAdd,
- C:DiffChange,D:DiffDelete,T:DiffText,
- >:SignColumn,B:SpellBad,P:SpellCap,
- R:SpellRare,L:SpellLocal,-:Conceal,
- +:Pmenu,=:PmenuSel,x:PmenuSbar,
- X:PmenuThumb")
+'highlight' 'hl' string (default: string of "c:group,..." pairs)
global
This option can be used to set highlighting mode for various
occasions. It is a comma separated list of character pairs. The
first character in a pair gives the occasion, the second the mode to
use for that occasion. The occasions are:
|hl-SpecialKey| 8 Meta and special keys listed with ":map"
- |hl-EndOfBuffer| ~ lines after the last line in the buffer
+ |hl-Whitespace| 0
+ |hl-EndOfBuffer| ~ lines after the last line in the buffer
|hl-TermCursor| z Cursor in a focused terminal
- |hl-TermCursorNC| Z Cursor in an unfocused terminal
+ |hl-TermCursorNC| Z Cursor in an unfocused terminal
|hl-NonText| @ '@' at the end of the window and
characters from 'showbreak'
|hl-Directory| d directories in CTRL-D listing and other special
@@ -3206,11 +3178,11 @@ A jump table for the options with a short description can be found at |Q_op|.
|hl-ModeMsg| M Mode (e.g., "-- INSERT --")
|hl-LineNr| n line number for ":number" and ":#" commands, and
when 'number' or 'relativenumber' option is set.
- |hl-CursorLineNr| N like n for when 'cursorline' or 'relativenumber' is
+ |hl-CursorLineNr| N like n for when 'cursorline' or 'relativenumber' is
set.
|hl-Question| r |hit-enter| prompt and yes/no questions
|hl-StatusLine| s status line of current window |status-line|
- |hl-StatusLineNC| S status lines of not-current windows
+ |hl-StatusLineNC| S status lines of not-current windows
|hl-Title| t Titles for output from ":set all", ":autocmd" etc.
|hl-VertSplit| c column used to separate vertically split windows
|hl-Visual| v Visual mode
@@ -3234,6 +3206,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|hl-PmenuSbar| x popup menu scrollbar
|hl-PmenuThumb| X popup menu scrollbar thumb
+ |hl-TabLine| *
+ |hl-TabLineFill| _
+ |hl-TabLineSel| #
+
+ |hl-ColorColumn| o
+ |hl-CursorColumn| !
+ |hl-CursorLine| .
+ |hl-QuickFixLine| q
+
The display modes are:
r reverse (termcap entry "mr" and "me")
i italic (termcap entry "ZH" and "ZR")
@@ -3518,7 +3499,7 @@ A jump table for the options with a short description can be found at |Q_op|.
if you want to use Vim as a modeless editor.
These Insert mode commands will be useful:
- Use the cursor keys to move around.
- - Use CTRL-O to execute one Normal mode command |i_CTRL-O|). When
+ - Use CTRL-O to execute one Normal mode command |i_CTRL-O|. When
this is a mapping, it is executed as if 'insertmode' was off.
Normal mode remains active until the mapping is finished.
- Use CTRL-L to execute a number of Normal mode commands, then use
@@ -3708,6 +3689,8 @@ A jump table for the options with a short description can be found at |Q_op|.
be able to execute Normal mode commands.
This is the opposite of the 'keymap' option, where characters are
mapped in Insert mode.
+ Also consider resetting 'langremap' to avoid 'langmap' applies to
+ characters resulting from a mapping.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -3762,12 +3745,12 @@ A jump table for the options with a short description can be found at |Q_op|.
:source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself!
- *'langnoremap'* *'lnr'*
-'langnoremap' 'lnr' boolean (default on)
+ *'langremap'* *'lrm'* *'nolangremap'* *'nolrm'*
+'langremap' 'lrm' boolean (default off)
global
- When on, setting 'langmap' does not apply to characters resulting from
+ When off, setting 'langmap' does not apply to characters resulting from
a mapping. If setting 'langmap' disables some of your mappings, make
- sure this option is set.
+ sure this option is off.
*'laststatus'* *'ls'*
'laststatus' 'ls' number (default 2)
@@ -3816,9 +3799,6 @@ A jump table for the options with a short description can be found at |Q_op|.
use this command to get the tallest window possible: >
:set lines=999
< Minimum value is 2, maximum value is 1000.
- If you get less lines than expected, check the 'guiheadroom' option.
- When you set this option and Vim is unable to change the physical
- number of lines of the display, the display may be messed up.
*'linespace'* *'lsp'*
'linespace' 'lsp' number (default 0, 1 for Win32 GUI)
@@ -3918,9 +3898,8 @@ A jump table for the options with a short description can be found at |Q_op|.
:set lcs=tab:>-,trail:-
:set lcs=tab:>-,eol:<,nbsp:%
:set lcs=extends:>,precedes:<
-< The "NonText" highlighting will be used for "eol", "extends" and
- "precedes". "SpecialKey" for "nbsp", "space", "tab" and "trail".
- |hl-NonText| |hl-SpecialKey|
+< |hl-NonText| highlighting will be used for "eol", "extends" and
+ "precedes". |hl-Whitespace| for "nbsp", "space", "tab" and "trail".
*'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'*
'loadplugins' 'lpl' boolean (default on)
@@ -5048,6 +5027,8 @@ A jump table for the options with a short description can be found at |Q_op|.
"inclusive" means that the last character of the selection is included
in an operation. For example, when "x" is used to delete the
selection.
+ When "old" is used and 'virtualedit' allows the cursor to move past
+ the end of line the line break still isn't included.
Note that when "exclusive" is used and selecting from the end
backwards, you cannot include the last character of a line, when
starting in Normal mode and 'virtualedit' empty.
@@ -5171,8 +5152,8 @@ A jump table for the options with a short description can be found at |Q_op|.
saved. When not included, the value of 'history' is used.
*shada-c*
c Dummy option, kept for compatibility reasons. Has no actual
- effect. Current encoding state is described in
- |shada-encoding|.
+ effect: ShaDa always uses UTF-8 and 'encoding' value is fixed
+ to UTF-8 as well.
*shada-f*
f Whether file marks need to be stored. If zero, file marks ('0
to '9, 'A to 'Z) are not stored. When not present or when
@@ -5271,9 +5252,7 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons.
*'shellcmdflag'* *'shcf'*
-'shellcmdflag' 'shcf' string (default: "-c";
- Windows, when 'shell' does not
- contain "sh" somewhere: "/c")
+'shellcmdflag' 'shcf' string (default: "-c"; Windows: "/c")
global
Flag passed to the shell to execute "!" and ":!" commands; e.g.,
"bash.exe -c ls" or "cmd.exe /c dir". For Windows
@@ -5284,15 +5263,12 @@ A jump table for the options with a short description can be found at |Q_op|.
See |option-backslash| about including spaces and backslashes.
See |shell-unquoting| which talks about separating this option into
multiple arguments.
- Also see |dos-shell| for Windows.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'shellpipe'* *'sp'*
'shellpipe' 'sp' string (default ">", "| tee", "|& tee" or "2>&1| tee")
global
- {not available when compiled without the |+quickfix|
- feature}
String to be used to put the output of the ":make" command in the
error file. See also |:make_makeprg|. See |option-backslash| about
including spaces and backslashes.
@@ -5334,7 +5310,7 @@ A jump table for the options with a short description can be found at |Q_op|.
third-party shells on Windows systems, such as the MKS Korn Shell
or bash, where it should be "\"". The default is adjusted according
the value of 'shell', to reduce the need to set this option by the
- user. See |dos-shell|.
+ user.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -5366,7 +5342,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'shellslash'* *'ssl'* *'noshellslash'* *'nossl'*
'shellslash' 'ssl' boolean (default off)
global
- {only for MSDOS and MS-Windows}
+ {only for Windows}
When set, a forward slash is used when expanding file names. This is
useful when a Unix-like shell is used instead of command.com or
cmd.exe. Backward slashes can still be typed, but they are changed to
@@ -5383,10 +5359,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When on, use temp files for shell commands. When off use a pipe.
When using a pipe is not possible temp files are used anyway.
- Currently a pipe is only supported on Unix and MS-Windows 2K and
- later. You can check it with: >
- :if has("filterpipe")
-< The advantage of using a pipe is that nobody can read the temp file
+ The advantage of using a pipe is that nobody can read the temp file
and the 'shell' command does not need to support redirection.
The advantage of using a temp file is that the file type and encoding
can be detected.
@@ -5396,19 +5369,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|system()| does not respect this option, it always uses pipes.
*'shellxescape'* *'sxe'*
-'shellxescape' 'sxe' string (default: "";
- for Windows: "\"&|<>()@^")
+'shellxescape' 'sxe' string (default: "")
global
When 'shellxquote' is set to "(" then the characters listed in this
option will be escaped with a '^' character. This makes it possible
to execute most external commands with cmd.exe.
*'shellxquote'* *'sxq'*
-'shellxquote' 'sxq' string (default: "";
- for Win32, when 'shell' is cmd.exe: "("
- for Win32, when 'shell' contains "sh"
- somewhere: "\""
- for Unix, when using system(): "\"")
+'shellxquote' 'sxq' string (default: "")
global
Quoting character(s), put around the command passed to the shell, for
the "!" and ":!" commands. Includes the redirection. See
@@ -5417,12 +5385,6 @@ A jump table for the options with a short description can be found at |Q_op|.
When the value is '(' then ')' is appended. When the value is '"('
then ')"' is appended.
When the value is '(' then also see 'shellxescape'.
- This is an empty string by default on most systems, but is known to be
- useful for on Win32 version, either for cmd.exe which automatically
- strips off the first and last quote on a command, or 3rd-party shells
- such as the MKS Korn Shell or bash, where it should be "\"". The
- default is adjusted according the value of 'shell', to reduce the need
- to set this option by the user. See |dos-shell|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -6433,8 +6395,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'title'* *'notitle'*
'title' boolean (default off, on when title can be restored)
global
- {not available when compiled without the |+title|
- feature}
When on, the title of the window will be set to the value of
'titlestring' (if it is not empty), or to:
filename [+=-] (path) - VIM
@@ -6446,16 +6406,10 @@ A jump table for the options with a short description can be found at |Q_op|.
=+ indicates the file is read-only and modified
(path) is the path of the file being edited
- VIM the server name |v:servername| or "VIM"
- Only works if the terminal supports setting window titles
- (currently Win32 console, all GUI versions and terminals with a non-
- empty 't_ts' option - this is Unix xterm by default, where 't_ts' is
- taken from the builtin termcap).
*'titlelen'*
'titlelen' number (default 85)
global
- {not available when compiled without the |+title|
- feature}
Gives the percentage of 'columns' to use for the length of the window
title. When the title is longer, only the end of the path name is
shown. A '<' character before the path name is used to indicate this.
@@ -6469,8 +6423,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'titleold'*
'titleold' string (default "Thanks for flying Vim")
global
- {only available when compiled with the |+title|
- feature}
This option will be used for the window title when exiting Vim if the
original title cannot be restored. Only happens if 'title' is on or
'titlestring' is not empty.
@@ -6479,13 +6431,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'titlestring'*
'titlestring' string (default "")
global
- {not available when compiled without the |+title|
- feature}
When this option is not empty, it will be used for the title of the
window. This happens only when the 'title' option is on.
- Only works if the terminal supports setting window titles (currently
- Win32 console, all GUI versions and terminals with a non-empty 't_ts'
- option).
When this option contains printf-style '%' items, they will be
expanded according to the rules used for 'statusline'.
Example: >
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 7de0bba118..420f570c99 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -715,7 +715,6 @@ Short explanation of each option: *option-list*
'guifont' 'gfn' GUI: Name(s) of font(s) to be used
'guifontset' 'gfs' GUI: Names of multi-byte fonts to be used
'guifontwide' 'gfw' list of font names for double-wide characters
-'guiheadroom' 'ghr' GUI: pixels room for window decorations
'guioptions' 'go' GUI: Which components and options are used
'guitablabel' 'gtl' GUI: custom label for a tab page
'guitabtooltip' 'gtt' GUI: custom tooltip for a tab page
@@ -752,7 +751,7 @@ Short explanation of each option: *option-list*
'keywordprg' 'kp' program to use for the "K" command
'langmap' 'lmap' alphabetic characters for other language mode
'langmenu' 'lm' language to be used for the menus
-'langnoremap' 'lnr' do not apply 'langmap' to mapped characters
+'langremap' 'lrm' do apply 'langmap' to mapped characters
'laststatus' 'ls' tells when last window has status lines
'lazyredraw' 'lz' don't redraw while executing macros
'linebreak' 'lbr' wrap long lines at a blank
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index e5a6b0be39..466a030e0c 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -188,7 +188,9 @@ JUMPING TO A SIGN *:sign-jump* *E157*
If the file isn't displayed in window and the current file can
not be |abandon|ed this fails.
-:sign jump {id} buffer={nr}
- Same, but use buffer {nr}.
+:sign jump {id} buffer={nr} *E934*
+ Same, but use buffer {nr}. This fails if buffer {nr} does not
+ have a name.
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index daf6ad9ca2..14e8c5d76f 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -922,7 +922,7 @@ You might want to clean up your 'viewdir' directory now and then.
To automatically save and restore views for *.c files: >
au BufWinLeave *.c mkview
- au BufWinEnter *.c silent loadview
+ au BufWinEnter *.c silent! loadview
==============================================================================
8. The ShaDa file *shada* *shada-file*
@@ -1097,23 +1097,6 @@ SHADA FILE NAME *shada-file-name*
default and the name given with 'shada' or "-i" (unless it's NONE).
-CHARACTER ENCODING *shada-encoding*
-
-The text in the ShaDa file is UTF-8-encoded. Normally you will always work
-with the same 'encoding' value, and this works just fine. However, if you
-read the ShaDa file with value for 'encoding' different from utf-8 and
-'encoding' used when writing ShaDa file, some of the text (non-ASCII
-characters) may be invalid as Neovim always attempts to convert the text in
-the ShaDa file from the UTF-8 to the current 'encoding' value. Filenames are
-never converted, affected elements are:
-
-- history strings;
-- variable values;
-- register values;
-- last used search and substitute patterns;
-- last used substitute replacement string.
-
-
MANUALLY READING AND WRITING *shada-read-write*
Two commands can be used to read and write the ShaDa file manually. This
@@ -1221,8 +1204,11 @@ exactly four MessagePack objects:
3. Third goes the length of the fourth entry. Unsigned integer as well, used
for fast skipping without parsing.
4. Fourth is actual entry data. All currently used ShaDa entries use
- containers to hold data: either map or array. Exact format depends on the
- entry type:
+ containers to hold data: either map or array. All string values in those
+ containers are either binary (applies to filenames) or UTF-8, yet parser
+ needs to expect that invalid bytes may be present in a UTF-8 string.
+
+ Exact format depends on the entry type:
Entry type (name) Entry data ~
1 (Header) Map containing data that describes the generator
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index b0b4cabd65..3b54f9f268 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -3739,7 +3739,7 @@ Whether or not it is actually concealed depends on the value of the
'conceallevel' option. The 'concealcursor' option is used to decide whether
concealable items in the current line are displayed unconcealed to be able to
edit the line.
-Another way to conceal text with with |matchadd()|.
+Another way to conceal text is with |matchadd()|.
concealends *:syn-concealends*
@@ -4803,10 +4803,7 @@ guisp={color-name} *highlight-guisp*
Black White
Orange Purple Violet
- In the Win32 GUI version, additional system colors are available. See
- |win32-colors|.
-
- You can also specify a color by its Red, Green and Blue values.
+ You can also specify a color by its RGB (red, green, blue) values.
The format is "#rrggbb", where
"rr" is the Red value
"gg" is the Green value
@@ -4899,32 +4896,28 @@ PmenuThumb Popup menu: Thumb of the scrollbar.
*hl-Question*
Question |hit-enter| prompt and yes/no questions
*hl-QuickFixLine*
-QuickFixLine The selected |quickfix| item in the quickfix window.
- |hl-CursorLine| is combined with this when the cursor is on
- the currently selected quickfix item.
+QuickFixLine Current |quickfix| item in the quickfix window. Combined with
+ |hl-CursorLine| when the cursor is there.
*hl-Search*
Search Last search pattern highlighting (see 'hlsearch').
- Also used for highlighting the current line in the quickfix
- window and similar items that need to stand out.
+ Also used for similar items that need to stand out.
*hl-SpecialKey*
-SpecialKey Meta and special keys listed with ":map", also for text used
- to show unprintable characters in the text, 'listchars'.
- Generally: text that is displayed differently from what it
- really is.
+SpecialKey Unprintable characters: text displayed differently from what
+ it really is. But not 'listchars' whitespace. |hl-Whitespace|
*hl-SpellBad*
SpellBad Word that is not recognized by the spellchecker. |spell|
- This will be combined with the highlighting used otherwise.
+ Combined with the highlighting used otherwise.
*hl-SpellCap*
SpellCap Word that should start with a capital. |spell|
- This will be combined with the highlighting used otherwise.
+ Combined with the highlighting used otherwise.
*hl-SpellLocal*
SpellLocal Word that is recognized by the spellchecker as one that is
used in another region. |spell|
- This will be combined with the highlighting used otherwise.
+ Combined with the highlighting used otherwise.
*hl-SpellRare*
SpellRare Word that is recognized by the spellchecker as one that is
hardly ever used. |spell|
- This will be combined with the highlighting used otherwise.
+ Combined with the highlighting used otherwise.
*hl-StatusLine*
StatusLine status line of current window
*hl-StatusLineNC*
@@ -4943,6 +4936,8 @@ Title titles for output from ":set all", ":autocmd" etc.
Visual Visual mode selection
*hl-WarningMsg*
WarningMsg warning messages
+ *hl-Whitespace*
+Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
*hl-WildMenu*
WildMenu current match in 'wildmenu' completion
diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt
index 2c090a66fa..b47053e17b 100644
--- a/runtime/doc/tagsrch.txt
+++ b/runtime/doc/tagsrch.txt
@@ -90,7 +90,7 @@ The ignore-case matches are not found for a ":tag" command when:
- 'tagcase' is "followscs" and 'smartcase' option is on and the pattern
contains an upper case character.
-The gnore-case matches are found when:
+The ignore-case matches are found when:
- a pattern is used (starting with a "/")
- for ":tselect"
- when 'tagcase' is "followic" and 'ignorecase' is off
@@ -432,9 +432,9 @@ The next file in the list is not used when:
This also depends on whether case is ignored. Case is ignored when:
- 'tagcase' is "followic" and 'ignorecase' is set
- 'tagcase' is "ignore"
-- 'tagcase' is "smart" and and the pattern only contains lower case
+- 'tagcase' is "smart" and the pattern only contains lower case
characters.
-- 'tagcase' is "followscs" and 'smartcase' is set and and the pattern only
+- 'tagcase' is "followscs" and 'smartcase' is set and the pattern only
contains lower case characters.
If case is not ignored, and the tags file only has a match without matching
case, the next tags file is searched for a match with matching case. If no
@@ -803,24 +803,24 @@ CTRL-W d Open a new window, with the cursor on the first
*:search-args*
Common arguments for the commands above:
-[!] When included, find matches in lines that are recognized as comments.
- When excluded, a match is ignored when the line is recognized as a
- comment (according to 'comments'), or the match is in a C comment (after
- "//" or inside /* */). Note that a match may be missed if a line is
- recognized as a comment, but the comment ends halfway through the line.
- And if the line is a comment, but it is not recognized (according to
- 'comments') a match may be found in it anyway. Example: >
+[!] When included, find matches in lines that are recognized as comments.
+ When excluded, a match is ignored when the line is recognized as a
+ comment (according to 'comments'), or the match is in a C comment
+ (after "//" or inside /* */). Note that a match may be missed if a
+ line is recognized as a comment, but the comment ends halfway the line.
+ And if the line is a comment, but it is not recognized (according to
+ 'comments') a match may be found in it anyway. Example: >
/* comment
foobar */
-< A match for "foobar" is found, because this line is not recognized as a
- comment (even though syntax highlighting does recognize it).
- Note: Since a macro definition mostly doesn't look like a comment, the
- [!] makes no difference for ":dlist", ":dsearch" and ":djump".
-[/] A pattern can be surrounded by '/'. Without '/' only whole words are
- matched, using the pattern "\<pattern\>". Only after the second '/' a
- next command can be appended with '|'. Example: >
+< A match for "foobar" is found, because this line is not recognized as
+ a comment (even though syntax highlighting does recognize it).
+ Note: Since a macro definition mostly doesn't look like a comment, the
+ [!] makes no difference for ":dlist", ":dsearch" and ":djump".
+[/] A pattern can be surrounded by '/'. Without '/' only whole words are
+ matched, using the pattern "\<pattern\>". Only after the second '/' a
+ next command can be appended with '|'. Example: >
:isearch /string/ | echo "the last one"
-< For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern
- is used as a literal string, not as a search pattern.
+< For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern
+ is used as a literal string, not as a search pattern.
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt
index 1a108caeaf..1fbd96f749 100644
--- a/runtime/doc/vi_diff.txt
+++ b/runtime/doc/vi_diff.txt
@@ -60,7 +60,7 @@ Support for different systems.
- Windows (XP SP 2 or greater)
- OS X
-Multi level undo. |undo|
+Multi level persistent undo. |undo|
'u' goes backward in time, 'CTRL-R' goes forward again. Set option
'undolevels' to the number of changes to be remembered (default 1000).
Set 'undolevels' to 0 for a Vi-compatible one level undo. Set it to
@@ -71,6 +71,9 @@ Multi level undo. |undo|
create a branch in the undo tree. This means you can go back to any
state of the text, there is no risk of a change causing text to be
lost forever. |undo-tree|
+ The undo information is stored in a file when the 'undofile' option is
+ set. This means you can exit Vim, start Vim on a previously edited
+ file and undo changes that were made before exiting Vim.
Graphical User Interface (GUI). |gui|
Included support for GUI: menu's, mouse, scrollbars, etc. You can
@@ -124,6 +127,13 @@ Plugins. |add-plugin|
right directory. That's an easy way to start using Vim scripts
written by others. Plugins can be for all kind of files, or
specifically for a filetype.
+ Packages make this even easier. |packages|
+
+Asynchronous communication and timers. |job-control| |timer|
+ Vim can exchange messages with other processes in the background.
+ Vim can start a job, communicate with it and stop it. |job-control|
+ Timers can fire once or repeatedly and invoke a function to do any
+ work. |timer|
Repeat a series of commands. |q|
"q{c}" starts recording typed characters into named register {c}.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 11dde27868..c84cea2b55 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -45,7 +45,8 @@ these differences.
- 'history' defaults to 10000 (the maximum)
- 'hlsearch' is set by default
- 'incsearch' is set by default
-- 'langnoremap' is set by default
+- 'langnoremap' is enabled by default
+- 'langremap' is disabled by default
- 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'nocompatible' is always set
@@ -112,6 +113,7 @@ Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
Options:
'cpoptions' flags: |cpo-_|
+ 'guicursor' works in the terminal
'inccommand' shows interactive results for |:substitute|-like commands
'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click
@@ -145,6 +147,7 @@ Highlight groups:
|hl-Substitute|
|hl-TermCursor|
|hl-TermCursorNC|
+ |hl-Whitespace| highlights 'listchars' whitespace
==============================================================================
4. Changed features *nvim-features-changed*
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 4ed7b68194..fa7a7f2a81 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -69,7 +69,7 @@ places where a Normal mode command can't be used or is inconvenient.
The main Vim window can hold several split windows. There are also tab pages
|tab-page|, each of which can hold multiple windows.
-
+ *window-ID* *winid* *windowid*
Each window has a unique identifier called the window ID. This identifier
will not change within a Vim session. The |win_getid()| and |win_id2tabwin()|
functions can be used to convert between the window/tab number and the
@@ -1026,6 +1026,10 @@ list of buffers. |unlisted-buffer|
h+ hidden buffers which are modified
a+ active buffers which are modified
+ When using |:filter| the pattern is matched against the
+ displayed buffer name, e.g.: >
+ filter /\.vim/ ls
+<
*:bad* *:badd*
:bad[d] [+lnum] {fname}
Add file name {fname} to the buffer list, without loading it.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index f9d7f86a97..43155aa27e 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2016 Jul 21
+" Last Change: 2016 Aug 26
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -688,8 +688,8 @@ func! s:FTe()
let n = 1
while n < 100 && n < line("$")
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
- setf specman
- return
+ setf specman
+ return
endif
let n = n + 1
endwhile
@@ -775,8 +775,7 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom
" Git
-au BufNewFile,BufRead COMMIT_EDITMSG setf gitcommit
-au BufNewFile,BufRead MERGE_MSG setf gitcommit
+au BufNewFile,BufRead COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG setf gitcommit
au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig
au BufNewFile,BufRead *.git/modules/*/config setf gitconfig
au BufNewFile,BufRead */.config/git/config setf gitconfig
@@ -1777,6 +1776,9 @@ au BufNewFile,BufRead *.sass setf sass
" Sather
au BufNewFile,BufRead *.sa setf sather
+" Scala
+au BufNewFile,BufRead *.scala setf scala
+
" Scilab
au BufNewFile,BufRead *.sci,*.sce setf scilab
@@ -2049,7 +2051,7 @@ func! s:FTRules()
if line =~ s:ft_rules_udev_rules_pattern
let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "")
if dir == udev_rules
- setf udevrules
+ setf udevrules
endif
break
endif
@@ -2301,7 +2303,7 @@ au BufNewFile,BufRead */etc/updatedb.conf setf updatedb
au BufNewFile,BufRead */usr/share/upstart/*.conf setf upstart
au BufNewFile,BufRead */usr/share/upstart/*.override setf upstart
au BufNewFile,BufRead */etc/init/*.conf,*/etc/init/*.override setf upstart
-au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart
+au BufNewFile,BufRead */.init/*.conf,*/.init/*.override setf upstart
au BufNewFile,BufRead */.config/upstart/*.conf setf upstart
au BufNewFile,BufRead */.config/upstart/*.override setf upstart
diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim
index ec64a07675..8c092ac13f 100644
--- a/runtime/ftplugin/rmd.vim
+++ b/runtime/ftplugin/rmd.vim
@@ -1,9 +1,9 @@
" Vim filetype plugin file
-" Language: R help file
+" Language: R Markdown file
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Tue Apr 07, 2015 04:37PM
-" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
+" Last Change: Mon Jun 06, 2016 09:41PM
+" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@@ -12,6 +12,16 @@ endif
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
+" Nvim-R plugin needs this
+if exists("*CompleteR")
+ if &omnifunc == "CompleteR"
+ let b:rplugin_nonr_omnifunc = ""
+ else
+ let b:rplugin_nonr_omnifunc = &omnifunc
+ endif
+ set omnifunc=CompleteR
+endif
+
setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
setlocal formatoptions+=tcqln
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
diff --git a/runtime/ftplugin/scala.vim b/runtime/ftplugin/scala.vim
new file mode 100644
index 0000000000..e409950107
--- /dev/null
+++ b/runtime/ftplugin/scala.vim
@@ -0,0 +1,37 @@
+" Vim filetype plugin file
+" Language: Scala
+" Maintainer: Derek Wyatt
+" URL: https://github.com/derekwyatt/vim-scala
+" License: Same as Vim
+" Last Change: 02 August 2016
+" ----------------------------------------------------------------------------
+
+if exists('b:did_ftplugin') || &cp
+ finish
+endif
+let b:did_ftplugin = 1
+
+" j is fairly new in Vim, so don't complain if it's not there
+setlocal formatoptions-=t formatoptions+=croqnl
+silent! setlocal formatoptions+=j
+
+" Just like c.vim, but additionally doesn't wrap text onto /** line when
+" formatting. Doesn't bungle bulleted lists when formatting.
+if get(g:, 'scala_scaladoc_indent', 0)
+ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s2:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
+else
+ setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/**,mb:*,ex:*/,s1:/*,mb:*,ex:*/,://
+endif
+setlocal commentstring=//\ %s
+
+setlocal shiftwidth=2 softtabstop=2 expandtab
+
+setlocal include='^\s*import'
+setlocal includeexpr='substitute(v:fname,"\\.","/","g")'
+
+setlocal path+=src/main/scala,src/test/scala
+setlocal suffixesadd=.scala
+
+compiler sbt
+
+" vim:set sw=2 sts=2 ts=8 et:
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index e19a19fb1f..be2f0866d5 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: 0.44
-" Last Change: 2016 Jan. 26
+" Version: 0.45
+" Last Change: 2016 Aug. 18
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
@@ -121,7 +121,7 @@ function FortranGetIndent(lnum)
let prefix='\(\(pure\|impure\|elemental\|recursive\)\s\+\)\{,2}'
let type='\(\(integer\|real\|double\s\+precision\|complex\|logical'
\.'\|character\|type\|class\)\s*\S*\s\+\)\='
- if prevstat =~? '^\s*\(module\|contains\|program\)\>'
+ if prevstat =~? '^\s*\(module\|contains\/submodule\|program\)\>'
\ ||prevstat =~? '^\s*'.prefix.'subroutine\>'
\ ||prevstat =~? '^\s*'.prefix.type.'function\>'
\ ||prevstat =~? '^\s*'.type.prefix.'function\>'
@@ -129,14 +129,14 @@ function FortranGetIndent(lnum)
endif
if getline(v:lnum) =~? '^\s*contains\>'
\ ||getline(v:lnum)=~? '^\s*end\s*'
- \ .'\(function\|subroutine\|module\|program\)\>'
+ \ .'\(function\|subroutine\|module\/submodule\|program\)\>'
let ind = ind - shiftwidth()
endif
endif
"Subtract a shiftwidth from else, else if, elsewhere, case, end if,
" end where, end select, end forall, end interface, end associate,
- " end enum, and end type statements
+ " end enum, end type, end block and end type statements
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*'
\. '\(else\|else\s*if\|else\s*where\|case\|'
\. 'end\s*\(if\|where\|select\|interface\|'
diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim
index 3507e305ed..0d6c11d151 100644
--- a/runtime/indent/javascript.vim
+++ b/runtime/indent/javascript.vim
@@ -1,8 +1,8 @@
" Vim indent file
" Language: Javascript
-" Maintainer: vim-javascript community
+" Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript
-" Last Change: August 12, 2016
+" Last Change: August 25, 2016
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -12,11 +12,11 @@ let b:did_indent = 1
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent()
-setlocal nolisp
+setlocal nolisp noautoindent nosmartindent
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
setlocal cinoptions+=j1,J1
-let b:undo_indent = 'setlocal indentexpr< indentkeys< cinoptions<'
+let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< cinoptions<'
" Only define the function once.
if exists('*GetJavascriptIndent')
@@ -37,7 +37,7 @@ else
endfunction
endif
-let s:line_pre = '^\s*\%(\/\*.\{-}\*\/\s*\)*'
+let s:line_pre = '^\s*\%(\%(\%(\/\*.\{-}\)\=\*\+\/\s*\)\=\)\@>'
let s:expr_case = s:line_pre . '\%(\%(case\>.\+\)\|default\)\s*:'
" Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
@@ -46,63 +46,63 @@ let s:syng_strcom = '\%(s\%(tring\|pecial\)\|comment\|regex\|doc\|template\)'
let s:syng_comment = '\%(comment\|doc\)'
" Expression used to check whether we should skip a match with searchpair().
-let s:skip_expr = "line('.') < (prevnonblank(v:lnum) - 2000) ? dummy : synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
+let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
-function s:lookForParens(start,end,flags,time)
- if has('reltime')
- return searchpair(a:start,'',a:end,a:flags,s:skip_expr,0,a:time)
- else
- return searchpair(a:start,'',a:end,a:flags,0,0)
- endif
-endfunction
+if has('reltime')
+ function s:GetPair(start,end,flags,time)
+ return searchpair(a:start,'',a:end,a:flags,s:skip_expr,max([prevnonblank(v:lnum) - 2000,0]),a:time)
+ endfunction
+else
+ function s:GetPair(start,end,flags,n)
+ return searchpair(a:start,'',a:end,a:flags,0,max([prevnonblank(v:lnum) - 2000,0]))
+ endfunction
+endif
-let s:line_term = '\%(\s*\%(\/\*.\{-}\*\/\s*\)\=\)\@>$'
+let s:line_term = '\s*\%(\%(\/\%(\%(\*.\{-}\*\/\)\|\%(\*\+\)\)\)\s*\)\=$'
" configurable regexes that define continuation lines, not including (, {, or [.
if !exists('g:javascript_opfirst')
- let g:javascript_opfirst = '\%([<>,:?^%]\|\([-/.+]\)\%(\1\|\*\|\/\)\@!\|\*\/\@!\|=>\@!\||\|&\|in\%(stanceof\)\=\>\)'
+ let g:javascript_opfirst = '\%([<>,:?^%|*&]\|\/[^/*]\|\([-.+]\)\1\@!\|=>\@!\|in\%(stanceof\)\=\>\)'
endif
-let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
-
if !exists('g:javascript_continuation')
- let g:javascript_continuation = '\%([<*,.?:^%]\|+\@<!+\|-\@<!-\|=\@<!>\|\*\@<!\/\|=\||\|&\|\<in\%(stanceof\)\=\)'
+ let g:javascript_continuation = '\%([<=,.?/*:^%|&]\|+\@<!+\|-\@<!-\|=\@<!>\|\<in\%(stanceof\)\=\)'
endif
+
+let g:javascript_opfirst = s:line_pre . g:javascript_opfirst
let g:javascript_continuation .= s:line_term
-function s:Onescope(lnum,text,add)
- return a:text =~# '\%(\<else\|\<do\|=>' . (a:add ? '\|\<try\|\<finally' : '' ) . '\)' . s:line_term ||
+function s:OneScope(lnum,text,add)
+ return a:text =~# '\%(\<else\|\<do\|=>\)' . s:line_term ? 'no b' :
\ ((a:add && a:text =~ s:line_pre . '$' && search('\%' . s:PrevCodeLine(a:lnum - 1) . 'l.)' . s:line_term)) ||
\ cursor(a:lnum, match(a:text, ')' . s:line_term)) > -1) &&
- \ s:lookForParens('(', ')', 'cbW', 100) > 0 && search((a:add ?
- \ '\%(function\*\|[[:lower:][:upper:]_$][[:digit:][:lower:][:upper:]_$]*\)' :
- \ '\<\%(for\%(\s\+each\)\=\|if\|let\|w\%(hile\|ith\)\)') . '\_s*\%#\C','bW') &&
- \ (a:add || (expand('<cword>') ==# 'while' ? !s:lookForParens('\<do\>\C', '\<while\>\C','bW',100) : 1))
+ \ s:GetPair('(', ')', 'cbW', 100) > 0 && search('\C\l\+\_s*\%#','bW') &&
+ \ (a:add || ((expand('<cword>') !=# 'while' || !s:GetPair('\C\<do\>', '\C\<while\>','nbW',100)) &&
+ \ (expand('<cword>') !=# 'each' || search('\C\<for\_s\+\%#','nbW')))) ? expand('<cword>') : ''
endfunction
-" Auxiliary Functions {{{2
-
-" strip line of comment
-function s:StripLine(c)
- return a:c !~# s:expr_case ? substitute(a:c, '\%(:\@<!\/\/.*\)$', '','') : a:c
+" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
+function s:IsBlock()
+ return getline(line('.'))[col('.')-1] == '{' && !search(
+ \ '\C\%(\<return\s*\|\%([-=~!<*+,.?^%|&\[(]\|=\@<!>\|\*\@<!\/\|\<\%(var\|const\|let\|import\|export\%(\_s\+default\)\=\|yield\|delete\|void\|t\%(ypeof\|hrow\)\|new\|in\%(stanceof\)\=\)\)\_s*\)\%#','bnW') &&
+ \ (!search(':\_s*\%#','bW') || (!s:GetPair('[({[]','[])}]','bW',200) || s:IsBlock()))
endfunction
+" Auxiliary Functions {{{2
+
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevCodeLine(lnum)
let l:lnum = prevnonblank(a:lnum)
- while l:lnum > 0
+ while l:lnum
if synIDattr(synID(l:lnum,matchend(getline(l:lnum), '^\s*[^''"]'),0),'name') !~? s:syng_strcom
- break
+ return l:lnum
endif
let l:lnum = prevnonblank(l:lnum - 1)
endwhile
- return l:lnum
endfunction
" Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum)
- let open_0 = 0
- let open_2 = 0
- let open_4 = 0
+ let [open_0,open_2,open_4] = [0,0,0]
let l:line = getline(a:lnum)
let pos = match(l:line, '[][(){}]', 0)
while pos != -1
@@ -129,7 +129,7 @@ function GetJavascriptIndent()
let syns = synIDattr(synID(v:lnum, 1, 0), 'name')
" start with strings,comments,etc.{{{2
- if (l:line !~ '^[''"`]' && syns =~? 'string\|template') ||
+ if (l:line !~ '^[''"`]' && syns =~? '\%(string\|template\)') ||
\ (l:line !~ '^\s*[/*]' && syns =~? s:syng_comment)
return -1
endif
@@ -153,15 +153,15 @@ function GetJavascriptIndent()
" the containing paren, bracket, curly. Memoize, last lineNr either has the
" same scope or starts a new one, unless if it closed a scope.
call cursor(v:lnum,1)
- if b:js_cache[0] >= l:lnum && b:js_cache[0] <= v:lnum && b:js_cache[0] &&
+ if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && b:js_cache[0] &&
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum) > 0)
let num = b:js_cache[1]
elseif syns != '' && l:line[0] =~ '\s'
let pattern = syns =~? 'block' ? ['{','}'] : syns =~? 'jsparen' ? ['(',')'] :
\ syns =~? 'jsbracket'? ['\[','\]'] : ['[({[]','[])}]']
- let num = s:lookForParens(pattern[0],pattern[1],'bW',2000)
+ let num = s:GetPair(pattern[0],pattern[1],'bW',2000)
else
- let num = s:lookForParens('[({[]','[])}]','bW',2000)
+ let num = s:GetPair('[({[]','[])}]','bW',2000)
endif
let b:js_cache = [v:lnum,num,line('.') == v:lnum ? b:js_cache[2] : col('.')]
@@ -169,17 +169,19 @@ function GetJavascriptIndent()
return indent(num)
endif
- let pline = s:StripLine(getline(l:lnum))
- let inb = num == 0 ? 1 : (s:Onescope(num, s:StripLine(strpart(getline(num),0,b:js_cache[2] - 1)),1) ||
- \ (l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term)) && num < l:lnum
- let switch_offset = (!inb || num == 0) || expand("<cword>") !=# 'switch' ? 0 : &cino !~ ':' || !has('float') ? s:sw() :
+ call cursor(b:js_cache[1],b:js_cache[2])
+
+ let swcase = getline(l:lnum) =~# s:expr_case
+ let pline = swcase ? getline(l:lnum) : substitute(getline(l:lnum), '\%(:\@<!\/\/.*\)$', '','')
+ let inb = num == 0 || num < l:lnum && ((l:line !~ s:line_pre . ',' && pline !~ ',' . s:line_term) || s:IsBlock())
+ let switch_offset = num == 0 || s:OneScope(num, strpart(getline(num),0,b:js_cache[2] - 1),1) !=# 'switch' ? 0 :
+ \ &cino !~ ':' || !has('float') ? s:sw() :
\ float2nr(str2float(matchstr(&cino,'.*:\zs[-0-9.]*')) * (&cino =~# '.*:[^,]*s' ? s:sw() : 1))
" most significant, find the indent amount
- if (inb && (l:line =~# g:javascript_opfirst ||
- \ (pline =~# g:javascript_continuation && pline !~# s:expr_case && (pline !~ ':' . s:line_term || l:line !~#
- \ s:line_pre . '\%(d\%(o\|ebugger\)\|else\|f\%(or\|inally\)\|if\|let\|switch\|t\%(hrow\|ry\)\|w\%(hile\|ith\)\)\>')))) ||
- \ (num < l:lnum && s:Onescope(l:lnum,pline,0) && l:line !~ s:line_pre . '{')
+ if inb && !swcase && ((l:line =~# g:javascript_opfirst || pline =~# g:javascript_continuation) ||
+ \ num < l:lnum && s:OneScope(l:lnum,pline,0) =~# '\<\%(for\|each\|if\|let\|no\sb\|w\%(hile\|ith\)\)\>' &&
+ \ l:line !~ s:line_pre . '{')
return (num > 0 ? indent(num) : -s:sw()) + (s:sw() * 2) + switch_offset
elseif num > 0
return indent(num) + s:sw() + switch_offset
diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim
index 29fa5bc78f..8c11e85cb3 100644
--- a/runtime/indent/rnoweb.vim
+++ b/runtime/indent/rnoweb.vim
@@ -2,7 +2,7 @@
" Language: Rnoweb
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Tue Apr 07, 2015 04:38PM
+" Last Change: Fri Apr 15, 2016 10:58PM
" Only load this indent file when no other was loaded.
@@ -10,7 +10,17 @@ if exists("b:did_indent")
finish
endif
runtime indent/tex.vim
-let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
+
+function! s:NoTeXIndent()
+ return indent(line("."))
+endfunction
+
+if &indentexpr == "" || &indentexpr == "GetRnowebIndent()"
+ let s:TeXIndent = function("s:NoTeXIndent")
+else
+ let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
+endif
+
unlet b:did_indent
runtime indent/r.vim
let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
diff --git a/runtime/indent/scala.vim b/runtime/indent/scala.vim
new file mode 100644
index 0000000000..f97c79bbab
--- /dev/null
+++ b/runtime/indent/scala.vim
@@ -0,0 +1,609 @@
+" Vim indent file
+" Language: Scala (http://scala-lang.org/)
+" Original Author: Stefan Matthias Aust
+" Modifications By: Derek Wyatt
+" URL: https://github.com/derekwyatt/vim-scala
+" Last Change: 2016 Aug 26
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal autoindent
+setlocal indentexpr=GetScalaIndent()
+setlocal indentkeys=0{,0},0),!^F,<>>,o,O,e,=case,<CR>
+
+if exists("*GetScalaIndent")
+ finish
+endif
+let s:keepcpo= &cpo
+set cpo&vim
+
+let s:defMatcher = '\%(\%(private\|protected\)\%(\[[^\]]*\]\)\?\s\+\|abstract\s\+\|override\s\+\)*\<def\>'
+let s:funcNameMatcher = '\w\+'
+let s:typeSpecMatcher = '\%(\s*\[\_[^\]]*\]\)'
+let s:defArgMatcher = '\%((\_.\{-})\)'
+let s:returnTypeMatcher = '\%(:\s*\w\+' . s:typeSpecMatcher . '\?\)'
+let g:fullDefMatcher = '^\s*' . s:defMatcher . '\s\+' . s:funcNameMatcher . '\s*' . s:typeSpecMatcher . '\?\s*' . s:defArgMatcher . '\?\s*' . s:returnTypeMatcher . '\?\s*[={]'
+
+function! scala#ConditionalConfirm(msg)
+ if 0
+ call confirm(a:msg)
+ endif
+endfunction
+
+function! scala#GetLine(lnum)
+ let line = substitute(getline(a:lnum), '//.*$', '', '')
+ let line = substitute(line, '"\(.\|\\"\)\{-}"', '""', 'g')
+ return line
+endfunction
+
+function! scala#CountBrackets(line, openBracket, closedBracket)
+ let line = substitute(a:line, '"\(.\|\\"\)\{-}"', '', 'g')
+ let open = substitute(line, '[^' . a:openBracket . ']', '', 'g')
+ let close = substitute(line, '[^' . a:closedBracket . ']', '', 'g')
+ return strlen(open) - strlen(close)
+endfunction
+
+function! scala#CountParens(line)
+ return scala#CountBrackets(a:line, '(', ')')
+endfunction
+
+function! scala#CountCurlies(line)
+ return scala#CountBrackets(a:line, '{', '}')
+endfunction
+
+function! scala#LineEndsInIncomplete(line)
+ if a:line =~ '[.,]\s*$'
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! scala#LineIsAClosingXML(line)
+ if a:line =~ '^\s*</\w'
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! scala#LineCompletesXML(lnum, line)
+ let savedpos = getpos('.')
+ call setpos('.', [savedpos[0], a:lnum, 0, savedpos[3]])
+ let tag = substitute(a:line, '^.*</\([^>]*\)>.*$', '\1', '')
+ let [lineNum, colnum] = searchpairpos('<' . tag . '>', '', '</' . tag . '>', 'Wbn')
+ call setpos('.', savedpos)
+ let pline = scala#GetLine(prevnonblank(lineNum - 1))
+ if pline =~ '=\s*$'
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! scala#IsParentCase()
+ let savedpos = getpos('.')
+ call setpos('.', [savedpos[0], savedpos[1], 0, savedpos[3]])
+ let [l, c] = searchpos('^\s*\%(' . s:defMatcher . '\|\%(\<case\>\)\)', 'bnW')
+ let retvalue = -1
+ if l != 0 && search('\%' . l . 'l\s*\<case\>', 'bnW')
+ let retvalue = l
+ endif
+ call setpos('.', savedpos)
+ return retvalue
+endfunction
+
+function! scala#CurlyMatcher()
+ let matchline = scala#GetLineThatMatchesBracket('{', '}')
+ if scala#CountParens(scala#GetLine(matchline)) < 0
+ let savedpos = getpos('.')
+ call setpos('.', [savedpos[0], matchline, 9999, savedpos[3]])
+ call searchpos('{', 'Wbc')
+ call searchpos(')', 'Wb')
+ let [lnum, colnum] = searchpairpos('(', '', ')', 'Wbn')
+ call setpos('.', savedpos)
+ let line = scala#GetLine(lnum)
+ if line =~ '^\s*' . s:defMatcher
+ return lnum
+ else
+ return matchline
+ endif
+ else
+ return matchline
+ endif
+endfunction
+
+function! scala#GetLineAndColumnThatMatchesCurly()
+ return scala#GetLineAndColumnThatMatchesBracket('{', '}')
+endfunction
+
+function! scala#GetLineAndColumnThatMatchesParen()
+ return scala#GetLineAndColumnThatMatchesBracket('(', ')')
+endfunction
+
+function! scala#GetLineAndColumnThatMatchesBracket(openBracket, closedBracket)
+ let savedpos = getpos('.')
+ let curline = scala#GetLine(line('.'))
+ if curline =~ a:closedBracket . '.*' . a:openBracket . '.*' . a:closedBracket
+ call setpos('.', [savedpos[0], savedpos[1], 0, savedpos[3]])
+ call searchpos(a:closedBracket . '\ze[^' . a:closedBracket . a:openBracket . ']*' . a:openBracket, 'W')
+ else
+ call setpos('.', [savedpos[0], savedpos[1], 9999, savedpos[3]])
+ call searchpos(a:closedBracket, 'Wbc')
+ endif
+ let [lnum, colnum] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbn')
+ call setpos('.', savedpos)
+ return [lnum, colnum]
+endfunction
+
+function! scala#GetLineThatMatchesCurly()
+ return scala#GetLineThatMatchesBracket('{', '}')
+endfunction
+
+function! scala#GetLineThatMatchesParen()
+ return scala#GetLineThatMatchesBracket('(', ')')
+endfunction
+
+function! scala#GetLineThatMatchesBracket(openBracket, closedBracket)
+ let [lnum, colnum] = scala#GetLineAndColumnThatMatchesBracket(a:openBracket, a:closedBracket)
+ return lnum
+endfunction
+
+function! scala#NumberOfBraceGroups(line)
+ let line = substitute(a:line, '[^()]', '', 'g')
+ if strlen(line) == 0
+ return 0
+ endif
+ let line = substitute(line, '^)*', '', 'g')
+ if strlen(line) == 0
+ return 0
+ endif
+ let line = substitute(line, '^(', '', 'g')
+ if strlen(line) == 0
+ return 0
+ endif
+ let c = 1
+ let counter = 0
+ let groupCount = 0
+ while counter < strlen(line)
+ let char = strpart(line, counter, 1)
+ if char == '('
+ let c = c + 1
+ elseif char == ')'
+ let c = c - 1
+ endif
+ if c == 0
+ let groupCount = groupCount + 1
+ endif
+ let counter = counter + 1
+ endwhile
+ return groupCount
+endfunction
+
+function! scala#MatchesIncompleteDefValr(line)
+ if a:line =~ '^\s*\%(' . s:defMatcher . '\|\<va[lr]\>\).*[=({]\s*$'
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! scala#LineIsCompleteIf(line)
+ if scala#CountBrackets(a:line, '{', '}') == 0 &&
+ \ scala#CountBrackets(a:line, '(', ')') == 0 &&
+ \ a:line =~ '^\s*\<if\>\s*([^)]*)\s*\S.*$'
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! scala#LineCompletesIfElse(lnum, line)
+ if a:line =~ '^\s*\%(\<if\>\|\%(}\s*\)\?\<else\>\)'
+ return 0
+ endif
+ let result = search('^\%(\s*\<if\>\s*(.*).*\n\|\s*\<if\>\s*(.*)\s*\n.*\n\)\%(\s*\<else\>\s*\<if\>\s*(.*)\s*\n.*\n\)*\%(\s*\<else\>\s*\n\|\s*\<else\>[^{]*\n\)\?\%' . a:lnum . 'l', 'Wbn')
+ if result != 0 && scala#GetLine(prevnonblank(a:lnum - 1)) !~ '{\s*$'
+ return result
+ endif
+ return 0
+endfunction
+
+function! scala#GetPrevCodeLine(lnum)
+ " This needs to skip comment lines
+ return prevnonblank(a:lnum - 1)
+endfunction
+
+function! scala#InvertBracketType(openBracket, closedBracket)
+ if a:openBracket == '('
+ return [ '{', '}' ]
+ else
+ return [ '(', ')' ]
+ endif
+endfunction
+
+function! scala#Testhelper(lnum, line, openBracket, closedBracket, iteration)
+ let bracketCount = scala#CountBrackets(a:line, a:openBracket, a:closedBracket)
+ " There are more '}' braces than '{' on this line so it may be completing the function definition
+ if bracketCount < 0
+ let [matchedLNum, matchedColNum] = scala#GetLineAndColumnThatMatchesBracket(a:openBracket, a:closedBracket)
+ if matchedLNum == a:lnum
+ return -1
+ endif
+ let matchedLine = scala#GetLine(matchedLNum)
+ if ! scala#MatchesIncompleteDefValr(matchedLine)
+ let bracketLine = substitute(substitute(matchedLine, '\%' . matchedColNum . 'c.*$', '', ''), '[^{}()]', '', 'g')
+ if bracketLine =~ '}$'
+ return scala#Testhelper(matchedLNum, matchedLine, '{', '}', a:iteration + 1)
+ elseif bracketLine =~ ')$'
+ return scala#Testhelper(matchedLNum, matchedLine, '(', ')', a:iteration + 1)
+ else
+ let prevCodeLNum = scala#GetPrevCodeLine(matchedLNum)
+ if scala#MatchesIncompleteDefValr(scala#GetLine(prevCodeLNum))
+ return prevCodeLNum
+ else
+ return -1
+ endif
+ endif
+ else
+ " return indent value instead
+ return matchedLNum
+ endif
+ " There's an equal number of '{' and '}' on this line so it may be a single line function definition
+ elseif bracketCount == 0
+ if a:iteration == 0
+ let otherBracketType = scala#InvertBracketType(a:openBracket, a:closedBracket)
+ return scala#Testhelper(a:lnum, a:line, otherBracketType[0], otherBracketType[1], a:iteration + 1)
+ else
+ let prevCodeLNum = scala#GetPrevCodeLine(a:lnum)
+ let prevCodeLine = scala#GetLine(prevCodeLNum)
+ if scala#MatchesIncompleteDefValr(prevCodeLine) && prevCodeLine !~ '{\s*$'
+ return prevCodeLNum
+ else
+ let possibleIfElse = scala#LineCompletesIfElse(a:lnum, a:line)
+ if possibleIfElse != 0
+ let defValrLine = prevnonblank(possibleIfElse - 1)
+ let possibleDefValr = scala#GetLine(defValrLine)
+ if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$'
+ return possibleDefValr
+ else
+ return -1
+ endif
+ else
+ return -1
+ endif
+ endif
+ endif
+ else
+ return -1
+ endif
+endfunction
+
+function! scala#Test(lnum, line, openBracket, closedBracket)
+ return scala#Testhelper(a:lnum, a:line, a:openBracket, a:closedBracket, 0)
+endfunction
+
+function! scala#LineCompletesDefValr(lnum, line)
+ let bracketCount = scala#CountBrackets(a:line, '{', '}')
+ if bracketCount < 0
+ let matchedBracket = scala#GetLineThatMatchesBracket('{', '}')
+ if ! scala#MatchesIncompleteDefValr(scala#GetLine(matchedBracket))
+ let possibleDefValr = scala#GetLine(prevnonblank(matchedBracket - 1))
+ if matchedBracket != -1 && scala#MatchesIncompleteDefValr(possibleDefValr)
+ return 1
+ else
+ return 0
+ endif
+ else
+ return 0
+ endif
+ elseif bracketCount == 0
+ let bracketCount = scala#CountBrackets(a:line, '(', ')')
+ if bracketCount < 0
+ let matchedBracket = scala#GetLineThatMatchesBracket('(', ')')
+ if ! scala#MatchesIncompleteDefValr(scala#GetLine(matchedBracket))
+ let possibleDefValr = scala#GetLine(prevnonblank(matchedBracket - 1))
+ if matchedBracket != -1 && scala#MatchesIncompleteDefValr(possibleDefValr)
+ return 1
+ else
+ return 0
+ endif
+ else
+ return 0
+ endif
+ elseif bracketCount == 0
+ let possibleDefValr = scala#GetLine(prevnonblank(a:lnum - 1))
+ if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$'
+ return 1
+ else
+ let possibleIfElse = scala#LineCompletesIfElse(a:lnum, a:line)
+ if possibleIfElse != 0
+ let possibleDefValr = scala#GetLine(prevnonblank(possibleIfElse - 1))
+ if scala#MatchesIncompleteDefValr(possibleDefValr) && possibleDefValr =~ '^.*=\s*$'
+ return 2
+ else
+ return 0
+ endif
+ else
+ return 0
+ endif
+ endif
+ else
+ return 0
+ endif
+ endif
+endfunction
+
+function! scala#SpecificLineCompletesBrackets(lnum, openBracket, closedBracket)
+ let savedpos = getpos('.')
+ call setpos('.', [savedpos[0], a:lnum, 9999, savedpos[3]])
+ let retv = scala#LineCompletesBrackets(a:openBracket, a:closedBracket)
+ call setpos('.', savedpos)
+
+ return retv
+endfunction
+
+function! scala#LineCompletesBrackets(openBracket, closedBracket)
+ let savedpos = getpos('.')
+ let offline = 0
+ while offline == 0
+ let [lnum, colnum] = searchpos(a:closedBracket, 'Wb')
+ let [lnumA, colnumA] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbn')
+ if lnum != lnumA
+ let [lnumB, colnumB] = searchpairpos(a:openBracket, '', a:closedBracket, 'Wbnr')
+ let offline = 1
+ endif
+ endwhile
+ call setpos('.', savedpos)
+ if lnumA == lnumB && colnumA == colnumB
+ return lnumA
+ else
+ return -1
+ endif
+endfunction
+
+function! GetScalaIndent()
+ " Find a non-blank line above the current line.
+ let prevlnum = prevnonblank(v:lnum - 1)
+
+ " Hit the start of the file, use zero indent.
+ if prevlnum == 0
+ return 0
+ endif
+
+ let ind = indent(prevlnum)
+ let originalIndentValue = ind
+ let prevline = scala#GetLine(prevlnum)
+ let curlnum = v:lnum
+ let curline = scala#GetLine(curlnum)
+ if get(g:, 'scala_scaladoc_indent', 0)
+ let star_indent = 2
+ else
+ let star_indent = 1
+ end
+
+ if prevline =~ '^\s*/\*\*'
+ if prevline =~ '\*/\s*$'
+ return ind
+ else
+ return ind + star_indent
+ endif
+ endif
+
+ if curline =~ '^\s*\*'
+ return cindent(curlnum)
+ endif
+
+ " If this line starts with a { then make it indent the same as the previous line
+ if curline =~ '^\s*{'
+ call scala#ConditionalConfirm("1")
+ " Unless, of course, the previous one is a { as well
+ if prevline !~ '^\s*{'
+ call scala#ConditionalConfirm("2")
+ return indent(prevlnum)
+ endif
+ endif
+
+ " '.' continuations
+ if curline =~ '^\s*\.'
+ if prevline =~ '^\s*\.'
+ return ind
+ else
+ return ind + &shiftwidth
+ endif
+ endif
+
+ " Indent html literals
+ if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$'
+ call scala#ConditionalConfirm("3")
+ return ind + &shiftwidth
+ endif
+
+ " assumes curly braces around try-block
+ if curline =~ '^\s*}\s*\<catch\>'
+ return ind - &shiftwidth
+ elseif curline =~ '^\s*\<catch\>'
+ return ind
+ endif
+
+ " Add a 'shiftwidth' after lines that start a block
+ " If 'if', 'for' or 'while' end with ), this is a one-line block
+ " If 'val', 'var', 'def' end with =, this is a one-line block
+ if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1)
+ \ || prevline =~ '^\s*' . s:defMatcher . '.*=\s*$'
+ \ || prevline =~ '^\s*\<va[lr]\>.*[=]\s*$'
+ \ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$'
+ \ || prevline =~ '=\s*$'
+ call scala#ConditionalConfirm("4")
+ let ind = ind + &shiftwidth
+ elseif prevline =~ '^\s*\<\%(}\?\s*else\s\+\)\?if\>' && curline =~ '^\s*}\?\s*\<else\>'
+ return ind
+ endif
+
+ let lineCompletedBrackets = 0
+ let bracketCount = scala#CountBrackets(prevline, '{', '}')
+ if bracketCount > 0 || prevline =~ '.*{\s*$'
+ call scala#ConditionalConfirm("5b")
+ let ind = ind + &shiftwidth
+ elseif bracketCount < 0
+ call scala#ConditionalConfirm("6b")
+ " if the closing brace actually completes the braces entirely, then we
+ " have to indent to line that started the whole thing
+ let completeLine = scala#LineCompletesBrackets('{', '}')
+ if completeLine != -1
+ call scala#ConditionalConfirm("8b")
+ let prevCompleteLine = scala#GetLine(prevnonblank(completeLine - 1))
+ " However, what actually started this part looks like it was a function
+ " definition, so we need to indent to that line instead. This is
+ " actually pretty weak at the moment.
+ if prevCompleteLine =~ '=\s*$'
+ call scala#ConditionalConfirm("9b")
+ let ind = indent(prevnonblank(completeLine - 1))
+ else
+ call scala#ConditionalConfirm("10b")
+ let ind = indent(completeLine)
+ endif
+ else
+ let lineCompletedBrackets = 1
+ endif
+ endif
+
+ if ind == originalIndentValue
+ let bracketCount = scala#CountBrackets(prevline, '(', ')')
+ if bracketCount > 0 || prevline =~ '.*(\s*$'
+ call scala#ConditionalConfirm("5a")
+ let ind = ind + &shiftwidth
+ elseif bracketCount < 0
+ call scala#ConditionalConfirm("6a")
+ " if the closing brace actually completes the braces entirely, then we
+ " have to indent to line that started the whole thing
+ let completeLine = scala#LineCompletesBrackets('(', ')')
+ if completeLine != -1 && prevline !~ '^.*{\s*$'
+ call scala#ConditionalConfirm("8a")
+ let prevCompleteLine = scala#GetLine(prevnonblank(completeLine - 1))
+ " However, what actually started this part looks like it was a function
+ " definition, so we need to indent to that line instead. This is
+ " actually pretty weak at the moment.
+ if prevCompleteLine =~ '=\s*$'
+ call scala#ConditionalConfirm("9a")
+ let ind = indent(prevnonblank(completeLine - 1))
+ else
+ call scala#ConditionalConfirm("10a")
+ let ind = indent(completeLine)
+ endif
+ else
+ " This is the only part that's different from from the '{', '}' one below
+ " Yup... some refactoring is necessary at some point.
+ let ind = ind + (bracketCount * &shiftwidth)
+ let lineCompletedBrackets = 1
+ endif
+ endif
+ endif
+
+ if curline =~ '^\s*}\?\s*\<else\>\%(\s\+\<if\>\s*(.*)\)\?\s*{\?\s*$' &&
+ \ ! scala#LineIsCompleteIf(prevline) &&
+ \ prevline !~ '^.*}\s*$'
+ let ind = ind - &shiftwidth
+ endif
+
+ " Subtract a 'shiftwidth' on '}' or html
+ let curCurlyCount = scala#CountCurlies(curline)
+ if curCurlyCount < 0
+ call scala#ConditionalConfirm("14a")
+ let matchline = scala#CurlyMatcher()
+ return indent(matchline)
+ elseif curline =~ '^\s*</[a-zA-Z][^>]*>'
+ call scala#ConditionalConfirm("14c")
+ return ind - &shiftwidth
+ endif
+
+ let prevParenCount = scala#CountParens(prevline)
+ if prevline =~ '^\s*\<for\>.*$' && prevParenCount > 0
+ call scala#ConditionalConfirm("15")
+ let ind = indent(prevlnum) + 5
+ endif
+
+ let prevCurlyCount = scala#CountCurlies(prevline)
+ if prevCurlyCount == 0 && prevline =~ '^.*\%(=>\|⇒\)\s*$' && prevline !~ '^\s*this\s*:.*\%(=>\|⇒\)\s*$' && curline !~ '^\s*\<case\>'
+ call scala#ConditionalConfirm("16")
+ let ind = ind + &shiftwidth
+ endif
+
+ if ind == originalIndentValue && curline =~ '^\s*\<case\>'
+ call scala#ConditionalConfirm("17")
+ let parentCase = scala#IsParentCase()
+ if parentCase != -1
+ call scala#ConditionalConfirm("17a")
+ return indent(parentCase)
+ endif
+ endif
+
+ if prevline =~ '^\s*\*/'
+ \ || prevline =~ '*/\s*$'
+ call scala#ConditionalConfirm("18")
+ let ind = ind - star_indent
+ endif
+
+ if scala#LineEndsInIncomplete(prevline)
+ call scala#ConditionalConfirm("19")
+ return ind
+ endif
+
+ if scala#LineIsAClosingXML(prevline)
+ if scala#LineCompletesXML(prevlnum, prevline)
+ call scala#ConditionalConfirm("20a")
+ return ind - &shiftwidth
+ else
+ call scala#ConditionalConfirm("20b")
+ return ind
+ endif
+ endif
+
+ if ind == originalIndentValue
+ "let indentMultiplier = scala#LineCompletesDefValr(prevlnum, prevline)
+ "if indentMultiplier != 0
+ " call scala#ConditionalConfirm("19a")
+ " let ind = ind - (indentMultiplier * &shiftwidth)
+ let defValrLine = scala#Test(prevlnum, prevline, '{', '}')
+ if defValrLine != -1
+ call scala#ConditionalConfirm("21a")
+ let ind = indent(defValrLine)
+ elseif lineCompletedBrackets == 0
+ call scala#ConditionalConfirm("21b")
+ if scala#GetLine(prevnonblank(prevlnum - 1)) =~ '^.*\<else\>\s*\%(//.*\)\?$'
+ call scala#ConditionalConfirm("21c")
+ let ind = ind - &shiftwidth
+ elseif scala#LineCompletesIfElse(prevlnum, prevline)
+ call scala#ConditionalConfirm("21d")
+ let ind = ind - &shiftwidth
+ elseif scala#CountParens(curline) < 0 && curline =~ '^\s*)' && scala#GetLine(scala#GetLineThatMatchesBracket('(', ')')) =~ '.*(\s*$'
+ " Handles situations that look like this:
+ "
+ " val a = func(
+ " 10
+ " )
+ "
+ " or
+ "
+ " val a = func(
+ " 10
+ " ).somethingHere()
+ call scala#ConditionalConfirm("21e")
+ let ind = ind - &shiftwidth
+ endif
+ endif
+ endif
+
+ call scala#ConditionalConfirm("returning " . ind)
+
+ return ind
+endfunction
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
+" vim:set sw=2 sts=2 ts=8 et:
+" vim600:fdm=marker fdl=1 fdc=0:
diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim
index ba24257b02..8467cefcc0 100644
--- a/runtime/indent/teraterm.vim
+++ b/runtime/indent/teraterm.vim
@@ -1,9 +1,9 @@
" Vim indent file
" Language: Tera Term Language (TTL)
-" Based on Tera Term Version 4.86
+" Based on Tera Term Version 4.92
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
-" Last Change: 2015 Jun 4
+" Last Change: 2016 Aug 17
" Filenames: *.ttl
" License: VIM License
@@ -25,9 +25,7 @@ endif
" The shiftwidth() function is relatively new.
" Don't require it to exist.
if exists('*shiftwidth')
- function s:sw() abort
- return shiftwidth()
- endfunction
+ let s:sw = function('shiftwidth')
else
function s:sw() abort
return &shiftwidth
@@ -48,7 +46,7 @@ function! GetTeraTermIndent(lnum)
let l:ind = l:previ
- if l:prevl =~ '^\s*if\>.*\<then\s*$'
+ if l:prevl =~ '^\s*if\>.*\<then\>'
" previous line opened a block
let l:ind += s:sw()
endif
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index aa4906ce0a..3201462fbc 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -37,7 +37,7 @@ function s:FindPrevLessIndentedLine(lnum, ...)
let curindent = a:0 ? a:1 : indent(a:lnum)
while prevlnum
\&& indent(prevlnum) >= curindent
- \&& getline(prevlnum) !~# '^\s*#'
+ \&& getline(prevlnum) =~# '^\s*#'
let prevlnum = prevnonblank(prevlnum-1)
endwhile
return prevlnum
@@ -51,11 +51,33 @@ function s:FindPrevLEIndentedLineMatchingRegex(lnum, regex)
return plilnum
endfunction
-let s:mapkeyregex='\v^\s*%(\''%([^'']|'''')*\'''.
- \ '|\"%([^"\\]|\\.)*\"'.
- \ '|%(%(\:\ )@!.)*)\:%(\ |$)'
+let s:mapkeyregex='\v^\s*\#@!\S@=%(\''%([^'']|\''\'')*\'''.
+ \ '|\"%([^"\\]|\\.)*\"'.
+ \ '|%(%(\:\ )@!.)*)\:%(\ |$)'
let s:liststartregex='\v^\s*%(\-%(\ |$))'
+let s:c_ns_anchor_char = '\v%([\n\r\uFEFF \t,[\]{}]@!\p)'
+let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
+let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name
+
+let s:ns_word_char = '\v[[:alnum:]_\-]'
+let s:ns_tag_char = '\v%(%\x\x|'.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
+let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!'
+let s:c_secondary_tag_handle = '\v\!\!'
+let s:c_primary_tag_handle = '\v\!'
+let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
+ \ '|'.s:c_secondary_tag_handle.
+ \ '|'.s:c_primary_tag_handle.')'
+let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
+let s:c_non_specific_tag = '\v\!'
+let s:ns_uri_char = '\v%(%\x\x|'.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
+let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
+let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
+ \ '\v|'.s:c_ns_shorthand_tag.
+ \ '\v|'.s:c_non_specific_tag
+
+let s:block_scalar_header = '\v[|>]%([+-]?[1-9]|[1-9]?[+-])?'
+
function GetYAMLIndent(lnum)
if a:lnum == 1 || !prevnonblank(a:lnum-1)
return 0
@@ -127,7 +149,10 @@ function GetYAMLIndent(lnum)
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex
+ elseif prevline =~# s:mapkeyregex . '\v\s*%(%('.s:c_ns_tag_property.
+ \ '\v|'.s:c_ns_anchor_property.
+ \ '\v|'.s:block_scalar_header.
+ \ '\v)%(\s+|\s*%(\#.*)?$))*'
" Mapping with: value
" that is multiline scalar
return previndent+s:shiftwidth()
diff --git a/runtime/keymap/pinyin.vim b/runtime/keymap/pinyin.vim
index 757850b83f..253814c753 100644
--- a/runtime/keymap/pinyin.vim
+++ b/runtime/keymap/pinyin.vim
@@ -1,5 +1,5 @@
" Vim Keymap file for Hanyu Pinyin tone marks through numbers.
-" Maintainer: Fredrik Roubert <roubert@df.lth.se>
+" Maintainer: Fredrik Roubert <fredrik@roubert.name>
" Last Changed: February 15, 2004
" All characters are given literally.
diff --git a/runtime/keymap/russian-jcukenmac.vim b/runtime/keymap/russian-jcukenmac.vim
new file mode 100644
index 0000000000..e2120ca1d4
--- /dev/null
+++ b/runtime/keymap/russian-jcukenmac.vim
@@ -0,0 +1,94 @@
+" Vim Keymap file for russian characters, layout 'jcuken', Mac variant
+
+" Derived from russian-jcuken.vim by Artem Chuprina <ran@ran.pp.ru>
+" Maintainer: Anton Fonarev <avfonarev@gmail.com>
+" Last Changed: 2016 August 17
+
+" All characters are given literally, conversion to another encoding (e.g.,
+" UTF-8) should work.
+
+scriptencoding utf-8
+
+let b:keymap_name = "ru"
+
+loadkeymap
+
+\| Ё CYRILLIC CAPITAL LETTER IO
+\\ ё CYRILLIC SMALL LETTER IO
+
+F А CYRILLIC CAPITAL LETTER A
+< Б CYRILLIC CAPITAL LETTER BE
+D В CYRILLIC CAPITAL LETTER VE
+U Г CYRILLIC CAPITAL LETTER GHE
+L Д CYRILLIC CAPITAL LETTER DE
+T Е CYRILLIC CAPITAL LETTER IE
+: Ж CYRILLIC CAPITAL LETTER ZHE
+P З CYRILLIC CAPITAL LETTER ZE
+B И CYRILLIC CAPITAL LETTER I
+Q Й CYRILLIC CAPITAL LETTER SHORT I
+R К CYRILLIC CAPITAL LETTER KA
+K Л CYRILLIC CAPITAL LETTER EL
+V М CYRILLIC CAPITAL LETTER EM
+Y Н CYRILLIC CAPITAL LETTER EN
+J О CYRILLIC CAPITAL LETTER O
+G П CYRILLIC CAPITAL LETTER PE
+H Р CYRILLIC CAPITAL LETTER ER
+C С CYRILLIC CAPITAL LETTER ES
+N Т CYRILLIC CAPITAL LETTER TE
+E У CYRILLIC CAPITAL LETTER U
+A Ф CYRILLIC CAPITAL LETTER EF
+{ Х CYRILLIC CAPITAL LETTER HA
+W Ц CYRILLIC CAPITAL LETTER TSE
+X Ч CYRILLIC CAPITAL LETTER CHE
+I Ш CYRILLIC CAPITAL LETTER SHA
+O Щ CYRILLIC CAPITAL LETTER SHCHA
+} Ъ CYRILLIC CAPITAL LETTER HARD SIGN
+S Ы CYRILLIC CAPITAL LETTER YERU
+M Ь CYRILLIC CAPITAL LETTER SOFT SIGN
+\" Э CYRILLIC CAPITAL LETTER E
+> Ю CYRILLIC CAPITAL LETTER YU
+Z Я CYRILLIC CAPITAL LETTER YA
+f а CYRILLIC SMALL LETTER A
+, б CYRILLIC SMALL LETTER BE
+d в CYRILLIC SMALL LETTER VE
+u г CYRILLIC SMALL LETTER GHE
+l д CYRILLIC SMALL LETTER DE
+t е CYRILLIC SMALL LETTER IE
+; ж CYRILLIC SMALL LETTER ZHE
+p з CYRILLIC SMALL LETTER ZE
+b и CYRILLIC SMALL LETTER I
+q й CYRILLIC SMALL LETTER SHORT I
+r к CYRILLIC SMALL LETTER KA
+k л CYRILLIC SMALL LETTER EL
+v м CYRILLIC SMALL LETTER EM
+y н CYRILLIC SMALL LETTER EN
+j о CYRILLIC SMALL LETTER O
+g п CYRILLIC SMALL LETTER PE
+h р CYRILLIC SMALL LETTER ER
+c с CYRILLIC SMALL LETTER ES
+n т CYRILLIC SMALL LETTER TE
+e у CYRILLIC SMALL LETTER U
+a ф CYRILLIC SMALL LETTER EF
+[ х CYRILLIC SMALL LETTER HA
+w ц CYRILLIC SMALL LETTER TSE
+x ч CYRILLIC SMALL LETTER CHE
+i ш CYRILLIC SMALL LETTER SHA
+o щ CYRILLIC SMALL LETTER SHCHA
+] ъ CYRILLIC SMALL LETTER HARD SIGN
+s ы CYRILLIC SMALL LETTER YERU
+m ь CYRILLIC SMALL LETTER SOFT SIGN
+' э CYRILLIC SMALL LETTER E
+. ю CYRILLIC SMALL LETTER YU
+z я CYRILLIC SMALL LETTER YA
+
+§ >
+± <
+@ "
+# №
+$ %
+% :
+^ ,
+& .
+* ;
+` ]
+~ [
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 64726937a0..36d1741362 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2016 Aug 12
+" Last Change: 2016 Aug 21
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -589,8 +589,6 @@ if has("gui")
call append("$", "toolbariconsize\tsize of toolbar icons")
call <SID>OptionG("tbis", &tbis)
endif
- call append("$", "guiheadroom\troom (in pixels) left above/below the window")
- call append("$", " \tset ghr=" . &ghr)
endif
if has("browse")
call append("$", "browsedir\t\"last\", \"buffer\" or \"current\": which directory used for the file browser")
@@ -1148,8 +1146,8 @@ endif
if has("langmap")
call append("$", "langmap\tlist of characters that are translated in Normal mode")
call <SID>OptionG("lmap", &lmap)
- call append("$", "langnoremap\tdon't apply 'langmap' to mapped characters")
- call <SID>BinOptionG("lnr", &lnr)
+ call append("$", "langremap\tapply 'langmap' to mapped characters")
+ call <SID>BinOptionG("lrm", &lrm)
endif
if has("xim")
call append("$", "imdisable\twhen set never use IM; overrules following IM options")
diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim
index c0f1f08027..f275f7b36d 100644
--- a/runtime/plugin/matchit.vim
+++ b/runtime/plugin/matchit.vim
@@ -1,8 +1,10 @@
" matchit.vim: (global plugin) Extended "%" matching
-" Last Change: Fri Jul 29 01:20 AM 2016 EST
+" Last Change: 2016 Aug 21
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
" Version: 1.13.2, for Vim 6.3+
" Fix from Tommy Allen included.
+" Fix from Fernando Torres included.
+" Improvement from Ken Takata included.
" URL: http://www.vim.org/script.php?script_id=39
" Documentation:
@@ -44,6 +46,7 @@ endif
let loaded_matchit = 1
let s:last_mps = ""
let s:last_words = ":"
+let s:patBR = ""
let s:save_cpo = &cpo
set cpo&vim
@@ -121,8 +124,8 @@ function! s:Match_wrapper(word, forward, mode) range
execute "let match_words =" b:match_words
endif
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion!
- if (match_words != s:last_words) || (&mps != s:last_mps) ||
- \ exists("b:match_debug")
+ if (match_words != s:last_words) || (&mps != s:last_mps)
+ \ || exists("b:match_debug")
let s:last_mps = &mps
" The next several lines were here before
" BF started messing with this script.
@@ -148,6 +151,10 @@ function! s:Match_wrapper(word, forward, mode) range
if exists("b:match_debug")
let b:match_pat = s:pat
endif
+ " Reconstruct the version with unresolved backrefs.
+ let s:patBR = substitute(match_words.',',
+ \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
+ let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g')
endif
" Second step: set the following local variables:
@@ -192,14 +199,10 @@ function! s:Match_wrapper(word, forward, mode) range
" group = colon-separated list of patterns, one of which matches
" = ini:mid:fin or ini:fin
"
- " Reconstruct the version with unresolved backrefs.
- let patBR = substitute(match_words.',',
- \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
- let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g')
" Now, set group and groupBR to the matching group: 'if:endif' or
" 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns
" group . "," . groupBR, and we pick it apart.
- let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
+ let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, s:patBR)
let i = matchend(group, s:notslash . ",")
let groupBR = strpart(group, i)
let group = strpart(group, 0, i-1)
@@ -656,6 +659,7 @@ fun! s:MultiMatch(spflag, mode)
\ exists("b:match_debug")
let s:last_words = match_words
let s:last_mps = &mps
+ let match_words = match_words . (strlen(match_words) ? "," : "") . default
if match_words !~ s:notslash . '\\\d'
let s:do_BR = 0
let s:pat = match_words
@@ -663,8 +667,8 @@ fun! s:MultiMatch(spflag, mode)
let s:do_BR = 1
let s:pat = s:ParseWords(match_words)
endif
- let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default,
- \ '[,:]\+','\\|','g') . '\)'
+ let s:all = '\%(' . substitute(s:pat . (strlen(s:pat) ? "," : "") . default,
+ \ '[,:]\+', '\\|', 'g') . '\)'
if exists("b:match_debug")
let b:match_pat = s:pat
endif
diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim
index b470e56f60..06e5390c60 100644
--- a/runtime/syntax/fortran.vim
+++ b/runtime/syntax/fortran.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: 0.97
-" Last Change: 2016 Feb. 26
+" Version: 0.98
+" Last Change: 2016 Aug. 26
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-syntax from Vim
" Credits:
@@ -10,7 +10,8 @@
" in chronological order, by:
" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
" Walter Dieudonn, Alexander Wagner, Roman Bertle, Charles Rendleman,
-" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, and Jan Hermann.
+" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann,
+" Stefano Zaghi and Vishnu Krishnan.
if exists("b:current_syntax")
finish
@@ -108,6 +109,7 @@ syn match fortranUnitHeader "\<subroutine\>"
syn keyword fortranCall call
syn match fortranUnitHeader "\<function\>"
syn match fortranUnitHeader "\<program\>"
+syn match fortranUnitHeader "\<block\>"
syn keyword fortranKeyword return stop
syn keyword fortranConditional else then
syn match fortranConditional "\<if\>"
@@ -208,6 +210,7 @@ syn match fortranStorageClass "\<kind\s*="me=s+4
syn match fortranStorageClass "\<len\s*="me=s+3
syn match fortranUnitHeader "\<module\>"
+syn match fortranUnitHeader "\<submodule\>"
syn keyword fortranUnitHeader use only contains
syn keyword fortranUnitHeader result operator assignment
syn match fortranUnitHeader "\<interface\>"
@@ -231,8 +234,10 @@ syn match fortranIntrinsic "\<kind\>\s*[(,]"me=s+4
syn match fortranUnitHeader "\<end\s*function"
syn match fortranUnitHeader "\<end\s*interface"
syn match fortranUnitHeader "\<end\s*module"
+syn match fortranUnitHeader "\<end\s*submodule"
syn match fortranUnitHeader "\<end\s*program"
syn match fortranUnitHeader "\<end\s*subroutine"
+syn match fortranUnitHeader "\<end\s*block"
syn match fortranRepeat "\<end\s*do"
syn match fortranConditional "\<end\s*where"
syn match fortranConditional "\<select\s*case"
@@ -267,6 +272,7 @@ syn match fortranRepeat "\<end\s*forall"
syn keyword fortranIntrinsic null cpu_time
syn match fortranType "\<elemental\>"
syn match fortranType "\<pure\>"
+syn match fortranType "\<impure\>"
if exists("fortran_more_precise")
syn match fortranConstructName "\(\<end\s*forall\s\+\)\@<=\a\w*\>"
endif
@@ -286,8 +292,9 @@ if b:fortran_dialect == "f08"
syn keyword fortranReadWrite flush wait
syn keyword fortranIO decimal round iomsg
- syn keyword fortranType asynchronous nopass non_overridable pass protected volatile abstract extends import
+ syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import
syn keyword fortranType non_intrinsic value bind deferred generic final enumerator
+ syn match fortranType "\<abstract\>"
syn match fortranType "\<class\>"
syn match fortranType "\<associate\>"
syn match fortranType "\<end\s*associate"
@@ -305,6 +312,7 @@ if b:fortran_dialect == "f08"
syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image
syn keyword fortranIO newunit
syn keyword fortranType contiguous
+ syn keyword fortranRepeat concurrent
" CUDA fortran
syn match fortranTypeCUDA "\<attributes\>"
@@ -383,20 +391,22 @@ if exists("fortran_fold")
if (b:fortran_fixed_source == 1)
syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule
syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram
- syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface
else
syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule
syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram
- syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranInterface transparent fold keepend extend start="^\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface
endif
if exists("fortran_fold_conditionals")
diff --git a/runtime/syntax/muttrc.vim b/runtime/syntax/muttrc.vim
index abe9bfd76b..94b27313b2 100644
--- a/runtime/syntax/muttrc.vim
+++ b/runtime/syntax/muttrc.vim
@@ -2,10 +2,9 @@
" Language: Mutt setup files
" Original: Preben 'Peppe' Guldberg <peppe-vim@wielders.org>
" Maintainer: Kyle Wheeler <kyle-muttrc.vim@memoryhole.net>
-" Last Change: 2 Feb 2012
+" Last Change: 18 August 2016
-" This file covers mutt version 1.5.21 (and most of the mercurial tip)
-" Included are also a few features from 1.4.2.1
+" This file covers mutt version 1.7.0
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -98,7 +97,7 @@ syn match muttrcSetNumAssignment contained skipwhite /=\s*'\d\+'/hs=s+1 nextgrou
" Now catch some email addresses and headers (purified version from mail.vim)
syn match muttrcEmail "[a-zA-Z0-9._-]\+@[a-zA-Z0-9./-]\+"
-syn match muttrcHeader "\<\%(From\|To\|C[Cc]\|B[Cc][Cc]\|Reply-To\|Subject\|Return-Path\|Received\|Date\|Replied\|Attach\)\>:\="
+syn match muttrcHeader "\<\c\%(From\|To\|C[Cc]\|B[Cc][Cc]\|Reply-To\|Subject\|Return-Path\|Received\|Date\|Replied\|Attach\)\>:\="
syn match muttrcKeySpecial contained +\%(\\[Cc'"]\|\^\|\\[01]\d\{2}\)+
syn match muttrcKey contained "\S\+" contains=muttrcKeySpecial,muttrcKeyName
@@ -109,143 +108,146 @@ syn match muttrcKeyName contained "\\[trne]"
syn match muttrcKeyName contained "\c<\%(BackSpace\|BackTab\|Delete\|Down\|End\|Enter\|Esc\|Home\|Insert\|Left\|PageDown\|PageUp\|Return\|Right\|Space\|Tab\|Up\)>"
syn match muttrcKeyName contained "<F[0-9]\+>"
-syn keyword muttrcVarBool skipwhite contained allow_8bit allow_ansi arrow_cursor ascii_chars askbcc askcc attach_split auto_tag autoedit beep beep_new nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained bounce_delivered braille_friendly check_new check_mbox_size nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained collapse_unread confirmappend confirmcreate crypt_autoencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained crypt_autopgp crypt_autosign crypt_autosmime crypt_replyencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained crypt_replysign crypt_replysignencrypted crypt_timestamp nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained crypt_use_gpgme crypt_use_pka delete_untag digest_collapse duplicate_threads nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained edit_hdrs edit_headers encode_from envelope_from fast_reply nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained fcc_clear followup_to force_name forw_decode nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained forw_decrypt forw_quote forward_decode forward_decrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained forward_quote hdrs header help hidden_host hide_limited nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained hide_missing hide_thread_subject hide_top_limited nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained hide_top_missing honor_disposition ignore_linear_white_space ignore_list_reply_to imap_check_subscribed nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained imap_list_subscribed imap_passive imap_peek imap_servernoise nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained implicit_autoview include_onlyfirst keep_flagged nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained mailcap_sanitize maildir_header_cache_verify maildir_trash nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained mark_old markers menu_move_off menu_scroll message_cache_clean meta_key nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained metoo mh_purge mime_forward_decode narrow_tree pager_stop nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_auto_decode pgp_auto_traditional pgp_autoencrypt nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_autoinline pgp_autosign pgp_check_exit nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_create_traditional pgp_ignore_subkeys pgp_long_ids nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_replyencrypt pgp_replyinline pgp_replysign nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_replysignencrypted pgp_retainable_sigs pgp_show_unusable nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pgp_strict_enc pgp_use_gpg_agent pipe_decode pipe_split nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained pop_auth_try_all pop_last print_decode print_split nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained prompt_after read_only reply_self resolve reverse_alias nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained reverse_name reverse_realname rfc2047_parameters save_address nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained save_empty save_name score sig_dashes sig_on_top nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained smart_wrap smime_ask_cert_label smime_decrypt_use_default_key nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained smime_is_default sort_re ssl_force_tls ssl_use_sslv2 nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained ssl_use_sslv3 ssl_use_tlsv1 ssl_usesystemcerts ssl_verify_dates ssl_verify_host status_on_top nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained strict_mime strict_threads suspend text_flowed thorough_search nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained thread_received tilde uncollapse_jump use_8bitmime nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained use_domain use_envelope_from use_from use_idn use_ipv6 nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained user_agent wait_key weed wrap_search write_bcc nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syn keyword muttrcVarBool skipwhite contained noallow_8bit noallow_ansi noarrow_cursor noascii_chars noaskbcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noaskcc noattach_split noauto_tag noautoedit nobeep nobeep_new nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nobounce_delivered nobraille_friendly nocheck_new nocollapse_unread nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noconfirmappend noconfirmcreate nocrypt_autoencrypt nocrypt_autopgp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nocrypt_autosign nocrypt_autosmime nocrypt_replyencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nocrypt_replysign nocrypt_replysignencrypted nocrypt_timestamp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nocrypt_use_gpgme nodelete_untag nodigest_collapse noduplicate_threads nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noedit_hdrs noedit_headers noencode_from noenvelope_from nofast_reply nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nofcc_clear nofollowup_to noforce_name noforw_decode nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noforw_decrypt noforw_quote noforward_decode noforward_decrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noforward_quote nohdrs noheader nohelp nohidden_host nohide_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nohide_missing nohide_thread_subject nohide_top_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nohide_top_missing nohonor_disposition noignore_list_reply_to noimap_check_subscribed nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noimap_list_subscribed noimap_passive noimap_peek noimap_servernoise nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noimplicit_autoview noinclude_onlyfirst nokeep_flagged nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nomailcap_sanitize nomaildir_header_cache_verify nomaildir_trash nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nomark_old nomarkers nomenu_move_off nomenu_scroll nometa_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nometoo nomh_purge nomime_forward_decode nonarrow_tree nopager_stop nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_auto_decode nopgp_auto_traditional nopgp_autoencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_autoinline nopgp_autosign nopgp_check_exit nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_create_traditional nopgp_ignore_subkeys nopgp_long_ids nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_replyencrypt nopgp_replyinline nopgp_replysign nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_replysignencrypted nopgp_retainable_sigs nopgp_show_unusable nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopgp_strict_enc nopgp_use_gpg_agent nopipe_decode nopipe_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nopop_auth_try_all nopop_last noprint_decode noprint_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noprompt_after noread_only noreply_self noresolve noreverse_alias nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained noreverse_name noreverse_realname norfc2047_parameters nosave_address nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nosave_empty nosave_name noscore nosig_dashes nosig_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nosmart_wrap nosmime_ask_cert_label nosmime_decrypt_use_default_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nosmime_is_default nosort_re nossl_force_tls nossl_use_sslv2 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nossl_use_sslv3 nossl_use_tlsv1 nossl_usesystemcerts nostatus_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nostrict_threads nosuspend notext_flowed nothorough_search nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nothread_received notilde nouncollapse_jump nouse_8bitmime nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nouse_domain nouse_envelope_from nouse_from nouse_idn nouse_ipv6 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained nouser_agent nowait_key noweed nowrap_search nowrite_bcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syn keyword muttrcVarBool skipwhite contained invallow_8bit invallow_ansi invarrow_cursor invascii_chars invaskbcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invaskcc invattach_split invauto_tag invautoedit invbeep invbeep_new nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invbounce_delivered invbraille_friendly invcheck_new invcollapse_unread nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invconfirmappend invconfirmcreate invcrypt_autoencrypt invcrypt_autopgp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invcrypt_autosign invcrypt_autosmime invcrypt_replyencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invcrypt_replysign invcrypt_replysignencrypted invcrypt_timestamp nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invcrypt_use_gpgme invdelete_untag invdigest_collapse invduplicate_threads nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invedit_hdrs invedit_headers invencode_from invenvelope_from invfast_reply nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invfcc_clear invfollowup_to invforce_name invforw_decode nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invforw_decrypt invforw_quote invforward_decode invforward_decrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invforward_quote invhdrs invheader invhelp invhidden_host invhide_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invhide_missing invhide_thread_subject invhide_top_limited nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invhide_top_missing invhonor_disposition invignore_list_reply_to invimap_check_subscribed nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invimap_list_subscribed invimap_passive invimap_peek invimap_servernoise nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invimplicit_autoview invinclude_onlyfirst invkeep_flagged nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invmailcap_sanitize invmaildir_header_cache_verify invmaildir_trash nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invmark_old invmarkers invmenu_move_off invmenu_scroll invmeta_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invmetoo invmh_purge invmime_forward_decode invnarrow_tree invpager_stop nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_auto_decode invpgp_auto_traditional invpgp_autoencrypt nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_autoinline invpgp_autosign invpgp_check_exit nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_create_traditional invpgp_ignore_subkeys invpgp_long_ids nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_replyencrypt invpgp_replyinline invpgp_replysign nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_replysignencrypted invpgp_retainable_sigs invpgp_show_unusable nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpgp_strict_enc invpgp_use_gpg_agent invpipe_decode invpipe_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invpop_auth_try_all invpop_last invprint_decode invprint_split nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invprompt_after invread_only invreply_self invresolve invreverse_alias nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invreverse_name invreverse_realname invrfc2047_parameters invsave_address nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invsave_empty invsave_name invscore invsig_dashes invsig_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invsmart_wrap invsmime_ask_cert_label invsmime_decrypt_use_default_key nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invsmime_is_default invsort_re invssl_force_tls invssl_use_sslv2 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invssl_use_sslv3 invssl_use_tlsv1 invssl_usesystemcerts invstatus_on_top nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invstrict_threads invsuspend invtext_flowed invthorough_search nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invthread_received invtilde invuncollapse_jump invuse_8bitmime nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invuse_domain invuse_envelope_from invuse_from invuse_idn invuse_ipv6 nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarBool skipwhite contained invuser_agent invwait_key invweed invwrap_search invwrite_bcc nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-if use_mutt_sidebar == 1
- syn keyword muttrcVarBool skipwhite contained sidebar_visible sidebar_sort nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-endif
-
-syn keyword muttrcVarQuad skipwhite contained abort_nosubject abort_unmodified bounce copy nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained crypt_verify_sig delete fcc_attach forward_edit honor_followup_to nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained include mime_forward mime_forward_rest mime_fwd move nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained pgp_mime_auto pgp_verify_sig pop_delete pop_reconnect nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained postpone print quit recall reply_to ssl_starttls nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syn keyword muttrcVarQuad skipwhite contained noabort_nosubject noabort_unmodified nobounce nocopy nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained nocrypt_verify_sig nodelete nofcc_attach noforward_edit nohonor_followup_to nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained noinclude nomime_forward nomime_forward_rest nomime_fwd nomove nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained nopgp_mime_auto nopgp_verify_sig nopop_delete nopop_reconnect nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained nopostpone noprint noquit norecall noreply_to nossl_starttls nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syn keyword muttrcVarQuad skipwhite contained invabort_nosubject invabort_unmodified invbounce invcopy nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained invcrypt_verify_sig invdelete invfcc_attach invforward_edit invhonor_followup_to nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained invinclude invmime_forward invmime_forward_rest invmime_fwd invmove nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained invpgp_mime_auto invpgp_verify_sig invpop_delete invpop_reconnect nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarQuad skipwhite contained invpostpone invprint invquit invrecall invreply_to invssl_starttls nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-
-syn keyword muttrcVarNum skipwhite contained connect_timeout history imap_keepalive imap_pipeline_depth mail_check nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarNum skipwhite contained menu_context net_inc pager_context pager_index_lines pgp_timeout nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarNum skipwhite contained pop_checkinterval read_inc save_history score_threshold_delete nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarNum skipwhite contained score_threshold_flag score_threshold_read search_context sendmail_wait sleep_time nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarNum skipwhite contained smime_timeout ssl_min_dh_prime_bits timeout time_inc wrap wrapmargin nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarNum skipwhite contained write_inc nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-if use_mutt_sidebar == 1
- syn keyword muttrcVarNum skipwhite contained sidebar_width nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-endif
+syn keyword muttrcVarBool skipwhite contained
+ \ allow_8bit allow_ansi arrow_cursor ascii_chars askbcc askcc attach_split
+ \ auto_tag autoedit beep beep_new bounce_delivered braille_friendly
+ \ check_mbox_size check_new collapse_unread confirmappend confirmcreate
+ \ crypt_autoencrypt crypt_autopgp crypt_autosign crypt_autosmime
+ \ crypt_confirmhook crypt_opportunistic_encrypt crypt_replyencrypt
+ \ crypt_replysign crypt_replysignencrypted crypt_timestamp crypt_use_gpgme
+ \ crypt_use_pka delete_untag digest_collapse duplicate_threads edit_hdrs
+ \ edit_headers encode_from envelope_from fast_reply fcc_clear followup_to
+ \ force_name forw_decode forw_decrypt forw_quote forward_decode forward_decrypt
+ \ forward_quote hdrs header help hidden_host hide_limited hide_missing
+ \ hide_thread_subject hide_top_limited hide_top_missing honor_disposition
+ \ idn_decode idn_encode ignore_linear_white_space ignore_list_reply_to
+ \ imap_check_subscribed imap_list_subscribed imap_passive imap_peek
+ \ imap_servernoise implicit_autoview include_onlyfirst keep_flagged
+ \ mail_check_recent mail_check_stats mailcap_sanitize maildir_check_cur
+ \ maildir_header_cache_verify maildir_trash mark_old markers menu_move_off
+ \ menu_scroll message_cache_clean meta_key metoo mh_purge mime_forward_decode
+ \ narrow_tree pager_stop pgp_auto_decode pgp_auto_traditional pgp_autoencrypt
+ \ pgp_autoinline pgp_autosign pgp_check_exit pgp_create_traditional
+ \ pgp_ignore_subkeys pgp_long_ids pgp_replyencrypt pgp_replyinline pgp_replysign
+ \ pgp_replysignencrypted pgp_retainable_sigs pgp_show_unusable pgp_strict_enc
+ \ pgp_use_gpg_agent pipe_decode pipe_split pop_auth_try_all pop_last
+ \ postpone_encrypt postpone_encrypt_as print_decode print_split prompt_after
+ \ read_only reflow_space_quotes reflow_text reflow_wrap reply_self resolve
+ \ resume_draft_files resume_edited_draft_files reverse_alias reverse_name
+ \ reverse_realname rfc2047_parameters save_address save_empty save_name score
+ \ sidebar_folder_indent sidebar_new_mail_only sidebar_next_new_wrap
+ \ sidebar_short_path sidebar_sort sidebar_visible sig_dashes sig_on_top
+ \ smart_wrap smime_ask_cert_label smime_decrypt_use_default_key smime_is_default
+ \ sort_re ssl_force_tls ssl_use_sslv2 ssl_use_sslv3 ssl_use_tlsv1
+ \ ssl_usesystemcerts ssl_verify_dates ssl_verify_host status_on_top strict_mime
+ \ strict_threads suspend text_flowed thorough_search thread_received tilde
+ \ ts_enabled uncollapse_jump use_8bitmime use_domain use_envelope_from use_from
+ \ use_idn use_ipv6 user_agent wait_key weed wrap_search write_bcc
+ \ nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarBool skipwhite contained
+ \ noallow_8bit noallow_ansi noarrow_cursor noascii_chars noaskbcc noaskcc noattach_split
+ \ noauto_tag noautoedit nobeep nobeep_new nobounce_delivered nobraille_friendly
+ \ nocheck_mbox_size nocheck_new nocollapse_unread noconfirmappend noconfirmcreate
+ \ nocrypt_autoencrypt nocrypt_autopgp nocrypt_autosign nocrypt_autosmime
+ \ nocrypt_confirmhook nocrypt_opportunistic_encrypt nocrypt_replyencrypt
+ \ nocrypt_replysign nocrypt_replysignencrypted nocrypt_timestamp nocrypt_use_gpgme
+ \ nocrypt_use_pka nodelete_untag nodigest_collapse noduplicate_threads noedit_hdrs
+ \ noedit_headers noencode_from noenvelope_from nofast_reply nofcc_clear nofollowup_to
+ \ noforce_name noforw_decode noforw_decrypt noforw_quote noforward_decode noforward_decrypt
+ \ noforward_quote nohdrs noheader nohelp nohidden_host nohide_limited nohide_missing
+ \ nohide_thread_subject nohide_top_limited nohide_top_missing nohonor_disposition
+ \ noidn_decode noidn_encode noignore_linear_white_space noignore_list_reply_to
+ \ noimap_check_subscribed noimap_list_subscribed noimap_passive noimap_peek
+ \ noimap_servernoise noimplicit_autoview noinclude_onlyfirst nokeep_flagged
+ \ nomail_check_recent nomail_check_stats nomailcap_sanitize nomaildir_check_cur
+ \ nomaildir_header_cache_verify nomaildir_trash nomark_old nomarkers nomenu_move_off
+ \ nomenu_scroll nomessage_cache_clean nometa_key nometoo nomh_purge nomime_forward_decode
+ \ nonarrow_tree nopager_stop nopgp_auto_decode nopgp_auto_traditional nopgp_autoencrypt
+ \ nopgp_autoinline nopgp_autosign nopgp_check_exit nopgp_create_traditional
+ \ nopgp_ignore_subkeys nopgp_long_ids nopgp_replyencrypt nopgp_replyinline nopgp_replysign
+ \ nopgp_replysignencrypted nopgp_retainable_sigs nopgp_show_unusable nopgp_strict_enc
+ \ nopgp_use_gpg_agent nopipe_decode nopipe_split nopop_auth_try_all nopop_last
+ \ nopostpone_encrypt nopostpone_encrypt_as noprint_decode noprint_split noprompt_after
+ \ noread_only noreflow_space_quotes noreflow_text noreflow_wrap noreply_self noresolve
+ \ noresume_draft_files noresume_edited_draft_files noreverse_alias noreverse_name
+ \ noreverse_realname norfc2047_parameters nosave_address nosave_empty nosave_name noscore
+ \ nosidebar_folder_indent nosidebar_new_mail_only nosidebar_next_new_wrap
+ \ nosidebar_short_path nosidebar_sort nosidebar_visible nosig_dashes nosig_on_top
+ \ nosmart_wrap nosmime_ask_cert_label nosmime_decrypt_use_default_key nosmime_is_default
+ \ nosort_re nossl_force_tls nossl_use_sslv2 nossl_use_sslv3 nossl_use_tlsv1
+ \ nossl_usesystemcerts nossl_verify_dates nossl_verify_host nostatus_on_top nostrict_mime
+ \ nostrict_threads nosuspend notext_flowed nothorough_search nothread_received notilde
+ \ nots_enabled nouncollapse_jump nouse_8bitmime nouse_domain nouse_envelope_from nouse_from
+ \ nouse_idn nouse_ipv6 nouser_agent nowait_key noweed nowrap_search nowrite_bcc
+ \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarBool skipwhite contained
+ \ invallow_8bit invallow_ansi invarrow_cursor invascii_chars invaskbcc invaskcc invattach_split
+ \ invauto_tag invautoedit invbeep invbeep_new invbounce_delivered invbraille_friendly
+ \ invcheck_mbox_size invcheck_new invcollapse_unread invconfirmappend invconfirmcreate
+ \ invcrypt_autoencrypt invcrypt_autopgp invcrypt_autosign invcrypt_autosmime
+ \ invcrypt_confirmhook invcrypt_opportunistic_encrypt invcrypt_replyencrypt
+ \ invcrypt_replysign invcrypt_replysignencrypted invcrypt_timestamp invcrypt_use_gpgme
+ \ invcrypt_use_pka invdelete_untag invdigest_collapse invduplicate_threads invedit_hdrs
+ \ invedit_headers invencode_from invenvelope_from invfast_reply invfcc_clear invfollowup_to
+ \ invforce_name invforw_decode invforw_decrypt invforw_quote invforward_decode invforward_decrypt
+ \ invforward_quote invhdrs invheader invhelp invhidden_host invhide_limited invhide_missing
+ \ invhide_thread_subject invhide_top_limited invhide_top_missing invhonor_disposition
+ \ invidn_decode invidn_encode invignore_linear_white_space invignore_list_reply_to
+ \ invimap_check_subscribed invimap_list_subscribed invimap_passive invimap_peek
+ \ invimap_servernoise invimplicit_autoview invinclude_onlyfirst invkeep_flagged
+ \ invmail_check_recent invmail_check_stats invmailcap_sanitize invmaildir_check_cur
+ \ invmaildir_header_cache_verify invmaildir_trash invmark_old invmarkers invmenu_move_off
+ \ invmenu_scroll invmessage_cache_clean invmeta_key invmetoo invmh_purge invmime_forward_decode
+ \ invnarrow_tree invpager_stop invpgp_auto_decode invpgp_auto_traditional invpgp_autoencrypt
+ \ invpgp_autoinline invpgp_autosign invpgp_check_exit invpgp_create_traditional
+ \ invpgp_ignore_subkeys invpgp_long_ids invpgp_replyencrypt invpgp_replyinline invpgp_replysign
+ \ invpgp_replysignencrypted invpgp_retainable_sigs invpgp_show_unusable invpgp_strict_enc
+ \ invpgp_use_gpg_agent invpipe_decode invpipe_split invpop_auth_try_all invpop_last
+ \ invpostpone_encrypt invpostpone_encrypt_as invprint_decode invprint_split invprompt_after
+ \ invread_only invreflow_space_quotes invreflow_text invreflow_wrap invreply_self invresolve
+ \ invresume_draft_files invresume_edited_draft_files invreverse_alias invreverse_name
+ \ invreverse_realname invrfc2047_parameters invsave_address invsave_empty invsave_name invscore
+ \ invsidebar_folder_indent invsidebar_new_mail_only invsidebar_next_new_wrap
+ \ invsidebar_short_path invsidebar_sort invsidebar_visible invsig_dashes invsig_on_top
+ \ invsmart_wrap invsmime_ask_cert_label invsmime_decrypt_use_default_key invsmime_is_default
+ \ invsort_re invssl_force_tls invssl_use_sslv2 invssl_use_sslv3 invssl_use_tlsv1
+ \ invssl_usesystemcerts invssl_verify_dates invssl_verify_host invstatus_on_top invstrict_mime
+ \ invstrict_threads invsuspend invtext_flowed invthorough_search invthread_received invtilde
+ \ invts_enabled invuncollapse_jump invuse_8bitmime invuse_domain invuse_envelope_from invuse_from
+ \ invuse_idn invuse_ipv6 invuser_agent invwait_key invweed invwrap_search invwrite_bcc
+ \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarQuad skipwhite contained
+ \ abort_nosubject abort_unmodified bounce copy crypt_verify_sig delete
+ \ fcc_attach forward_edit honor_followup_to include mime_forward
+ \ mime_forward_rest mime_fwd move pgp_mime_auto pgp_verify_sig pop_delete
+ \ pop_reconnect postpone print quit recall reply_to ssl_starttls
+ \ nextgroup=muttrcSetQuadAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarQuad skipwhite contained
+ \ noabort_nosubject noabort_unmodified nobounce nocopy nocrypt_verify_sig nodelete
+ \ nofcc_attach noforward_edit nohonor_followup_to noinclude nomime_forward
+ \ nomime_forward_rest nomime_fwd nomove nopgp_mime_auto nopgp_verify_sig nopop_delete
+ \ nopop_reconnect nopostpone noprint noquit norecall noreply_to nossl_starttls
+ \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarQuad skipwhite contained
+ \ invabort_nosubject invabort_unmodified invbounce invcopy invcrypt_verify_sig invdelete
+ \ invfcc_attach invforward_edit invhonor_followup_to invinclude invmime_forward
+ \ invmime_forward_rest invmime_fwd invmove invpgp_mime_auto invpgp_verify_sig invpop_delete
+ \ invpop_reconnect invpostpone invprint invquit invrecall invreply_to invssl_starttls
+ \ nextgroup=muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
+
+syn keyword muttrcVarNum skipwhite contained
+ \ connect_timeout history imap_keepalive imap_pipeline_depth mail_check
+ \ mail_check_stats_interval menu_context net_inc pager_context pager_index_lines
+ \ pgp_timeout pop_checkinterval read_inc save_history score_threshold_delete
+ \ score_threshold_flag score_threshold_read search_context sendmail_wait
+ \ sidebar_width sleep_time smime_timeout ssl_min_dh_prime_bits time_inc timeout
+ \ wrap wrap_headers wrapmargin write_inc
+ \ nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syn match muttrcFormatErrors contained /%./
@@ -349,7 +351,7 @@ syn keyword muttrcVarStr contained skipwhite query_format nextgroup=muttrcVarEqu
syn match muttrcVarEqualsQueryFmt contained skipwhite "=" nextgroup=muttrcQueryFormatStr
syn keyword muttrcVarStr contained skipwhite pgp_decode_command pgp_verify_command pgp_decrypt_command pgp_clearsign_command pgp_sign_command pgp_encrypt_sign_command pgp_encrypt_only_command pgp_import_command pgp_export_command pgp_verify_key_command pgp_list_secring_command pgp_list_pubring_command nextgroup=muttrcVarEqualsPGPCmdFmt
syn match muttrcVarEqualsPGPCmdFmt contained skipwhite "=" nextgroup=muttrcPGPCmdFormatStr
-syn keyword muttrcVarStr contained skipwhite status_format nextgroup=muttrcVarEqualsStatusFmt
+syn keyword muttrcVarStr contained skipwhite ts_icon_format ts_status_format status_format nextgroup=muttrcVarEqualsStatusFmt
syn match muttrcVarEqualsStatusFmt contained skipwhite "=" nextgroup=muttrcStatusFormatStr
syn keyword muttrcVarStr contained skipwhite pgp_getkeys_command nextgroup=muttrcVarEqualsPGPGetKeysFmt
syn match muttrcVarEqualsPGPGetKeysFmt contained skipwhite "=" nextgroup=muttrcPGPGetKeysFormatStr
@@ -361,34 +363,29 @@ syn match muttrcVarEqualsStrftimeFmt contained skipwhite "=" nextgroup=muttrcStr
syn match muttrcVPrefix contained /[?&]/ nextgroup=muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syn match muttrcVarStr contained skipwhite 'my_[a-zA-Z0-9_]\+' nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite alias_file assumed_charset attach_charset attach_sep nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite certificate_file charset config_charset content_type nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite default_hook display_filter dotlock_program dsn_notify nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite dsn_return editor entropy_file envelope_from_address escape folder nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite forw_format forward_format from gecos_mask hdr_format nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite header_cache header_cache_compress header_cache_pagesize nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite history_file hostname imap_authenticators nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite imap_delim_chars imap_headers imap_idle imap_login imap_pass nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite imap_user indent_str indent_string ispell locale mailcap_path nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite mask mbox mbox_type message_cachedir mh_seq_flagged mh_seq_replied nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite mh_seq_unseen mixmaster msg_format pager nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite pgp_good_sign nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite pgp_mime_signature_filename nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite pgp_mime_signature_description pgp_sign_as nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite pgp_sort_keys nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite pipe_sep pop_authenticators pop_host pop_pass pop_user post_indent_str nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite post_indent_string postponed preconnect print_cmd print_command nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite query_command quote_regexp realname record reply_regexp send_charset nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite sendmail shell signature simple_search smileys smime_ca_location nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite smime_certificates smime_default_key nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite smime_encrypt_with nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite smime_keys smime_sign_as nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite smtp_url smtp_authenticators smtp_pass sort sort_alias sort_aux nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite sort_browser spam_separator spoolfile ssl_ca_certificates_file ssl_client_cert nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-syn keyword muttrcVarStr contained skipwhite status_chars tmpdir to_chars tunnel visual nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-if use_mutt_sidebar == 1
- syn keyword muttrcVarStr skipwhite contained sidebar_delim nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
-endif
+syn keyword muttrcVarStr contained skipwhite
+ \ alias_file assumed_charset attach_charset attach_sep certificate_file charset
+ \ config_charset content_type default_hook display_filter dotlock_program
+ \ dsn_notify dsn_return editor entropy_file envelope_from_address escape folder
+ \ forw_format forward_format from gecos_mask hdr_format header_cache
+ \ header_cache_compress header_cache_pagesize history_file hostname
+ \ imap_authenticators imap_delim_chars imap_headers imap_idle imap_login
+ \ imap_pass imap_user indent_str indent_string ispell locale mailcap_path mask
+ \ mbox mbox_type message_cachedir mh_seq_flagged mh_seq_replied mh_seq_unseen
+ \ mixmaster msg_format pager pgp_decryption_okay pgp_good_sign
+ \ pgp_mime_signature_description pgp_mime_signature_filename pgp_sign_as
+ \ pgp_sort_keys pipe_sep pop_authenticators pop_host pop_pass pop_user
+ \ post_indent_str post_indent_string postpone_encrypt_as postponed preconnect
+ \ print_cmd print_command query_command quote_regexp realname record
+ \ reply_regexp send_charset sendmail shell sidebar_delim sidebar_delim_chars
+ \ sidebar_divider_char sidebar_format sidebar_indent_string sidebar_sort_method
+ \ signature simple_search smileys smime_ca_location smime_certificates
+ \ smime_default_key smime_encrypt_with smime_keys smime_sign_as
+ \ smime_sign_digest_alg smtp_authenticators smtp_pass smtp_url sort sort_alias
+ \ sort_aux sort_browser spam_separator spoolfile ssl_ca_certificates_file
+ \ ssl_ciphers ssl_client_cert status_chars tmpdir to_chars trash ts_icon_format
+ \ ts_status_format tunnel visual
+ \ nextgroup=muttrcSetStrAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
" Present in 1.4.2.1 (pgp_create_traditional was a bool then)
syn keyword muttrcVarBool contained skipwhite imap_force_ssl noimap_force_ssl invimap_force_ssl nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
@@ -401,12 +398,11 @@ syn match muttrcMenuCommas /,/ contained
syn keyword muttrcHooks contained skipwhite account-hook charset-hook iconv-hook message-hook folder-hook mbox-hook save-hook fcc-hook fcc-save-hook send-hook send2-hook reply-hook crypt-hook
-syn keyword muttrcCommand auto_view alternative_order exec unalternative_order
-syn keyword muttrcCommand hdr_order iconv-hook ignore mailboxes my_hdr unmailboxes
-syn keyword muttrcCommand pgp-hook push score source unauto_view unhdr_order
-syn keyword muttrcCommand unignore unmono unmy_hdr unscore
-syn keyword muttrcCommand mime_lookup unmime_lookup ungroup
-syn keyword muttrcCommand unalternative_order
+syn keyword muttrcCommand skipwhite
+ \ alternative_order auto_view exec hdr_order iconv-hook ignore mailboxes
+ \ mailto_allow mime_lookup my_hdr pgp-hook push score sidebar_whitelist source
+ \ unalternative_order unalternative_order unauto_view ungroup unhdr_order
+ \ unignore unmailboxes unmailto_allow unmime_lookup unmono unmy_hdr unscore
syn keyword muttrcCommand skipwhite charset-hook nextgroup=muttrcRXString
syn keyword muttrcCommand skipwhite unhook nextgroup=muttrcHooks
@@ -441,7 +437,7 @@ syn match muttrcVariableInner contained "\$[a-zA-Z_-]\+"
syn match muttrcEscapedVariable contained "\\\$[a-zA-Z_-]\+"
syn match muttrcBadAction contained "[^<>]\+" contains=muttrcEmail
-syn match muttrcFunction contained "\<\%(attach\|bounce\|copy\|delete\|display\|flag\|forward\|parent\|pipe\|postpone\|print\|recall\|resend\|save\|send\|tag\|undelete\)-message\>"
+syn match muttrcFunction contained "\<\%(attach\|bounce\|copy\|delete\|display\|flag\|forward\|parent\|pipe\|postpone\|print\|purge\|recall\|resend\|save\|send\|tag\|undelete\)-message\>"
syn match muttrcFunction contained "\<\%(delete\|next\|previous\|read\|tag\|break\|undelete\)-thread\>"
syn match muttrcFunction contained "\<link-threads\>"
syn match muttrcFunction contained "\<\%(backward\|capitalize\|downcase\|forward\|kill\|upcase\)-word\>"
@@ -465,11 +461,13 @@ syn match muttrcFunction contained "\<show-\%(limit\|version\)\>"
syn match muttrcFunction contained "\<sort-\%(mailbox\|reverse\)\>"
syn match muttrcFunction contained "\<tag-\%(pattern\|\%(sub\)\?thread\|prefix\%(-cond\)\?\)\>"
syn match muttrcFunction contained "\<end-cond\>"
+syn match muttrcFunction contained "\<sidebar-\%(next\|next-new\|open\|page-down\|page-up\|prev\|prev-new\|toggle-visible\)\>"
syn match muttrcFunction contained "\<toggle-\%(mailboxes\|new\|quoted\|subscribed\|unlink\|write\)\>"
syn match muttrcFunction contained "\<undelete-\%(pattern\|subthread\)\>"
syn match muttrcFunction contained "\<collapse-\%(parts\|thread\|all\)\>"
syn match muttrcFunction contained "\<view-\%(attach\|attachments\|file\|mailcap\|name\|text\)\>"
syn match muttrcFunction contained "\<\%(backspace\|backward-char\|bol\|bottom\|bottom-page\|buffy-cycle\|clear-flag\|complete\%(-query\)\?\|copy-file\|create-alias\|detach-file\|eol\|exit\|extract-keys\|\%(imap-\)\?fetch-mail\|forget-passphrase\|forward-char\|group-reply\|help\|ispell\|jump\|limit\|list-reply\|mail\|mail-key\|mark-as-new\|middle-page\|new-mime\|noop\|pgp-menu\|query\|query-append\|quit\|quote-char\|read-subthread\|redraw-screen\|refresh\|rename-file\|reply\|select-new\|set-flag\|shell-escape\|skip-quoted\|sort\|subscribe\|sync-mailbox\|top\|top-page\|transpose-chars\|unsubscribe\|untag-pattern\|verify-key\|what-key\|write-fcc\)\>"
+syn keyword muttrcFunction contained imap-logout-all
if use_mutt_sidebar == 1
syn match muttrcFunction contained "\<sidebar-\%(prev\|next\|open\|scroll-up\|scroll-down\)"
endif
@@ -578,7 +576,11 @@ syn match muttrcColorMatchCount contained "[0-9]\+"
syn match muttrcColorMatchCountNL contained skipwhite skipnl "\s*\\$" nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL
syn region muttrcColorRXPat contained start=+\s*'+ skip=+\\'+ end=+'\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL
syn region muttrcColorRXPat contained start=+\s*"+ skip=+\\"+ end=+"\s*+ keepend skipwhite contains=muttrcRXString2 nextgroup=muttrcColorMatchCount,muttrcColorMatchCountNL
-syn keyword muttrcColorField contained attachment body bold error hdrdefault header index indicator markers message normal quoted search signature status tilde tree underline
+syn keyword muttrcColorField skipwhite contained
+ \ attachment body bold error hdrdefault header index indicator markers message
+ \ normal prompt quoted search sidebar-divider sidebar-flagged sidebar-highlight
+ \ sidebar-indicator sidebar-new sidebar-spoolfile signature status tilde tree
+ \ underline
syn match muttrcColorField contained "\<quoted\d\=\>"
if use_mutt_sidebar == 1
syn keyword muttrcColorField contained sidebar_new
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim
index fa42b3e2d2..f0f03a8c8d 100644
--- a/runtime/syntax/python.vim
+++ b/runtime/syntax/python.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Python
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
-" Last Change: 2016 Jul 21
+" Last Change: 2016 Aug 14
" Credits: Neil Schemenauer <nas@python.ca>
" Dmitry Vasiliev
"
@@ -84,14 +84,30 @@ syn keyword pythonInclude from import
syn keyword pythonAsync async await
" Decorators (new in Python 2.4)
-syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
-" The zero-length non-grouping match before the function name is
-" extremely important in pythonFunction. Without it, everything is
-" interpreted as a function inside the contained environment of
-" doctests.
+" Python 3.5 introduced the use of the same symbol for matrix
+" multiplication. We now have to exclude the symbol from being
+" highlighted when used in that context. Hence, the check that it's
+" preceded by empty space only (possibly in a docstring/doctest) and
+" followed by decorator name, optional parenthesized list of arguments,
+" and the next line with either def, class, or another decorator.
+syn match pythonDecorator
+ \ "\%(\%(^\s*\)\%(\%(>>>\|\.\.\.\)\s\+\)\=\)\zs@\%(\s*\h\%(\w\|\.\)*\%(([^)]*)\)\=\s*\n\s*\%(\.\.\.\s\+\)\=\%(@\s*\h\|\%(def\|class\)\s\+\)\)\@="
+ \ display nextgroup=pythonDecoratorName skipwhite
+
" A dot must be allowed because of @MyClass.myfunc decorators.
+" It must be preceded by a decorator symbol and on a separate line from
+" a function/class it decorates.
+syn match pythonDecoratorName
+ \ "\%(@\s*\)\@<=\h\%(\w\|\.\)*\%(\%(([^)]*)\)\=\s*\n\)\@="
+ \ contained display nextgroup=pythonFunction skipnl
+
+" The zero-length non-grouping match of def or class before the function
+" name is extremely important in pythonFunction. Without it, everything
+" is interpreted as a function inside the contained environment of
+" doctests.
syn match pythonFunction
- \ "\%(\%(def\s\|class\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained
+ \ "\%(\%(^\s*\)\%(\%(>>>\|\.\.\.\)\s\+\)\=\%(def\|class\)\s\+\)\@<=\h\w*"
+ \ contained
syn match pythonComment "#.*$" contains=pythonTodo,@Spell
syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained
@@ -293,6 +309,7 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonInclude Include
HiLink pythonAsync Statement
HiLink pythonDecorator Define
+ HiLink pythonDecoratorName Function
HiLink pythonFunction Function
HiLink pythonComment Comment
HiLink pythonTodo Todo
diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim
index d96bf96acb..30a5b23f84 100644
--- a/runtime/syntax/r.vim
+++ b/runtime/syntax/r.vim
@@ -5,7 +5,7 @@
" Tom Payne <tom@tompayne.org>
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Thu Mar 10, 2016 12:26PM
+" Last Change: Thu Aug 25, 2016 08:52PM
" Filenames: *.R *.r *.Rhistory *.Rt
"
" NOTE: The highlighting of R functions is defined in
@@ -26,7 +26,7 @@ if exists("b:current_syntax")
finish
endif
-setlocal iskeyword=@,48-57,_,.
+syn iskeyword @,48-57,_,.
if exists("g:r_syntax_folding") && g:r_syntax_folding
setlocal foldmethod=syntax
@@ -174,8 +174,6 @@ endif
if g:R_hi_fun
" Nvim-R:
runtime R/functions.vim
- " Vim-R-plugin:
- runtime r-plugin/functions.vim
endif
syn match rDollar display contained "\$"
diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim
index 47c764e296..8cac585bb0 100644
--- a/runtime/syntax/rhelp.vim
+++ b/runtime/syntax/rhelp.vim
@@ -3,7 +3,7 @@
" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Sat Feb 06, 2016 11:34AM
+" Last Change: Tue Jun 28, 2016 08:53AM
" Remarks: - Includes R syntax highlighting in the appropriate
" sections if an r.vim file is in the same directory or in the
" default debian location.
@@ -17,7 +17,6 @@ if exists("b:current_syntax")
endif
scriptencoding utf-8
-setlocal iskeyword=@,48-57,_,.
syn case match
diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim
index 4cde7441d3..48fb5e079c 100644
--- a/runtime/syntax/rmd.vim
+++ b/runtime/syntax/rmd.vim
@@ -1,7 +1,7 @@
" markdown Text with R statements
" Language: markdown with R code chunks
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Sat Feb 06, 2016 06:45AM
+" Last Change: Tue Jun 28, 2016 10:09AM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
@@ -72,8 +72,6 @@ if rmdIsPandoc == 0
hi def link rmdLaTeXRegDelim Special
endif
-setlocal iskeyword=@,48-57,_,.
-
syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
hi def link rmdChunkDelim Special
diff --git a/runtime/syntax/rrst.vim b/runtime/syntax/rrst.vim
index 24d3844df0..b643af3285 100644
--- a/runtime/syntax/rrst.vim
+++ b/runtime/syntax/rrst.vim
@@ -2,7 +2,7 @@
" Language: reST with R code chunks
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Sat Feb 06, 2016 06:45AM
+" Last Change: Tue Jun 28, 2016 08:53AM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
@@ -19,8 +19,6 @@ unlet b:current_syntax
" load all of the r syntax highlighting rules into @R
syntax include @R syntax/r.vim
-setlocal iskeyword=@,48-57,_,.
-
" highlight R chunks
if exists("g:rrst_syn_hl_chunk")
" highlight R code inside chunk header
diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index ef07b22676..232d2a7de3 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -2,7 +2,8 @@
" Language: reStructuredText documentation format
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2016-06-17
+" Website: https://github.com/marshallward/vim-restructuredtext
+" Latest Revision: 2016-08-18
if exists("b:current_syntax")
finish
@@ -89,7 +90,7 @@ function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_righ
\ ' start=+' . a:char_left . '\zs' . a:start .
\ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' .
\ a:middle .
- \ ' end=+\S' . a:end . '\ze\%($\|\s\|[''")\]}>/:.,;!?\\-]\)+'
+ \ ' end=+\S' . a:end . '\ze\%($\|\s\|[''"’)\]}>/:.,;!?\\-]\)+'
endfunction
function! s:DefineInlineMarkup(name, start, middle, end)
@@ -103,6 +104,8 @@ function! s:DefineInlineMarkup(name, start, middle, end)
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]')
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}')
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>')
+ call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '’', '’')
+ " TODO: Additional Unicode Pd, Po, Pi, Pf, Ps characters
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|[/:]\)', '')
@@ -186,11 +189,8 @@ hi def link rstHyperlinkTarget String
hi def link rstExDirective String
hi def link rstSubstitutionDefinition rstDirective
hi def link rstDelimiter Delimiter
-hi def link rstEmphasis Underlined
-hi def link rstStrongEmphasis Special
-" TODO Append these atttributes somehow
-"hi def rstEmphasis term=italic cterm=italic gui=italic
-"hi def rstStrongEmphasis term=bold cterm=bold gui=bold
+hi def rstEmphasis ctermfg=13 term=italic cterm=italic gui=italic
+hi def rstStrongEmphasis ctermfg=1 term=bold cterm=bold gui=bold
hi def link rstInterpretedTextOrHyperlinkReference Identifier
hi def link rstInlineLiteral String
hi def link rstSubstitutionReference PreProc
diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim
new file mode 100644
index 0000000000..b04af3be5b
--- /dev/null
+++ b/runtime/syntax/scala.vim
@@ -0,0 +1,231 @@
+" Vim syntax file
+" Language: Scala
+" Maintainer: Derek Wyatt
+" URL: https://github.com/derekwyatt/vim-scala
+" License: Same as Vim
+" Last Change: 20 May 2016
+" ----------------------------------------------------------------------------
+
+if !exists('main_syntax')
+ if version < 600
+ syntax clear
+ elseif exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'scala'
+endif
+
+scriptencoding utf-8
+
+let b:current_syntax = "scala"
+
+" Allows for embedding, see #59; main_syntax convention instead? Refactor TOP
+"
+" The @Spell here is a weird hack, it means *exclude* if the first group is
+" TOP. Otherwise we get spelling errors highlighted on code elements that
+" match scalaBlock, even with `syn spell notoplevel`.
+function! s:ContainedGroup()
+ try
+ silent syn list @scala
+ return '@scala,@NoSpell'
+ catch /E392/
+ return 'TOP,@Spell'
+ endtry
+endfunction
+
+unlet! b:current_syntax
+
+syn case match
+syn sync minlines=200 maxlines=1000
+
+syn keyword scalaKeyword catch do else final finally for forSome if
+syn keyword scalaKeyword match return throw try while yield macro
+syn keyword scalaKeyword class trait object extends with nextgroup=scalaInstanceDeclaration skipwhite
+syn keyword scalaKeyword case nextgroup=scalaKeyword,scalaCaseFollowing skipwhite
+syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite
+syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite
+hi link scalaKeyword Keyword
+
+exe 'syn region scalaBlock start=/{/ end=/}/ contains=' . s:ContainedGroup() . ' fold'
+
+syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome
+hi link scalaAkkaSpecialWord PreProc
+
+syn keyword scalatestSpecialWord shouldBe
+syn match scalatestShouldDSLA /^\s\+\zsit should/
+syn match scalatestShouldDSLB /\<should\>/
+hi link scalatestSpecialWord PreProc
+hi link scalatestShouldDSLA PreProc
+hi link scalatestShouldDSLB PreProc
+
+syn match scalaSymbol /'[_A-Za-z0-9$]\+/
+hi link scalaSymbol Number
+
+syn match scalaChar /'.'/
+syn match scalaChar /'\\[\\"'ntbrf]'/ contains=scalaEscapedChar
+syn match scalaChar /'\\u[A-Fa-f0-9]\{4}'/ contains=scalaUnicodeChar
+syn match scalaEscapedChar /\\[\\"'ntbrf]/
+syn match scalaUnicodeChar /\\u[A-Fa-f0-9]\{4}/
+hi link scalaChar Character
+hi link scalaEscapedChar Function
+hi link scalaUnicodeChar Special
+
+syn match scalaOperator "||"
+syn match scalaOperator "&&"
+hi link scalaOperator Special
+
+syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList
+syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition
+syn match scalaVariableDeclarationList /\s*,\s*/ contained nextgroup=scalaNameDefinition
+syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration
+hi link scalaNameDefinition Function
+
+syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaInstanceHash
+syn match scalaInstanceDeclaration /`[^`]\+`/ contained
+syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration
+hi link scalaInstanceDeclaration Special
+hi link scalaInstanceHash Type
+
+syn match scalaUnimplemented /???/
+hi link scalaUnimplemented ERROR
+
+syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/
+hi link scalaCapitalWord Special
+
+" Handle type declarations specially
+syn region scalaTypeStatement matchgroup=Keyword start=/\<type\_s\+\ze/ end=/$/ contains=scalaTypeTypeDeclaration,scalaSquareBrackets,scalaTypeTypeEquals,scalaTypeStatement
+
+" Ugh... duplication of all the scalaType* stuff to handle special highlighting
+" of `type X =` declarations
+syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals contains=scalaRoundBrackets skipwhite
+syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite
+syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite
+syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
+syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite
+syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
+syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
+hi link scalaTypeTypeDeclaration Type
+hi link scalaTypeTypeExtension Keyword
+hi link scalaTypeTypePostDeclaration Special
+hi link scalaTypeTypePostExtension Keyword
+
+syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
+syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
+syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
+syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite
+hi link scalaTypeDeclaration Type
+hi link scalaTypeExtension Keyword
+hi link scalaTypePostExtension Keyword
+
+syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration contains=scalaRoundBrackets
+syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
+hi link scalaTypeAnnotation Normal
+
+syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained
+syn match scalaCaseFollowing /`[^`]\+`/ contained
+hi link scalaCaseFollowing Special
+
+syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super
+hi link scalaKeywordModifier Function
+
+syn keyword scalaSpecial this true false ne eq
+syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
+syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
+syn match scalaSpecial /`[^`]\+`/ " Backtick literals
+hi link scalaSpecial PreProc
+
+syn keyword scalaExternal package import
+hi link scalaExternal Include
+
+syn match scalaStringEmbeddedQuote /\\"/ contained
+syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar
+hi link scalaString String
+hi link scalaStringEmbeddedQuote String
+
+syn region scalaIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar
+syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar
+hi link scalaIString String
+hi link scalaTripleIString String
+
+syn match scalaInterpolation /\$[a-zA-Z0-9_$]\+/ contained
+exe 'syn region scalaInterpolationB matchgroup=scalaInterpolationBoundary start=/\${/ end=/}/ contained contains=' . s:ContainedGroup()
+hi link scalaInterpolation Function
+hi link scalaInterpolationB Normal
+
+syn region scalaFString matchgroup=scalaInterpolationBrackets start=/f"/ skip=/\\"/ end=/"/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar
+syn match scalaFInterpolation /\$[a-zA-Z0-9_$]\+\(%[-A-Za-z0-9\.]\+\)\?/ contained
+exe 'syn region scalaFInterpolationB matchgroup=scalaInterpolationBoundary start=/${/ end=/}\(%[-A-Za-z0-9\.]\+\)\?/ contained contains=' . s:ContainedGroup()
+hi link scalaFString String
+hi link scalaFInterpolation Function
+hi link scalaFInterpolationB Normal
+
+syn region scalaTripleString start=/"""/ end=/"""\%([^"]\|$\)/ contains=scalaEscapedChar,scalaUnicodeChar
+syn region scalaTripleFString matchgroup=scalaInterpolationBrackets start=/f"""/ end=/"""\%([^"]\|$\)/ contains=scalaFInterpolation,scalaFInterpolationB,scalaEscapedChar,scalaUnicodeChar
+hi link scalaTripleString String
+hi link scalaTripleFString String
+
+hi link scalaInterpolationBrackets Special
+hi link scalaInterpolationBoundary Function
+
+syn match scalaNumber /\<0[dDfFlL]\?\>/ " Just a bare 0
+syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala
+syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/ " Hex number
+syn match scalaNumber /\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\=/ " exponential notation 1
+syn match scalaNumber /\<\d\+[eE][-+]\=\d\+[fFdD]\=\>/ " exponential notation 2
+syn match scalaNumber /\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>/ " exponential notation 3
+hi link scalaNumber Number
+
+syn region scalaRoundBrackets start="(" end=")" skipwhite contained contains=scalaTypeDeclaration,scalaSquareBrackets,scalaRoundBrackets
+
+syn region scalaSquareBrackets matchgroup=scalaSquareBracketsBrackets start="\[" end="\]" skipwhite nextgroup=scalaTypeExtension contains=scalaTypeDeclaration,scalaSquareBrackets,scalaTypeOperator,scalaTypeAnnotationParameter
+syn match scalaTypeOperator /[-+=:<>]\+/ contained
+syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained
+hi link scalaSquareBracketsBrackets Type
+hi link scalaTypeOperator Keyword
+hi link scalaTypeAnnotationParameter Function
+
+syn match scalaShebang "\%^#!.*" display
+syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold
+syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
+syn match scalaParameterAnnotation "\%(@tparam\|@param\|@see\)" nextgroup=scalaParamAnnotationValue skipwhite contained
+syn match scalaParamAnnotationValue /[.`_A-Za-z0-9$]\+/ contained
+syn region scalaDocLinks start="\[\[" end="\]\]" contained
+syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
+syn match scalaTodo "\vTODO|FIXME|XXX" contained
+hi link scalaShebang Comment
+hi link scalaMultilineComment Comment
+hi link scalaDocLinks Function
+hi link scalaParameterAnnotation Function
+hi link scalaParamAnnotationValue Keyword
+hi link scalaCommentAnnotation Function
+hi link scalaCommentCodeBlockBrackets String
+hi link scalaCommentCodeBlock String
+hi link scalaTodo Todo
+
+syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/
+hi link scalaAnnotation PreProc
+
+syn match scalaTrailingComment "//.*$" contains=scalaTodo,@Spell
+hi link scalaTrailingComment Comment
+
+syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing
+syn match scalaAkkaFSM /stay\_s\+using/
+syn match scalaAkkaFSM /^\s*stay\s*$/
+syn match scalaAkkaFSM /when\ze([^)]*)/
+syn match scalaAkkaFSM /startWith\ze([^)]*)/
+syn match scalaAkkaFSM /initialize\ze()/
+syn match scalaAkkaFSM /onTransition/
+syn match scalaAkkaFSM /onTermination/
+syn match scalaAkkaFSM /whenUnhandled/
+syn match scalaAkkaFSMGotoUsing /\<using\>/
+syn match scalaAkkaFSMGotoUsing /\<goto\>/
+hi link scalaAkkaFSM PreProc
+hi link scalaAkkaFSMGotoUsing PreProc
+
+let b:current_syntax = 'scala'
+
+if main_syntax ==# 'scala'
+ unlet main_syntax
+endif
+
+" vim:set sw=2 sts=2 ts=8 et:
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 34b8ab79e4..2fe13fbde6 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: Jul 29, 2016
-" Version: 155
+" Last Change: Aug 23, 2016
+" Version: 161
" 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)
@@ -127,11 +127,11 @@ syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsa
if exists("b:is_kornshell")
syn cluster ErrorList add=shDTestError
endif
-syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor
+syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
-syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
-syn cluster shCommandSubList contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
+syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
+syn cluster shCommandSubList contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
@@ -139,7 +139,7 @@ syn cluster shDerefVarList contains=shDerefOff,shDerefOp,shDerefVarArray,shDeref
syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
-syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
+syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shFunctionList add=shRepeat
syn cluster shFunctionList add=shDblBrace,shDblParen
@@ -147,11 +147,11 @@ endif
syn cluster shHereBeginList contains=@shCommandSubList
syn cluster shHereList contains=shBeginHere,shHerePayload
syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
-syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
-syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
+syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shHereString,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
+syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo,shParen
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch
syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
-syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
+syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
" Echo: {{{1
@@ -216,8 +216,8 @@ syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSin
" Subshells: {{{1
" ==========
-syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shMoreSpecial
-syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shMoreSpecial
+syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shSpecialNxt
+syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shSpecialNxt
" Tests: {{{1
"=======
@@ -339,8 +339,8 @@ if exists("b:is_bash")
syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
endif
if exists("b:is_bash")
- syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial
- syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial
+ syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt
+ syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial nextgroup=shSpecialNxt
elseif !exists("g:sh_no_error")
syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial
syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial
@@ -351,7 +351,7 @@ syn match shStringSpecial "[^[:print:] \t]" contained
syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shBkslshSnglQuote,shBkslshDblQuote
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
-syn match shMoreSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained
+syn match shSpecialNxt contained "\\[\\"'`$()#]"
syn region shBkslshSnglQuote contained matchgroup=shQuote start=+'+ end=+'+ contains=@Spell
syn region shBkslshDblQuote contained matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
@@ -386,7 +386,7 @@ ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \
" =============
" available for: bash; ksh (really should be ksh93 only) but not if its a posix
if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix"))
- syn match shRedir "<<<" skipwhite nextgroup=shCmdParenRegion
+ syn match shHereString "<<<" skipwhite nextgroup=shCmdParenRegion
endif
" Identifiers: {{{1
@@ -431,6 +431,7 @@ syn match shDerefSimple "\$\%(\h\w*\|\d\)"
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
syn match shDerefSimple "\$[-#*@!?]"
syn match shDerefSimple "\$\$"
+syn match shDerefSimple "\${\d}"
if exists("b:is_bash") || exists("b:is_kornshell")
syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList
syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList
@@ -455,6 +456,7 @@ endif
syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError
syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
syn match shDerefVar contained "{\@<=\h\w*" nextgroup=@shDerefVarList
+syn match shDerefVar contained '\d' nextgroup=@shDerefVarList
if exists("b:is_kornshell")
syn match shDerefVar contained "{\@<=\h\w*[[:alnum:]_.]*" nextgroup=@shDerefVarList
endif
@@ -482,24 +484,24 @@ endif
syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList
syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList
if exists("b:is_bash") || exists("b:is_kornshell")
- syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
- syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
- syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
+ syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
+ syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
+ syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
syn match shDerefEscape contained '\%(\\\\\)*\\.'
endif
if exists("b:is_bash")
syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList
endif
-syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
+syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
syn match shDerefString contained "\\["']" nextgroup=shDerefPattern
if exists("b:is_bash")
" bash : ${parameter:offset}
" bash : ${parameter:offset:length}
- syn region shDerefOff contained start=':' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple nextgroup=shDerefLen,shDeref,shDerefSimple
- syn region shDerefOff contained start=':\s-' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple nextgroup=shDerefLen,shDeref,shDerefSimple
+ syn region shDerefOff contained start=':' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
+ syn region shDerefOff contained start=':\s-' end='\ze:' end='\ze}' contains=shDeref,shDerefSimple,shDerefEscape nextgroup=shDerefLen,shDeref,shDerefSimple
syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple
" bash : ${parameter//pattern/string}
@@ -602,14 +604,16 @@ hi def link shEcho shString
hi def link shEchoDelim shOperator
hi def link shEchoQuote shString
hi def link shForPP shLoop
+hi def link shFunction Function
hi def link shEmbeddedEcho shString
hi def link shEscape shCommandSub
hi def link shExDoubleQuote shDoubleQuote
hi def link shExSingleQuote shSingleQuote
hi def link shHereDoc shString
+hi def link shHereString shRedir
hi def link shHerePayload shHereDoc
hi def link shLoop shStatement
-hi def link shMoreSpecial shSpecial
+hi def link shSpecialNxt shSpecial
hi def link shNoQuote shDoubleQuote
hi def link shOption shCommandSub
hi def link shPattern shString
diff --git a/runtime/syntax/teraterm.vim b/runtime/syntax/teraterm.vim
index 521331d8ce..1924996738 100644
--- a/runtime/syntax/teraterm.vim
+++ b/runtime/syntax/teraterm.vim
@@ -1,9 +1,9 @@
" Vim syntax file
" Language: Tera Term Language (TTL)
-" Based on Tera Term Version 4.86
+" Based on Tera Term Version 4.92
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
-" Last Change: 2015 Jun 24
+" Last Change: 2016 Aug 17
" Filenames: *.ttl
" License: VIM License
@@ -33,7 +33,7 @@ syn keyword ttlOperator and or xor not
syn match ttlVar "\<groupmatchstr\d\>"
syn match ttlVar "\<param\d\>"
-syn keyword ttlVar inputstr matchstr paramcnt result timeout mtimeout
+syn keyword ttlVar inputstr matchstr paramcnt params result timeout mtimeout
syn match ttlLine nextgroup=ttlStatement "^"
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index bb3fa1f6c9..91f70c6a1a 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -53,10 +53,10 @@ syn case ignore
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
-syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
+syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn keyword vimOnlyHLGroup contained VisualNOS
-syn keyword nvimHLGroup contained EndOfBuffer Substitute TermCursor TermCursorNC QuickFixLine
+syn keyword nvimHLGroup contained Substitute TermCursor TermCursorNC QuickFixLine
"}}}2
syn case match
" Special Vim Highlighting (not automatic) {{{1
diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua
index 45a4f4a4de..0ee3ae6475 100644
--- a/scripts/gendispatch.lua
+++ b/scripts/gendispatch.lua
@@ -225,8 +225,7 @@ for i = 1, #functions do
end
output:write('\n')
output:write('\n if (args.size != '..#fn.parameters..') {')
- output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
- output:write('\n error->set = true;')
+ output:write('\n api_set_error(error, kErrorTypeException, "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
output:write('\n goto cleanup;')
output:write('\n }\n')
@@ -251,8 +250,7 @@ for i = 1, #functions do
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
end
output:write('\n } else {')
- output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");')
- output:write('\n error->set = true;')
+ output:write('\n api_set_error(error, kErrorTypeException, "Wrong type for argument '..j..', expecting '..param[1]..'");')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
@@ -292,7 +290,7 @@ for i = 1, #functions do
output:write('error);\n')
end
-- and check for the error
- output:write('\n if (error->set) {')
+ output:write('\n if (ERROR_SET(error)) {')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh
new file mode 100755
index 0000000000..32d63646aa
--- /dev/null
+++ b/scripts/pvscheck.sh
@@ -0,0 +1,172 @@
+#!/bin/sh
+set -e
+
+get_jobs_num() {
+ local num="$(cat /proc/cpuinfo | grep -c "^processor")"
+ num="$(echo $(( num + 1 )))"
+ num="${num:-1}"
+ echo $num
+}
+
+help() {
+ echo 'Usage:'
+ echo ' pvscheck.sh [target-directory [branch]]'
+ echo ' pvscheck.sh [--recheck] [target-directory]'
+ echo ' pvscheck.sh --patch [--only-build]'
+ echo
+ echo ' --patch: patch sources in the current directory.'
+ echo ' Does not patch already patched files.'
+ echo ' Does not run analysis.'
+ echo
+ echo ' --only-build: Only patch files in ./build directory.'
+ echo
+ echo ' --recheck: run analysis on a prepared target directory.'
+ echo
+ echo ' target-directory: Directory where build should occur.'
+ echo ' Default: ../neovim-pvs'
+ echo
+ echo ' branch: Branch to check.'
+ echo ' Default: master.'
+}
+
+get_pvs_comment() {
+ cat > pvs-comment << EOF
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
+EOF
+}
+
+install_pvs() {
+ mkdir pvs-studio
+ cd pvs-studio
+
+ curl -o pvs-studio.tar.gz "$PVS_URL"
+ tar xzf pvs-studio.tar.gz
+ rm pvs-studio.tar.gz
+ local pvsdir="$(find . -maxdepth 1 -mindepth 1)"
+ find "$pvsdir" -maxdepth 1 -mindepth 1 -exec mv '{}' . \;
+ rmdir "$pvsdir"
+
+ export PATH="$PWD/bin${PATH+:}${PATH}"
+
+ cd ..
+}
+
+create_compile_commands() {
+ mkdir build
+ cd build
+ env \
+ CC=clang \
+ CFLAGS=' -O0 ' \
+ cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="$PWD/root"
+ make -j"$(get_jobs_num)"
+ find src/nvim/auto -name '*.test-include.c' -delete
+
+ cd ..
+}
+
+patch_sources() {
+ get_pvs_comment
+
+ local sh_script='
+ pvs_comment="$(cat pvs-comment ; echo -n EOS)"
+ filehead="$(head -c $(( ${#pvs_comment} - 3 )) "$1" ; echo -n EOS)"
+ if test "x$filehead" != "x$pvs_comment" ; then
+ cat pvs-comment "$1" > "$1.tmp"
+ mv "$1.tmp" "$1"
+ fi
+ '
+
+ if test "x$1" != "x--only-build" ; then
+ find \
+ src/nvim test/functional/fixtures test/unit/fixtures \
+ -name '*.c' \
+ -exec /bin/sh -c "$sh_script" - '{}' \;
+ fi
+
+ find \
+ build/src/nvim/auto build/config \
+ -name '*.c' -not -name '*.test-include.c' \
+ -exec /bin/sh -c "$sh_script" - '{}' \;
+
+ rm pvs-comment
+}
+
+run_analysis() {
+ pvs-studio-analyzer \
+ analyze \
+ --threads "$(get_jobs_num)" \
+ --output-file PVS-studio.log \
+ --verbose \
+ --file build/compile_commands.json \
+ --sourcetree-root .
+
+ plog-converter -t xml -o PVS-studio.xml PVS-studio.log
+ plog-converter -t errorfile -o PVS-studio.err PVS-studio.log
+ plog-converter -t tasklist -o PVS-studio.tsk PVS-studio.log
+}
+
+do_check() {
+ local tgt="${1}"
+ local branch="${2}"
+
+ git clone --branch="$branch" . "$tgt"
+
+ cd "$tgt"
+
+ install_pvs
+
+ create_compile_commands
+
+ run_analysis
+}
+
+do_recheck() {
+ local tgt="${1}"
+
+ cd "$tgt"
+
+ export PATH="$PWD/pvs-studio/bin${PATH+:}${PATH}"
+
+ run_analysis
+}
+
+main() {
+ local PVS_URL="http://files.viva64.com/pvs-studio-6.14.21446.1-x86_64.tgz"
+
+ if test "x$1" = "x--help" ; then
+ help
+ return
+ fi
+
+ set -x
+
+ if test "x$1" = "x--patch" ; then
+ shift
+ if test "x$1" = "x--only-build" ; then
+ shift
+ patch_sources --only-build
+ else
+ patch_sources
+ fi
+ exit $?
+ fi
+
+ local recheck=
+ if test "x$1" = "x--recheck" ; then
+ recheck=1
+ shift
+ fi
+
+ local tgt="${1:-$PWD/../neovim-pvs}"
+ local branch="${2:-master}"
+
+ if test "x$recheck" = "x" ; then
+ do_check "$tgt" "$branch"
+ else
+ do_recheck "$tgt"
+ fi
+}
+
+main "$@"
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
index d02eef6b44..3ade90a65b 100755
--- a/scripts/vim-patch.sh
+++ b/scripts/vim-patch.sh
@@ -137,18 +137,18 @@ preprocess_patch() {
# Remove channel.txt, netbeans.txt, os_*.txt, todo.txt, version*.txt, tags
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|todo\.txt\|version\d\.txt\|tags'
- 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\%('${na_doc}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
+ 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('${na_doc}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove "Last change ..." changes in doc files.
2>/dev/null $nvim --cmd 'set dir=/tmp' +'%s/^@@.*\n.*For Vim version.*Last change.*\n.*For Vim version.*Last change.*//' +w +q "$file"
# Remove some testdir/Make_*.mak files
local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms'
- 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\%('${na_src_testdir}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
+ 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('${na_src_testdir}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Remove some *.po files. #5622
local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po'
- 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\%('${na_po}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file"
+ 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file"
# Rename src/ paths to src/nvim/
LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \
@@ -321,7 +321,7 @@ list_vim_patches() {
if [[ -n "${vim_tag}" ]]; then
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
# Tagged Vim patch, check version.c:
- is_missing="$(sed -n '/static int included_patches/,/}/p' "${NVIM_SOURCE_DIR}/src/nvim/version.c" |
+ is_missing="$(sed -n '/static const int included_patches/,/}/p' "${NVIM_SOURCE_DIR}/src/nvim/version.c" |
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"
vim_commit="${vim_tag#v}"
if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then
diff --git a/src/clint.py b/src/clint.py
index 61c53d128e..5174521fb8 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -571,7 +571,8 @@ class _CppLintState(object):
for category, count in self.errors_by_category.items():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
- sys.stderr.write('Total errors found: %d\n' % self.error_count)
+ if self.error_count:
+ sys.stderr.write('Total errors found: %d\n' % self.error_count)
def SuppressErrorsFrom(self, fname):
"""Open file and read a list of suppressed errors from it"""
diff --git a/src/coverity-model.c b/src/coverity-model.c
index a01ea6d316..3c38e4ae4d 100644
--- a/src/coverity-model.c
+++ b/src/coverity-model.c
@@ -64,7 +64,7 @@ void *je_realloc(void *ptr, size_t size)
// of the memory allocated for item.
typedef struct {} dictitem_T;
typedef struct {} dict_T;
-int dict_add(dict_T *d, dictitem_T *item)
+int tv_dict_add(dict_T *const d, dictitem_T *const item)
{
__coverity_escape__(item);
}
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index a3bacaa9d2..db5e62fd67 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -10,6 +10,7 @@ if(USE_GCOV)
endif()
endif()
+set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto)
set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendispatch.lua)
file(GLOB API_HEADERS api/*.h)
@@ -34,13 +35,26 @@ set(UNICODE_TABLES_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genunicodetables.lua)
set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode)
file(GLOB UNICODE_FILES ${UNICODE_DIR}/*.txt)
set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h)
+set(LINT_SUPPRESS_FILE ${PROJECT_BINARY_DIR}/errors.json)
+set(LINT_SUPPRESS_URL_BASE "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint")
+set(LINT_SUPPRESS_URL "${LINT_SUPPRESS_URL_BASE}/errors.json")
+set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py)
+set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake)
+set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors)
+set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz")
+set(LINT_SUPPRESSES_ARCHIVE ${LINT_SUPPRESSES_ROOT}/errors.tar.gz)
+set(LINT_SUPPRESSES_TOUCH_FILE "${TOUCHES_DIR}/unpacked-clint-errors-archive")
+set(LINT_SUPPRESSES_INSTALL_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake")
include_directories(${GENERATED_DIR})
include_directories(${CACHED_GENERATED_DIR})
include_directories(${GENERATED_INCLUDES_DIR})
+file(MAKE_DIRECTORY ${TOUCHES_DIR})
file(MAKE_DIRECTORY ${GENERATED_DIR})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR})
+file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT})
+file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src)
file(GLOB NVIM_SOURCES *.c)
file(GLOB NVIM_HEADERS *.h)
@@ -73,6 +87,8 @@ file(GLOB UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c)
list(SORT NVIM_SOURCES)
list(SORT NVIM_HEADERS)
+list(APPEND LINT_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS})
+
foreach(sfile ${NVIM_SOURCES})
get_filename_component(f ${sfile} NAME)
if(${f} MATCHES "^(regexp_nfa.c)$")
@@ -393,76 +409,60 @@ add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NVIM_GENERATED_FOR_SOURCES} ${NV
target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES})
set_property(TARGET nvim-test APPEND_STRING PROPERTY COMPILE_FLAGS -DUNIT_TESTING)
-set(NO_SINGLE_CHECK_HEADERS
- cursor_shape
- diff
- digraph
- ex_cmds
- ex_getln
- file_search
- fold
- getchar
- hardcopy
- if_cscope
- if_cscope_defs
- mark
- mbyte
- memfile_defs
- memline
- memline_defs
- menu
- misc2
- move
- msgpack_rpc/server
- ops
- option
- os/shell
- os_unix
- os/win_defs
- popupmnu
- quickfix
- regexp
- regexp_defs
- screen
- search
- sha256
- sign_defs
- spell
- spellfile
- syntax
- syntax_defs
- tag
- terminal
- tui/tui
- ugrid
- ui
- ui_bridge
- undo
- undo_defs
- version
- window
-)
-foreach(hfile ${NVIM_HEADERS})
- get_filename_component(full_d ${hfile} PATH)
+function(get_test_target prefix sfile relative_path_var target_var)
+ get_filename_component(full_d "${sfile}" PATH)
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
- if(${d} MATCHES "^[.][.]")
+ if(d MATCHES "^[.][.]")
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
endif()
- get_filename_component(r ${hfile} NAME_WE)
- if(NOT ${d} EQUAL ".")
+ get_filename_component(r "${sfile}" NAME)
+ if(NOT d MATCHES "^[.]?$")
set(r "${d}/${r}")
endif()
+ string(REGEX REPLACE "[/.]" "-" suffix "${r}")
+ set(${relative_path_var} ${r} PARENT_SCOPE)
+ if(prefix STREQUAL "")
+ set(${target_var} "${suffix}" PARENT_SCOPE)
+ else()
+ set(${target_var} "${prefix}-${suffix}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+set(NO_SINGLE_CHECK_HEADERS
+ if_cscope_defs.h
+ misc2.h
+ msgpack_rpc/server.h
+ option.h
+ os/shell.h
+ os_unix.h
+ os/win_defs.h
+ popupmnu.h
+ quickfix.h
+ regexp.h
+ regexp_defs.h
+ sha256.h
+ sign_defs.h
+ spell.h
+ spellfile.h
+ syntax_defs.h
+ tag.h
+ terminal.h
+ tui/tui.h
+ undo.h
+ undo_defs.h
+)
+foreach(hfile ${NVIM_HEADERS})
+ get_test_target(test-includes "${hfile}" relative_path texe)
if(NOT ${hfile} MATCHES "[.]c[.]h$")
- set(tsource "${GENERATED_DIR}/${r}.test-include.c")
- string(REPLACE "/" "-" texe "test-incl-${r}")
+ set(tsource "${GENERATED_DIR}/${relative_path}.test-include.c")
write_file("${tsource}" "#include \"${hfile}\"\nint main(int argc, char **argv) { return 0; }")
add_executable(
${texe}
EXCLUDE_FROM_ALL
${tsource} ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_HEADERS})
- list(FIND NO_SINGLE_CHECK_HEADERS "${r}" hfile_exclude_idx)
+ list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx)
if(${hfile_exclude_idx} EQUAL -1)
list(APPEND HEADER_CHECK_TARGETS ${texe})
endif()
@@ -470,4 +470,60 @@ foreach(hfile ${NVIM_HEADERS})
endforeach()
add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS})
+function(add_download output url allow_failure)
+ add_custom_command(
+ OUTPUT "${output}"
+ COMMAND
+ ${CMAKE_COMMAND}
+ -DURL=${url} -DFILE=${output}
+ -DALLOW_FAILURE=${allow_failure}
+ -P ${DOWNLOAD_SCRIPT}
+ DEPENDS ${DOWNLOAD_SCRIPT}
+ )
+endfunction()
+
+add_download(${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_URL} off)
+
+add_custom_command(
+ OUTPUT ${LINT_SUPPRESSES_TOUCH_FILE}
+ WORKING_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src
+ COMMAND ${CMAKE_COMMAND} -E tar xfz ${LINT_SUPPRESSES_ARCHIVE}
+ COMMAND
+ ${CMAKE_COMMAND}
+ -DTARGET=${LINT_SUPPRESSES_ROOT}
+ -P ${LINT_SUPPRESSES_INSTALL_SCRIPT}
+ COMMAND ${CMAKE_COMMAND} -E touch ${LINT_SUPPRESSES_TOUCH_FILE}
+ DEPENDS
+ ${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_INSTALL_SCRIPT}
+)
+
+add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off)
+
+set(LINT_NVIM_REL_SOURCES)
+foreach(sfile ${LINT_NVIM_SOURCES})
+ get_test_target("" "${sfile}" r suffix)
+ set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json)
+ set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json")
+ set(rsfile src/nvim/${r})
+ set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}")
+ add_custom_command(
+ OUTPUT ${touch_file}
+ COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ COMMAND ${CMAKE_COMMAND} -E touch ${touch_file}
+ DEPENDS ${LINT_PRG} ${sfile} ${LINT_SUPPRESSES_TOUCH_FILE}
+ )
+ list(APPEND LINT_TARGETS ${touch_file})
+ list(APPEND LINT_NVIM_REL_SOURCES ${rsfile})
+endforeach()
+add_custom_target(clint DEPENDS ${LINT_TARGETS})
+
+add_custom_target(
+ clint-full
+ COMMAND
+ ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} ${LINT_NVIM_REL_SOURCES}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE}
+)
+
add_subdirectory(po)
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 26f9a6f592..ae5728ee21 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// Much of this code was adapted from 'if_py_both.h' from the original
// vim source
#include <stdbool.h>
@@ -62,7 +65,7 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
index = convert_index(index);
Array slice = nvim_buf_get_lines(0, buffer, index, index+1, true, err);
- if (!err->set && slice.size) {
+ if (!ERROR_SET(err) && slice.size) {
rv = slice.items[0].data.string;
}
@@ -168,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
- api_set_error(err, Validation, _("Index out of bounds"));
+ api_set_error(err, kErrorTypeValidation, "Index out of bounds");
return rv;
}
@@ -184,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i;
if (lnum > LONG_MAX) {
- api_set_error(err, Validation, _("Line index is too high"));
+ api_set_error(err, kErrorTypeValidation, "Line index is too high");
goto end;
}
@@ -200,7 +203,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
}
end:
- if (err->set) {
+ if (ERROR_SET(err)) {
for (size_t i = 0; i < rv.size; i++) {
xfree(rv.items[i].data.string.data);
}
@@ -280,15 +283,15 @@ void nvim_buf_set_lines(uint64_t channel_id,
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
- api_set_error(err, Validation, _("Index out of bounds"));
+ api_set_error(err, kErrorTypeValidation, "Index out of bounds");
return;
}
if (start > end) {
api_set_error(err,
- Validation,
- _("Argument \"start\" is higher than \"end\""));
+ kErrorTypeValidation,
+ "Argument \"start\" is higher than \"end\"");
return;
}
@@ -302,8 +305,8 @@ void nvim_buf_set_lines(uint64_t channel_id,
for (size_t i = 0; i < new_len; i++) {
if (replacement.items[i].type != kObjectTypeString) {
api_set_error(err,
- Validation,
- _("All items in the replacement array must be strings"));
+ kErrorTypeValidation,
+ "All items in the replacement array must be strings");
goto end;
}
@@ -314,7 +317,8 @@ void nvim_buf_set_lines(uint64_t channel_id,
lines[i] = xmallocz(l.size);
for (size_t j = 0; j < l.size; j++) {
if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) {
- api_set_error(err, Exception, _("string cannot contain newlines"));
+ api_set_error(err, kErrorTypeException,
+ "String cannot contain newlines");
new_len = i + 1;
goto end;
}
@@ -327,7 +331,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf);
if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) {
- api_set_error(err, Exception, _("Failed to save undo information"));
+ api_set_error(err, kErrorTypeException, "Failed to save undo information");
goto end;
}
@@ -337,7 +341,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0;
for (size_t i = 0; i < to_delete; i++) {
if (ml_delete((linenr_T)start, false) == FAIL) {
- api_set_error(err, Exception, _("Failed to delete line"));
+ api_set_error(err, kErrorTypeException, "Failed to delete line");
goto end;
}
}
@@ -354,12 +358,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i;
if (lnum > LONG_MAX) {
- api_set_error(err, Validation, _("Index value is too high"));
+ api_set_error(err, kErrorTypeValidation, "Index value is too high");
goto end;
}
if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) {
- api_set_error(err, Exception, _("Failed to replace line"));
+ api_set_error(err, kErrorTypeException, "Failed to replace line");
goto end;
}
// Mark lines that haven't been passed to the buffer as they need
@@ -372,12 +376,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
int64_t lnum = start + (int64_t)i - 1;
if (lnum > LONG_MAX) {
- api_set_error(err, Validation, _("Index value is too high"));
+ api_set_error(err, kErrorTypeValidation, "Index value is too high");
goto end;
}
if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) {
- api_set_error(err, Exception, _("Failed to insert line"));
+ api_set_error(err, kErrorTypeException, "Failed to insert line");
goto end;
}
@@ -624,7 +628,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err)
}
if (ren_ret == FAIL) {
- api_set_error(err, Exception, _("Failed to rename buffer"));
+ api_set_error(err, kErrorTypeException, "Failed to rename buffer");
}
}
@@ -636,7 +640,9 @@ Boolean nvim_buf_is_valid(Buffer buffer)
FUNC_API_SINCE(1)
{
Error stub = ERROR_INIT;
- return find_buffer_by_handle(buffer, &stub) != NULL;
+ Boolean ret = find_buffer_by_handle(buffer, &stub) != NULL;
+ api_clear_error(&stub);
+ return ret;
}
/// Inserts a sequence of lines to a buffer at a certain index
@@ -675,7 +681,8 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
}
if (name.size != 1) {
- api_set_error(err, Validation, _("Mark name must be a single character"));
+ api_set_error(err, kErrorTypeValidation,
+ "Mark name must be a single character");
return rv;
}
@@ -693,7 +700,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
}
if (posp == NULL) {
- api_set_error(err, Validation, _("Invalid mark name"));
+ api_set_error(err, kErrorTypeValidation, "Invalid mark name");
return rv;
}
@@ -748,11 +755,11 @@ Integer nvim_buf_add_highlight(Buffer buffer,
}
if (line < 0 || line >= MAXLNUM) {
- api_set_error(err, Validation, _("Line number outside range"));
+ api_set_error(err, kErrorTypeValidation, "Line number outside range");
return 0;
}
if (col_start < 0 || col_start > MAXCOL) {
- api_set_error(err, Validation, _("Column value outside range"));
+ api_set_error(err, kErrorTypeValidation, "Column value outside range");
return 0;
}
if (col_end < 0 || col_end > MAXCOL) {
@@ -789,7 +796,7 @@ void nvim_buf_clear_highlight(Buffer buffer,
}
if (line_start < 0 || line_start >= MAXLNUM) {
- api_set_error(err, Validation, _("Line number outside range"));
+ api_set_error(err, kErrorTypeValidation, "Line number outside range");
return;
}
if (line_end < 0 || line_end > MAXLNUM) {
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
index 223aab09dc..60bf38265f 100644
--- a/src/nvim/api/private/defs.h
+++ b/src/nvim/api/private/defs.h
@@ -8,9 +8,11 @@
#define ARRAY_DICT_INIT {.size = 0, .capacity = 0, .items = NULL}
#define STRING_INIT {.data = NULL, .size = 0}
#define OBJECT_INIT { .type = kObjectTypeNil }
-#define ERROR_INIT { .set = false }
+#define ERROR_INIT { .type = kErrorTypeNone, .msg = NULL }
#define REMOTE_TYPE(type) typedef handle_T type
+#define ERROR_SET(e) ((e)->type != kErrorTypeNone)
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# define ArrayOf(...) Array
# define DictionaryOf(...) Dictionary
@@ -20,6 +22,7 @@ typedef int handle_T;
// Basic types
typedef enum {
+ kErrorTypeNone = -1,
kErrorTypeException,
kErrorTypeValidation
} ErrorType;
@@ -38,8 +41,7 @@ typedef enum {
typedef struct {
ErrorType type;
- char msg[1024];
- bool set;
+ char *msg;
} Error;
typedef bool Boolean;
diff --git a/src/nvim/api/private/dispatch.c b/src/nvim/api/private/dispatch.c
index 9b3bcc380a..f8eebcdb10 100644
--- a/src/nvim/api/private/dispatch.c
+++ b/src/nvim/api/private/dispatch.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c
index acb0fb332a..eb96192af2 100644
--- a/src/nvim/api/private/handle.c
+++ b/src/nvim/api/private/handle.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index fe15b28041..69cb19c14f 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -58,7 +61,7 @@ bool try_end(Error *err)
discard_current_exception();
}
- api_set_error(err, Exception, _("Keyboard interrupt"));
+ api_set_error(err, kErrorTypeException, "Keyboard interrupt");
got_int = false;
} else if (msg_list != NULL && *msg_list != NULL) {
int should_free;
@@ -66,19 +69,18 @@ bool try_end(Error *err)
ET_ERROR,
NULL,
&should_free);
- xstrlcpy(err->msg, msg, sizeof(err->msg));
- err->set = true;
+ api_set_error(err, kErrorTypeException, "%s", msg);
free_global_msglist();
if (should_free) {
xfree(msg);
}
} else if (did_throw) {
- api_set_error(err, Exception, "%s", current_exception->value);
+ api_set_error(err, kErrorTypeException, "%s", current_exception->value);
discard_current_exception();
}
- return err->set;
+ return ERROR_SET(err);
}
/// Recursively expands a vimscript value in a dict
@@ -91,8 +93,8 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
dictitem_T *const di = tv_dict_find(dict, key.data, (ptrdiff_t)key.size);
if (di == NULL) {
- api_set_error(err, Validation, _("Key not found"));
- return (Object) OBJECT_INIT;
+ api_set_error(err, kErrorTypeValidation, "Key not found");
+ return (Object)OBJECT_INIT;
}
return vim_to_object(&di->di_tv);
@@ -115,17 +117,18 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
Object rv = OBJECT_INIT;
if (dict->dv_lock) {
- api_set_error(err, Exception, _("Dictionary is locked"));
+ api_set_error(err, kErrorTypeException, "Dictionary is locked");
return rv;
}
if (key.size == 0) {
- api_set_error(err, Validation, _("Empty variable names aren't allowed"));
+ api_set_error(err, kErrorTypeValidation,
+ "Empty variable names aren't allowed");
return rv;
}
if (key.size > INT_MAX) {
- api_set_error(err, Validation, _("Key length is too high"));
+ api_set_error(err, kErrorTypeValidation, "Key length is too high");
return rv;
}
@@ -133,13 +136,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
if (di != NULL) {
if (di->di_flags & DI_FLAGS_RO) {
- api_set_error(err, Exception, _("Key is read-only: %s"), key.data);
+ api_set_error(err, kErrorTypeException, "Key is read-only: %s", key.data);
return rv;
} else if (di->di_flags & DI_FLAGS_FIX) {
- api_set_error(err, Exception, _("Key is fixed: %s"), key.data);
+ api_set_error(err, kErrorTypeException, "Key is fixed: %s", key.data);
return rv;
} else if (di->di_flags & DI_FLAGS_LOCK) {
- api_set_error(err, Exception, _("Key is locked: %s"), key.data);
+ api_set_error(err, kErrorTypeException, "Key is locked: %s", key.data);
return rv;
}
}
@@ -148,7 +151,8 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del,
// Delete the key
if (di == NULL) {
// Doesn't exist, fail
- api_set_error(err, Validation, _("Key \"%s\" doesn't exist"), key.data);
+ api_set_error(err, kErrorTypeValidation, "Key does not exist: %s",
+ key.data);
} else {
// Return the old value
if (retval) {
@@ -200,7 +204,7 @@ Object get_option_from(void *from, int type, String name, Error *err)
Object rv = OBJECT_INIT;
if (name.size == 0) {
- api_set_error(err, Validation, _("Empty option name"));
+ api_set_error(err, kErrorTypeValidation, "Empty option name");
return rv;
}
@@ -212,8 +216,8 @@ Object get_option_from(void *from, int type, String name, Error *err)
if (!flags) {
api_set_error(err,
- Validation,
- _("Invalid option name \"%s\""),
+ kErrorTypeValidation,
+ "Invalid option name \"%s\"",
name.data);
return rv;
}
@@ -231,14 +235,14 @@ Object get_option_from(void *from, int type, String name, Error *err)
rv.data.string.size = strlen(stringval);
} else {
api_set_error(err,
- Exception,
- _("Unable to get value for option \"%s\""),
+ kErrorTypeException,
+ "Unable to get value for option \"%s\"",
name.data);
}
} else {
api_set_error(err,
- Exception,
- _("Unknown type for option \"%s\""),
+ kErrorTypeException,
+ "Unknown type for option \"%s\"",
name.data);
}
@@ -255,7 +259,7 @@ Object get_option_from(void *from, int type, String name, Error *err)
void set_option_to(void *to, int type, String name, Object value, Error *err)
{
if (name.size == 0) {
- api_set_error(err, Validation, _("Empty option name"));
+ api_set_error(err, kErrorTypeValidation, "Empty option name");
return;
}
@@ -263,8 +267,8 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
if (flags == 0) {
api_set_error(err,
- Validation,
- _("Invalid option name \"%s\""),
+ kErrorTypeValidation,
+ "Invalid option name \"%s\"",
name.data);
return;
}
@@ -272,15 +276,15 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
if (value.type == kObjectTypeNil) {
if (type == SREQ_GLOBAL) {
api_set_error(err,
- Exception,
- _("Unable to unset option \"%s\""),
+ kErrorTypeException,
+ "Unable to unset option \"%s\"",
name.data);
return;
} else if (!(flags & SOPT_GLOBAL)) {
api_set_error(err,
- Exception,
- _("Cannot unset option \"%s\" "
- "because it doesn't have a global value"),
+ kErrorTypeException,
+ "Cannot unset option \"%s\" "
+ "because it doesn't have a global value",
name.data);
return;
} else {
@@ -294,8 +298,8 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
if (flags & SOPT_BOOL) {
if (value.type != kObjectTypeBoolean) {
api_set_error(err,
- Validation,
- _("Option \"%s\" requires a boolean value"),
+ kErrorTypeValidation,
+ "Option \"%s\" requires a boolean value",
name.data);
return;
}
@@ -305,16 +309,16 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
} else if (flags & SOPT_NUM) {
if (value.type != kObjectTypeInteger) {
api_set_error(err,
- Validation,
- _("Option \"%s\" requires an integer value"),
+ kErrorTypeValidation,
+ "Option \"%s\" requires an integer value",
name.data);
return;
}
if (value.data.integer > INT_MAX || value.data.integer < INT_MIN) {
api_set_error(err,
- Validation,
- _("Value for option \"%s\" is outside range"),
+ kErrorTypeValidation,
+ "Value for option \"%s\" is outside range",
name.data);
return;
}
@@ -324,8 +328,8 @@ void set_option_to(void *to, int type, String name, Object value, Error *err)
} else {
if (value.type != kObjectTypeString) {
api_set_error(err,
- Validation,
- _("Option \"%s\" requires a string value"),
+ kErrorTypeValidation,
+ "Option \"%s\" requires a string value",
name.data);
return;
}
@@ -558,13 +562,13 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
buf_T *rv = handle_get_buffer(buffer);
if (!rv) {
- api_set_error(err, Validation, _("Invalid buffer id"));
+ api_set_error(err, kErrorTypeValidation, "Invalid buffer id");
}
return rv;
}
-win_T * find_window_by_handle(Window window, Error *err)
+win_T *find_window_by_handle(Window window, Error *err)
{
if (window == 0) {
return curwin;
@@ -573,13 +577,13 @@ win_T * find_window_by_handle(Window window, Error *err)
win_T *rv = handle_get_window(window);
if (!rv) {
- api_set_error(err, Validation, _("Invalid window id"));
+ api_set_error(err, kErrorTypeValidation, "Invalid window id");
}
return rv;
}
-tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err)
+tabpage_T *find_tab_by_handle(Tabpage tabpage, Error *err)
{
if (tabpage == 0) {
return curtab;
@@ -588,7 +592,7 @@ tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err)
tabpage_T *rv = handle_get_tabpage(tabpage);
if (!rv) {
- api_set_error(err, Validation, _("Invalid tabpage id"));
+ api_set_error(err, kErrorTypeValidation, "Invalid tabpage id");
}
return rv;
@@ -656,7 +660,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
case kObjectTypeInteger:
if (obj.data.integer > VARNUMBER_MAX
|| obj.data.integer < VARNUMBER_MIN) {
- api_set_error(err, Validation, _("Integer value outside range"));
+ api_set_error(err, kErrorTypeValidation, "Integer value outside range");
return false;
}
@@ -710,8 +714,8 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
String key = item.key;
if (key.size == 0) {
- api_set_error(err, Validation,
- _("Empty dictionary keys aren't allowed"));
+ api_set_error(err, kErrorTypeValidation,
+ "Empty dictionary keys aren't allowed");
// cleanup
tv_dict_free(dict);
return false;
@@ -798,6 +802,17 @@ void api_free_dictionary(Dictionary value)
xfree(value.items);
}
+void api_clear_error(Error *value)
+ FUNC_ATTR_NONNULL_ALL
+{
+ if (!ERROR_SET(value)) {
+ return;
+ }
+ xfree(value->msg);
+ value->msg = NULL;
+ value->type = kErrorTypeNone;
+}
+
Dictionary api_metadata(void)
{
static Dictionary metadata = ARRAY_DICT_INIT;
@@ -924,8 +939,8 @@ static void set_option_value_for(char *key,
return;
}
api_set_error(err,
- Exception,
- _("Problem while switching windows"));
+ kErrorTypeException,
+ "Problem while switching windows");
return;
}
set_option_value_err(key, numval, stringval, opt_flags, err);
@@ -941,7 +956,7 @@ static void set_option_value_for(char *key,
break;
}
- if (err->set) {
+ if (ERROR_SET(err)) {
return;
}
@@ -962,6 +977,26 @@ static void set_option_value_err(char *key,
return;
}
- api_set_error(err, Exception, "%s", errmsg);
+ api_set_error(err, kErrorTypeException, "%s", errmsg);
}
}
+
+void api_set_error(Error *err, ErrorType errType, const char *format, ...)
+ FUNC_ATTR_NONNULL_ALL
+{
+ assert(kErrorTypeNone != errType);
+ va_list args1;
+ va_list args2;
+ va_start(args1, format);
+ va_copy(args2, args1);
+ int len = vsnprintf(NULL, 0, format, args1);
+ va_end(args1);
+ assert(len >= 0);
+ // Limit error message to 1 MB.
+ size_t bufsize = MIN((size_t)len + 1, 1024 * 1024);
+ err->msg = xmalloc(bufsize);
+ vsnprintf(err->msg, bufsize, format, args2);
+ va_end(args2);
+
+ err->type = errType;
+}
diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h
index 9fe8c351cf..681945ac9c 100644
--- a/src/nvim/api/private/helpers.h
+++ b/src/nvim/api/private/helpers.h
@@ -8,15 +8,6 @@
#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; \
- } while (0)
-
#define OBJECT_OBJ(o) o
#define BOOLEAN_OBJ(b) ((Object) { \
diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c
index 0f0c33f621..6f2f9e1d2a 100644
--- a/src/nvim/api/tabpage.c
+++ b/src/nvim/api/tabpage.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -190,6 +193,8 @@ Boolean nvim_tabpage_is_valid(Tabpage tabpage)
FUNC_API_SINCE(1)
{
Error stub = ERROR_INIT;
- return find_tab_by_handle(tabpage, &stub) != NULL;
+ Boolean ret = find_tab_by_handle(tabpage, &stub) != NULL;
+ api_clear_error(&stub);
+ return ret;
}
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 625bcc6b4b..f0da0d1812 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
@@ -12,6 +15,7 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/popupmnu.h"
+#include "nvim/cursor_shape.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/ui.c.generated.h"
@@ -51,13 +55,13 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (pmap_has(uint64_t)(connected_uis, channel_id)) {
- api_set_error(err, Exception, _("UI already attached for channel"));
+ api_set_error(err, kErrorTypeException, "UI already attached for channel");
return;
}
if (width <= 0 || height <= 0) {
- api_set_error(err, Validation,
- _("Expected width > 0 and height > 0"));
+ api_set_error(err, kErrorTypeValidation,
+ "Expected width > 0 and height > 0");
return;
}
UI *ui = xcalloc(1, sizeof(UI));
@@ -69,6 +73,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
ui->clear = remote_ui_clear;
ui->eol_clear = remote_ui_eol_clear;
ui->cursor_goto = remote_ui_cursor_goto;
+ ui->mode_info_set = remote_ui_mode_info_set;
ui->update_menu = remote_ui_update_menu;
ui->busy_start = remote_ui_busy_start;
ui->busy_stop = remote_ui_busy_stop;
@@ -92,7 +97,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
for (size_t i = 0; i < options.size; i++) {
ui_set_option(ui, options.items[i].key, options.items[i].value, err);
- if (err->set) {
+ if (ERROR_SET(err)) {
xfree(ui);
return;
}
@@ -121,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err)
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- api_set_error(err, Exception, _("UI is not attached for channel"));
+ api_set_error(err, kErrorTypeException, "UI is not attached for channel");
return;
}
remote_ui_disconnect(channel_id);
@@ -133,13 +138,13 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- api_set_error(err, Exception, _("UI is not attached for channel"));
+ api_set_error(err, kErrorTypeException, "UI is not attached for channel");
return;
}
if (width <= 0 || height <= 0) {
- api_set_error(err, Validation,
- _("Expected width > 0 and height > 0"));
+ api_set_error(err, kErrorTypeValidation,
+ "Expected width > 0 and height > 0");
return;
}
@@ -154,13 +159,13 @@ void nvim_ui_set_option(uint64_t channel_id, String name,
FUNC_API_SINCE(1) FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
- api_set_error(error, Exception, _("UI is not attached for channel"));
+ api_set_error(error, kErrorTypeException, "UI is not attached for channel");
return;
}
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
ui_set_option(ui, name, value, error);
- if (!error->set) {
+ if (!ERROR_SET(error)) {
ui_refresh();
}
}
@@ -168,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name,
static void ui_set_option(UI *ui, String name, Object value, Error *error) {
if (strcmp(name.data, "rgb") == 0) {
if (value.type != kObjectTypeBoolean) {
- api_set_error(error, Validation, _("rgb must be a Boolean"));
+ api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean");
return;
}
ui->rgb = value.data.boolean;
} else if (strcmp(name.data, "popupmenu_external") == 0) {
if (value.type != kObjectTypeBoolean) {
- api_set_error(error, Validation,
- _("popupmenu_external must be a Boolean"));
+ api_set_error(error, kErrorTypeValidation,
+ "popupmenu_external must be a Boolean");
return;
}
ui->pum_external = value.data.boolean;
} else {
- api_set_error(error, Validation, _("No such ui option"));
+ api_set_error(error, kErrorTypeValidation, "No such ui option");
}
}
@@ -264,19 +269,14 @@ static void remote_ui_mouse_off(UI *ui)
push_call(ui, "mouse_off", args);
}
-static void remote_ui_mode_change(UI *ui, int mode)
+static void remote_ui_mode_change(UI *ui, int mode_idx)
{
Array args = ARRAY_DICT_INIT;
- if (mode == INSERT) {
- ADD(args, STRING_OBJ(cstr_to_string("insert")));
- } else if (mode == REPLACE) {
- ADD(args, STRING_OBJ(cstr_to_string("replace")));
- } else if (mode == CMDLINE) {
- ADD(args, STRING_OBJ(cstr_to_string("cmdline")));
- } else {
- assert(mode == NORMAL);
- ADD(args, STRING_OBJ(cstr_to_string("normal")));
- }
+
+ char *full_name = shape_table[mode_idx].full_name;
+ ADD(args, STRING_OBJ(cstr_to_string(full_name)));
+
+ ADD(args, INTEGER_OBJ(mode_idx));
push_call(ui, "mode_change", args);
}
@@ -298,6 +298,14 @@ static void remote_ui_scroll(UI *ui, int count)
push_call(ui, "scroll", args);
}
+static void remote_ui_mode_info_set(UI *ui, bool guicursor_enabled, Array data)
+{
+ Array args = ARRAY_DICT_INIT;
+ ADD(args, BOOLEAN_OBJ(guicursor_enabled));
+ ADD(args, copy_object(ARRAY_OBJ(data)));
+ push_call(ui, "mode_info_set", args);
+}
+
static void remote_ui_highlight_set(UI *ui, HlAttrs attrs)
{
Array args = ARRAY_DICT_INIT;
@@ -383,8 +391,10 @@ static void remote_ui_update_sp(UI *ui, int sp)
static void remote_ui_flush(UI *ui)
{
UIData *data = ui->data;
- channel_send_event(data->channel_id, "redraw", data->buffer);
- data->buffer = (Array)ARRAY_DICT_INIT;
+ if (data->buffer.size > 0) {
+ channel_send_event(data->channel_id, "redraw", data->buffer);
+ data->buffer = (Array)ARRAY_DICT_INIT;
+ }
}
static void remote_ui_suspend(UI *ui)
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 6926436d2f..da00fbc6e3 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
#include <inttypes.h>
@@ -162,8 +165,8 @@ String nvim_command_output(String str, Error *err)
nvim_command(str, err);
do_cmdline_cmd("redir END");
- if (err->set) {
- return (String) STRING_INIT;
+ if (ERROR_SET(err)) {
+ return (String)STRING_INIT;
}
return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT));
@@ -185,7 +188,7 @@ Object nvim_eval(String expr, Error *err)
typval_T rettv;
if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) {
- api_set_error(err, Exception, "Failed to evaluate expression");
+ api_set_error(err, kErrorTypeException, "Failed to evaluate expression");
}
if (!try_end(err)) {
@@ -211,8 +214,8 @@ Object nvim_call_function(String fname, Array args, Error *err)
{
Object rv = OBJECT_INIT;
if (args.size > MAX_FUNC_ARGS) {
- api_set_error(err, Validation,
- _("Function called with too many arguments."));
+ api_set_error(err, kErrorTypeValidation,
+ "Function called with too many arguments.");
return rv;
}
@@ -234,7 +237,7 @@ Object nvim_call_function(String fname, Array args, Error *err)
curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy,
true, NULL, NULL);
if (r == FAIL) {
- api_set_error(err, Exception, _("Error calling function."));
+ api_set_error(err, kErrorTypeException, "Error calling function.");
}
if (!try_end(err)) {
rv = vim_to_object(&rettv);
@@ -259,7 +262,7 @@ Integer nvim_strwidth(String str, Error *err)
FUNC_API_SINCE(1)
{
if (str.size > INT_MAX) {
- api_set_error(err, Validation, _("String length is too high"));
+ api_set_error(err, kErrorTypeValidation, "String length is too high");
return 0;
}
@@ -315,7 +318,7 @@ void nvim_set_current_dir(String dir, Error *err)
FUNC_API_SINCE(1)
{
if (dir.size >= MAXPATHL) {
- api_set_error(err, Validation, _("Directory string is too long"));
+ api_set_error(err, kErrorTypeValidation, "Directory string is too long");
return;
}
@@ -327,7 +330,7 @@ void nvim_set_current_dir(String dir, Error *err)
if (vim_chdir((char_u *)string, kCdScopeGlobal)) {
if (!try_end(err)) {
- api_set_error(err, Exception, _("Failed to change directory"));
+ api_set_error(err, kErrorTypeException, "Failed to change directory");
}
return;
}
@@ -536,8 +539,8 @@ void nvim_set_current_buf(Buffer buffer, Error *err)
int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0);
if (!try_end(err) && result == FAIL) {
api_set_error(err,
- Exception,
- _("Failed to switch to buffer %d"),
+ kErrorTypeException,
+ "Failed to switch to buffer %d",
buffer);
}
}
@@ -589,8 +592,8 @@ void nvim_set_current_win(Window window, Error *err)
goto_tabpage_win(win_find_tabpage(win), win);
if (!try_end(err) && win != curwin) {
api_set_error(err,
- Exception,
- _("Failed to switch to window %d"),
+ kErrorTypeException,
+ "Failed to switch to window %d",
window);
}
}
@@ -643,8 +646,8 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
goto_tabpage_tp(tp, true, true);
if (!try_end(err) && tp != curtab) {
api_set_error(err,
- Exception,
- _("Failed to switch to tabpage %d"),
+ kErrorTypeException,
+ "Failed to switch to tabpage %d",
tabpage);
}
}
@@ -742,30 +745,30 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
for (i = 0; i < calls.size; i++) {
if (calls.items[i].type != kObjectTypeArray) {
api_set_error(err,
- Validation,
- _("All items in calls array must be arrays"));
+ kErrorTypeValidation,
+ "All items in calls array must be arrays");
goto validation_error;
}
Array call = calls.items[i].data.array;
if (call.size != 2) {
api_set_error(err,
- Validation,
- _("All items in calls array must be arrays of size 2"));
+ kErrorTypeValidation,
+ "All items in calls array must be arrays of size 2");
goto validation_error;
}
if (call.items[0].type != kObjectTypeString) {
api_set_error(err,
- Validation,
- _("name must be String"));
+ kErrorTypeValidation,
+ "Name must be String");
goto validation_error;
}
String name = call.items[0].data.string;
if (call.items[1].type != kObjectTypeArray) {
api_set_error(err,
- Validation,
- _("args must be Array"));
+ kErrorTypeValidation,
+ "Args must be Array");
goto validation_error;
}
Array args = call.items[1].data.array;
@@ -773,7 +776,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data,
name.size);
Object result = handler.fn(channel_id, args, &nested_error);
- if (nested_error.set) {
+ if (ERROR_SET(&nested_error)) {
// error handled after loop
break;
}
@@ -782,7 +785,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
}
ADD(rv, ARRAY_OBJ(results));
- if (nested_error.set) {
+ if (ERROR_SET(&nested_error)) {
Array errval = ARRAY_DICT_INIT;
ADD(errval, INTEGER_OBJ((Integer)i));
ADD(errval, INTEGER_OBJ(nested_error.type));
@@ -791,10 +794,12 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
} else {
ADD(rv, NIL);
}
- return rv;
+ goto theend;
validation_error:
api_free_array(results);
+theend:
+ api_clear_error(&nested_error);
return rv;
}
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 3c564ada99..859bf88398 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -62,8 +65,8 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger
|| pos.items[1].type != kObjectTypeInteger) {
api_set_error(err,
- Validation,
- _("Argument \"pos\" must be a [row, col] array"));
+ kErrorTypeValidation,
+ "Argument \"pos\" must be a [row, col] array");
return;
}
@@ -75,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
int64_t col = pos.items[1].data.integer;
if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) {
- api_set_error(err, Validation, _("Cursor position outside buffer"));
+ api_set_error(err, kErrorTypeValidation, "Cursor position outside buffer");
return;
}
if (col > MAXCOL || col < 0) {
- api_set_error(err, Validation, _("Column value outside range"));
+ api_set_error(err, kErrorTypeValidation, "Column value outside range");
return;
}
@@ -129,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err)
}
if (height > INT_MAX || height < INT_MIN) {
- api_set_error(err, Validation, _("Height value outside range"));
+ api_set_error(err, kErrorTypeValidation, "Height value outside range");
return;
}
@@ -174,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err)
}
if (width > INT_MAX || width < INT_MIN) {
- api_set_error(err, Validation, _("Width value outside range"));
+ api_set_error(err, kErrorTypeValidation, "Width value outside range");
return;
}
@@ -384,6 +387,8 @@ Boolean nvim_win_is_valid(Window window)
FUNC_API_SINCE(1)
{
Error stub = ERROR_INIT;
- return find_window_by_handle(window, &stub) != NULL;
+ Boolean ret = find_window_by_handle(window, &stub) != NULL;
+ api_clear_error(&stub);
+ return ret;
}
diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c
index db97bd9dc4..1ef51d2a2a 100644
--- a/src/nvim/arabic.c
+++ b/src/nvim/arabic.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file arabic.c
///
/// Functions for Arabic language.
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index c9101c5b53..46f2cdac79 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* buffer.c: functions for dealing with the buffer structure
*/
@@ -741,12 +744,13 @@ static void clear_wininfo(buf_T *buf)
*/
void goto_buffer(exarg_T *eap, int start, int dir, int count)
{
- (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
- start, dir, count, eap->forceit);
bufref_T old_curbuf;
set_bufref(&old_curbuf, curbuf);
swap_exists_action = SEA_DIALOG;
+ (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO,
+ start, dir, count, eap->forceit);
+
if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') {
cleanup_T cs;
@@ -1838,9 +1842,7 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit)
return FAIL;
}
-/*
- * go to the last know line number for the current buffer
- */
+// Go to the last known line number for the current buffer.
void buflist_getfpos(void)
{
pos_T *fpos;
@@ -2338,9 +2340,7 @@ linenr_T buflist_findlnum(buf_T *buf)
return buflist_findfpos(buf)->lnum;
}
-/*
- * List all know file names (for :files and :buffers command).
- */
+// List all known file names (for :files and :buffers command).
void buflist_list(exarg_T *eap)
{
buf_T *buf;
@@ -2724,7 +2724,7 @@ fileinfo (
else
name = curbuf->b_ffname;
home_replace(shorthelp ? curbuf : NULL, name, p,
- (int)(IOSIZE - (p - buffer)), TRUE);
+ (size_t)(IOSIZE - (p - buffer)), true);
}
vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s",
@@ -2889,7 +2889,7 @@ void maketitle(void)
buf[off++] = ' ';
buf[off++] = '(';
home_replace(curbuf, curbuf->b_ffname,
- buf + off, SPACE_FOR_DIR - off, TRUE);
+ buf + off, (size_t)(SPACE_FOR_DIR - off), true);
#ifdef BACKSLASH_IN_FILENAME
/* avoid "c:/name" to be reduced to "c" */
if (isalpha(buf[off]) && buf[off + 1] == ':')
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h
index 016c5ce3b7..39b9faf8b1 100644
--- a/src/nvim/buffer.h
+++ b/src/nvim/buffer.h
@@ -103,7 +103,8 @@ static inline void buf_set_changedtick(buf_T *const buf, const int changedtick)
assert(changedtick_di->di_flags == (DI_FLAGS_RO|DI_FLAGS_FIX));
# endif
assert(changedtick_di == (dictitem_T *)&buf->changedtick_di);
- assert(&buf->b_changedtick == &buf->changedtick_di.di_tv.vval.v_number);
+ assert(&buf->b_changedtick // -V501
+ == &buf->changedtick_di.di_tv.vval.v_number);
#endif
buf->b_changedtick = changedtick;
}
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 99d3e2dd88..ee58e0af91 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file charset.c
///
/// Code related to character sets.
@@ -15,6 +18,7 @@
#include "nvim/func_attr.h"
#include "nvim/indent.h"
#include "nvim/main.h"
+#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
@@ -212,8 +216,8 @@ int buf_init_chartab(buf_T *buf, int global)
// work properly when 'encoding' is "latin1" and the locale is
// "C".
if (!do_isalpha
- || vim_islower(c)
- || vim_isupper(c)
+ || mb_islower(c)
+ || mb_isupper(c)
|| (p_altkeymap && (F_isalpha(c) || F_isdigit(c)))) {
if (i == 0) {
// (re)set ID flag
@@ -417,11 +421,11 @@ char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
while (STR_CHAR(i) != NUL) {
int c = utf_ptr2char(STR_PTR(i));
int olen = utf_ptr2len(STR_PTR(i));
- int lc = utf_tolower(c);
+ int lc = mb_tolower(c);
// Only replace the character when it is not an invalid
// sequence (ASCII character or more than one byte) and
- // utf_tolower() doesn't return the original character.
+ // mb_tolower() doesn't return the original character.
if (((c < 0x80) || (olen > 1)) && (c != lc)) {
int nlen = utf_char2len(lc);
@@ -1366,7 +1370,7 @@ void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left,
colnr_T to1;
colnr_T to2;
- if (ltp(pos1, pos2)) {
+ if (lt(*pos1, *pos2)) {
getvvcol(wp, pos1, &from1, NULL, &to1);
getvvcol(wp, pos2, &from2, NULL, &to2);
} else {
@@ -1506,67 +1510,6 @@ char_u* skiptohex(char_u *q)
return p;
}
-// Vim's own character class functions. These exist because many library
-// islower()/toupper() etc. do not work properly: they crash when used with
-// invalid values or can't handle latin1 when the locale is C.
-// Speed is most important here.
-
-/// Check that the character is lower-case
-///
-/// @param c character to check
-bool vim_islower(int c)
- FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
-{
- if (c <= '@') {
- return false;
- }
-
- if (c >= 0x80) {
- return utf_islower(c);
- }
- return islower(c);
-}
-
-/// Check that the character is upper-case
-///
-/// @param c character to check
-bool vim_isupper(int c)
- FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
-{
- if (c <= '@') {
- return false;
- }
-
- if (c >= 0x80) {
- return utf_isupper(c);
- }
- return isupper(c);
-}
-
-int vim_toupper(int c)
-{
- if (c <= '@') {
- return c;
- }
-
- if (c >= 0x80) {
- return utf_toupper(c);
- }
- return TOUPPER_LOC(c);
-}
-
-int vim_tolower(int c)
-{
- if (c <= '@') {
- return c;
- }
-
- if (c >= 0x80) {
- return utf_tolower(c);
- }
- return TOLOWER_LOC(c);
-}
-
/// Skip over text until ' ' or '\t' or NUL
///
/// @param[in] p Text to skip over.
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index 45abd314fc..60002f3cea 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <inttypes.h>
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index b50462664c..dcc680f806 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
#include "nvim/vim.h"
@@ -7,40 +10,75 @@
#include "nvim/charset.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
+#include "nvim/api/private/helpers.h"
+#include "nvim/ui.h"
-/*
- * Handling of cursor and mouse pointer shapes in various modes.
- */
-
-static cursorentry_T shape_table[SHAPE_IDX_COUNT] =
+/// Handling of cursor and mouse pointer shapes in various modes.
+cursorentry_T shape_table[SHAPE_IDX_COUNT] =
{
- /* The values will be filled in from the 'guicursor' and 'mouseshape'
- * defaults when Vim starts.
- * Adjust the SHAPE_IDX_ defines when making changes! */
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE},
- {0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE},
- {0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR},
+ // Values are set by 'guicursor' and 'mouseshape'.
+ // Adjust the SHAPE_IDX_ defines when changing this!
+ { "normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "visual", 0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "cmdline_normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "cmdline_insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "cmdline_replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "operator", 0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "visual_select", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE },
+ { "cmdline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE },
+ { "statusline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE },
+ { "statusline_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE },
+ { "vsep_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE },
+ { "vsep_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE },
+ { "more", 0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE },
+ { "more_lastline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE },
+ { "showmatch", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR },
};
-/*
- * Parse the 'guicursor' option ("what" is SHAPE_CURSOR) or 'mouseshape'
- * ("what" is SHAPE_MOUSE).
- * Returns error message for an illegal option, NULL otherwise.
- */
+/// Converts cursor_shapes into an Array of Dictionaries
+/// @return Array of the form {[ "cursor_shape": ... ], ...}
+Array mode_style_array(void)
+{
+ Array all = ARRAY_DICT_INIT;
+
+ for (int i = 0; i < SHAPE_IDX_COUNT; i++) {
+ Dictionary dic = ARRAY_DICT_INIT;
+ cursorentry_T *cur = &shape_table[i];
+ if (cur->used_for & SHAPE_MOUSE) {
+ PUT(dic, "mouse_shape", INTEGER_OBJ(cur->mshape));
+ }
+ if (cur->used_for & SHAPE_CURSOR) {
+ String shape_str;
+ switch (cur->shape) {
+ case SHAPE_BLOCK: shape_str = cstr_to_string("block"); break;
+ case SHAPE_VER: shape_str = cstr_to_string("vertical"); break;
+ case SHAPE_HOR: shape_str = cstr_to_string("horizontal"); break;
+ default: shape_str = cstr_to_string("unknown");
+ }
+ PUT(dic, "cursor_shape", STRING_OBJ(shape_str));
+ PUT(dic, "cell_percentage", INTEGER_OBJ(cur->percentage));
+ PUT(dic, "blinkwait", INTEGER_OBJ(cur->blinkwait));
+ PUT(dic, "blinkon", INTEGER_OBJ(cur->blinkon));
+ PUT(dic, "blinkoff", INTEGER_OBJ(cur->blinkoff));
+ PUT(dic, "hl_id", INTEGER_OBJ(cur->id));
+ PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm));
+ }
+ PUT(dic, "name", STRING_OBJ(cstr_to_string(cur->full_name)));
+ PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name)));
+
+ ADD(all, DICTIONARY_OBJ(dic));
+ }
+
+ return all;
+}
+
+/// Parse the 'guicursor' option
+///
+/// @param what SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape')
+///
+/// @returns error message for an illegal option, NULL otherwise.
char_u *parse_shape_opt(int what)
{
char_u *modep;
@@ -55,14 +93,13 @@ char_u *parse_shape_opt(int what)
int found_ve = false; /* found "ve" flag */
int round;
- /*
- * First round: check for errors; second round: do it for real.
- */
- for (round = 1; round <= 2; ++round) {
- /*
- * Repeat for all comma separated parts.
- */
+ // First round: check for errors; second round: do it for real.
+ for (round = 1; round <= 2; round++) {
+ // Repeat for all comma separated parts.
modep = p_guicursor;
+ if (*p_guicursor == NUL) {
+ modep = (char_u *)"a:block-blinkon0";
+ }
while (*modep != NUL) {
colonp = vim_strchr(modep, ':');
if (colonp == NULL)
@@ -71,19 +108,18 @@ char_u *parse_shape_opt(int what)
return (char_u *)N_("E546: Illegal mode");
commap = vim_strchr(modep, ',');
- /*
- * Repeat for all mode's before the colon.
- * For the 'a' mode, we loop to handle all the modes.
- */
+ // Repeat for all modes before the colon.
+ // For the 'a' mode, we loop to handle all the modes.
all_idx = -1;
assert(modep < colonp);
while (modep < colonp || all_idx >= 0) {
if (all_idx < 0) {
- /* Find the mode. */
- if (modep[1] == '-' || modep[1] == ':')
+ // Find the mode
+ if (modep[1] == '-' || modep[1] == ':') {
len = 1;
- else
+ } else {
len = 2;
+ }
if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') {
all_idx = SHAPE_IDX_COUNT - 1;
@@ -100,11 +136,11 @@ char_u *parse_shape_opt(int what)
modep += len + 1;
}
- if (all_idx >= 0)
+ if (all_idx >= 0) {
idx = all_idx--;
- else if (round == 2) {
+ } else if (round == 2) {
{
- /* Set the defaults, for the missing parts */
+ // Set the defaults, for the missing parts
shape_table[idx].shape = SHAPE_BLOCK;
shape_table[idx].blinkwait = 700L;
shape_table[idx].blinkon = 400L;
@@ -208,6 +244,55 @@ char_u *parse_shape_opt(int what)
shape_table[SHAPE_IDX_VE].id_lm = shape_table[SHAPE_IDX_V].id_lm;
}
}
-
+ ui_mode_info_set();
return NULL;
}
+
+
+/// Map cursor mode from string to integer
+///
+/// @param mode Fullname of the mode whose id we are looking for
+/// @return -1 in case of failure, else the matching SHAPE_ID* integer
+int cursor_mode_str2int(const char *mode)
+{
+ for (int current_mode = 0; current_mode < SHAPE_IDX_COUNT; current_mode++) {
+ if (strcmp(shape_table[current_mode].full_name, mode) == 0) {
+ return current_mode;
+ }
+ }
+ ELOG("Unknown mode %s", mode);
+ return -1;
+}
+
+
+/// Return the index into shape_table[] for the current mode.
+int cursor_get_mode_idx(void)
+{
+ if (State == SHOWMATCH) {
+ return SHAPE_IDX_SM;
+ } else if (State & VREPLACE_FLAG) {
+ return SHAPE_IDX_R;
+ } else if (State & REPLACE_FLAG) {
+ return SHAPE_IDX_R;
+ } else if (State & INSERT) {
+ return SHAPE_IDX_I;
+ } else if (State & CMDLINE) {
+ if (cmdline_at_end()) {
+ return SHAPE_IDX_C;
+ } else if (cmdline_overstrike()) {
+ return SHAPE_IDX_CR;
+ } else {
+ return SHAPE_IDX_CI;
+ }
+ } else if (finish_op) {
+ return SHAPE_IDX_O;
+ } else if (VIsual_active) {
+ if (*p_sel == 'e') {
+ return SHAPE_IDX_VE;
+ } else {
+ return SHAPE_IDX_V;
+ }
+ } else {
+ return SHAPE_IDX_N;
+ }
+}
diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h
index 9ce1b6e0a0..2c466603f0 100644
--- a/src/nvim/cursor_shape.h
+++ b/src/nvim/cursor_shape.h
@@ -1,32 +1,37 @@
#ifndef NVIM_CURSOR_SHAPE_H
#define NVIM_CURSOR_SHAPE_H
-/*
- * struct to store values from 'guicursor' and 'mouseshape'
- */
-/* Indexes in shape_table[] */
-#define SHAPE_IDX_N 0 /* Normal mode */
-#define SHAPE_IDX_V 1 /* Visual mode */
-#define SHAPE_IDX_I 2 /* Insert mode */
-#define SHAPE_IDX_R 3 /* Replace mode */
-#define SHAPE_IDX_C 4 /* Command line Normal mode */
-#define SHAPE_IDX_CI 5 /* Command line Insert mode */
-#define SHAPE_IDX_CR 6 /* Command line Replace mode */
-#define SHAPE_IDX_O 7 /* Operator-pending mode */
-#define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */
-#define SHAPE_IDX_CLINE 9 /* On command line */
-#define SHAPE_IDX_STATUS 10 /* A status line */
-#define SHAPE_IDX_SDRAG 11 /* dragging a status line */
-#define SHAPE_IDX_VSEP 12 /* A vertical separator line */
-#define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */
-#define SHAPE_IDX_MORE 14 /* Hit-return or More */
-#define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */
-#define SHAPE_IDX_SM 16 /* showing matching paren */
-#define SHAPE_IDX_COUNT 17
-
-#define SHAPE_BLOCK 0 /* block cursor */
-#define SHAPE_HOR 1 /* horizontal bar cursor */
-#define SHAPE_VER 2 /* vertical bar cursor */
+#include "nvim/types.h"
+#include "nvim/api/private/defs.h"
+
+/// struct to store values from 'guicursor' and 'mouseshape'
+/// Indexes in shape_table[]
+typedef enum {
+SHAPE_IDX_N = 0, ///< Normal mode
+SHAPE_IDX_V = 1, ///< Visual mode
+SHAPE_IDX_I = 2, ///< Insert mode
+SHAPE_IDX_R = 3, ///< Replace mode
+SHAPE_IDX_C = 4, ///< Command line Normal mode
+SHAPE_IDX_CI = 5, ///< Command line Insert mode
+SHAPE_IDX_CR = 6, ///< Command line Replace mode
+SHAPE_IDX_O = 7, ///< Operator-pending mode
+SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive
+SHAPE_IDX_CLINE = 9, ///< On command line
+SHAPE_IDX_STATUS = 10, ///< On status line
+SHAPE_IDX_SDRAG = 11, ///< dragging a status line
+SHAPE_IDX_VSEP = 12, ///< On vertical separator line
+SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line
+SHAPE_IDX_MORE = 14, ///< Hit-return or More
+SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line
+SHAPE_IDX_SM = 16, ///< showing matching paren
+SHAPE_IDX_COUNT = 17
+} ModeShape;
+
+typedef enum {
+SHAPE_BLOCK = 0, ///< block cursor
+SHAPE_HOR = 1, ///< horizontal bar cursor
+SHAPE_VER = 2 ///< vertical bar cursor
+} CursorShape;
#define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */
#define MSHAPE_HIDE 1 /* hide mouse pointer */
@@ -35,18 +40,20 @@
#define SHAPE_CURSOR 2 /* used for text cursor shape */
typedef struct cursor_entry {
- int shape; /* one of the SHAPE_ defines */
- int mshape; /* one of the MSHAPE defines */
- int percentage; /* percentage of cell for bar */
- long blinkwait; /* blinking, wait time before blinking starts */
- long blinkon; /* blinking, on time */
- long blinkoff; /* blinking, off time */
- int id; /* highlight group ID */
- int id_lm; /* highlight group ID for :lmap mode */
- char *name; /* mode name (fixed) */
- char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */
+ char *full_name; ///< mode description
+ CursorShape shape; ///< cursor shape: one of the SHAPE_ defines
+ int mshape; ///< mouse shape: one of the MSHAPE defines
+ int percentage; ///< percentage of cell for bar
+ long blinkwait; ///< blinking, wait time before blinking starts
+ long blinkon; ///< blinking, on time
+ long blinkoff; ///< blinking, off time
+ int id; ///< highlight group ID
+ int id_lm; ///< highlight group ID for :lmap mode
+ char *name; ///< mode short name
+ char used_for; ///< SHAPE_MOUSE and/or SHAPE_CURSOR
} cursorentry_T;
+extern cursorentry_T shape_table[SHAPE_IDX_COUNT];
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "cursor_shape.h.generated.h"
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index ff76abc01f..0bd3f59cf2 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file diff.c
///
/// Code for diff'ing two, three or four buffers.
@@ -1076,8 +1079,8 @@ void diff_win_options(win_T *wp, int addbuf)
if (!wp->w_p_diff) {
wp->w_p_wrap_save = wp->w_p_wrap;
}
- wp->w_p_wrap = FALSE;
- curwin = wp;
+ wp->w_p_wrap = false;
+ curwin = wp; // -V519
curbuf = curwin->w_buffer;
if (!wp->w_p_diff) {
diff --git a/src/nvim/diff.h b/src/nvim/diff.h
index f6cef1cafd..3624ce29bb 100644
--- a/src/nvim/diff.h
+++ b/src/nvim/diff.h
@@ -1,6 +1,9 @@
#ifndef NVIM_DIFF_H
#define NVIM_DIFF_H
+#include "nvim/pos.h"
+#include "nvim/ex_cmds_defs.h"
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "diff.h.generated.h"
#endif
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 560205fe7d..32e71f61f7 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file digraph.c
///
/// code for digraphs
@@ -1569,7 +1572,8 @@ int getdigraph(int char1, int char2, int meta_char)
if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
&& (char1 != char2)
- && ((retval = getexactdigraph(char2, char1, meta_char)) == char1)) {
+ && ((retval = getexactdigraph(char2, char1, meta_char)) // -V764
+ == char1)) {
return char2;
}
return retval;
@@ -1675,11 +1679,7 @@ static void printdigraph(digr_T *dp)
int list_width;
- if ((dy_flags & DY_UHEX) || has_mbyte) {
- list_width = 13;
- } else {
- list_width = 11;
- }
+ list_width = 13;
if (dp->result != 0) {
if (msg_col > Columns - list_width) {
@@ -1700,15 +1700,11 @@ static void printdigraph(digr_T *dp)
*p++ = dp->char2;
*p++ = ' ';
- if (has_mbyte) {
- // add a space to draw a composing char on
- if (enc_utf8 && utf_iscomposing(dp->result)) {
- *p++ = ' ';
- }
- p += (*mb_char2bytes)(dp->result, p);
- } else {
- *p++ = (char_u)dp->result;
+ // add a space to draw a composing char on
+ if (utf_iscomposing(dp->result)) {
+ *p++ = ' ';
}
+ p += (*mb_char2bytes)(dp->result, p);
if (char2cells(dp->result) == 1) {
*p++ = ' ';
diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h
index b623969e08..1b73ccaf3f 100644
--- a/src/nvim/digraph.h
+++ b/src/nvim/digraph.h
@@ -1,6 +1,9 @@
#ifndef NVIM_DIGRAPH_H
#define NVIM_DIGRAPH_H
+#include "nvim/types.h"
+#include "nvim/ex_cmds_defs.h"
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "digraph.h.generated.h"
#endif
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index da09aed3dc..678fa851eb 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* edit.c: functions for Insert mode
*/
@@ -2037,12 +2040,12 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
} else {
c = *(p++);
}
- if (vim_islower(c)) {
+ if (mb_islower(c)) {
has_lower = true;
- if (vim_isupper(wca[i])) {
+ if (mb_isupper(wca[i])) {
// Rule 1 is satisfied.
for (i = actual_compl_length; i < actual_len; i++) {
- wca[i] = vim_tolower(wca[i]);
+ wca[i] = mb_tolower(wca[i]);
}
break;
}
@@ -2062,14 +2065,14 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
} else {
c = *(p++);
}
- if (was_letter && vim_isupper(c) && vim_islower(wca[i])) {
+ if (was_letter && mb_isupper(c) && mb_islower(wca[i])) {
// Rule 2 is satisfied.
for (i = actual_compl_length; i < actual_len; i++) {
- wca[i] = vim_toupper(wca[i]);
+ wca[i] = mb_toupper(wca[i]);
}
break;
}
- was_letter = vim_islower(c) || vim_isupper(c);
+ was_letter = mb_islower(c) || mb_isupper(c);
}
}
@@ -2082,10 +2085,10 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
} else {
c = *(p++);
}
- if (vim_islower(c)) {
- wca[i] = vim_tolower(wca[i]);
- } else if (vim_isupper(c)) {
- wca[i] = vim_toupper(wca[i]);
+ if (mb_islower(c)) {
+ wca[i] = mb_tolower(wca[i]);
+ } else if (mb_isupper(c)) {
+ wca[i] = mb_toupper(wca[i]);
}
}
}
@@ -2109,7 +2112,7 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int
xfree(wca);
- return ins_compl_add(IObuff, len, icase, fname, NULL, true, dir, flags,
+ return ins_compl_add(IObuff, len, icase, fname, NULL, false, dir, flags,
false);
}
return ins_compl_add(str, len, icase, fname, NULL, false, dir, flags, false);
@@ -2146,7 +2149,7 @@ static int ins_compl_add(char_u *const str, int len,
os_breakcheck();
#define FREE_CPTEXT(cptext, cptext_allocated) \
do { \
- if (cptext_allocated) { \
+ if (cptext != NULL && cptext_allocated) { \
for (size_t i = 0; i < CPT_COUNT; i++) { \
xfree(cptext[i]); \
} \
@@ -2302,9 +2305,10 @@ static void ins_compl_longest_match(compl_T *match)
c1 = *p;
c2 = *s;
}
- if (match->cp_icase ? (vim_tolower(c1) != vim_tolower(c2))
- : (c1 != c2))
+ if (match->cp_icase ? (mb_tolower(c1) != mb_tolower(c2))
+ : (c1 != c2)) {
break;
+ }
if (has_mbyte) {
mb_ptr_adv(p);
mb_ptr_adv(s);
@@ -3418,6 +3422,7 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
else
return; /* nothing to do */
}
+ assert(ptr != NULL);
if (compl_orig_text != NULL) {
p = compl_orig_text;
for (len = 0; p[len] != NUL && p[len] == ptr[len]; ++len)
@@ -3426,10 +3431,11 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
len -= (*mb_head_off)(p, p + len);
for (p += len; *p != NUL; mb_ptr_adv(p))
AppendCharToRedobuff(K_BS);
- } else
+ } else {
len = 0;
- if (ptr != NULL)
- AppendToRedobuffLit(ptr + len, -1);
+ }
+ assert(ptr != NULL);
+ AppendToRedobuffLit(ptr + len, -1);
}
/*
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 80c2fe10d7..d7feed8bfd 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* eval.c: Expression evaluation.
*/
@@ -462,6 +465,7 @@ typedef struct {
int refcount;
long timeout;
bool stopped;
+ bool paused;
Callback callback;
} timer_T;
@@ -2378,9 +2382,9 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv,
&tv, &di, true, false) == OK) {
if ((di == NULL
|| (!var_check_ro(di->di_flags, (const char *)lp->ll_name,
- STRLEN(lp->ll_name))
+ TV_CSTRING)
&& !tv_check_lock(di->di_tv.v_lock, (const char *)lp->ll_name,
- STRLEN(lp->ll_name))))
+ TV_CSTRING)))
&& eexe_mod_op(&tv, rettv, (const char *)op) == OK) {
set_var(lp->ll_name, lp->ll_name_len, &tv, false);
}
@@ -2393,7 +2397,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv,
} else if (tv_check_lock(lp->ll_newkey == NULL
? lp->ll_tv->v_lock
: lp->ll_tv->vval.v_dict->dv_lock,
- (const char *)lp->ll_name, STRLEN(lp->ll_name))) {
+ (const char *)lp->ll_name, TV_CSTRING)) {
} else if (lp->ll_range) {
listitem_T *ll_li = lp->ll_li;
int ll_n1 = lp->ll_n1;
@@ -2402,7 +2406,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv,
for (listitem_T *ri = rettv->vval.v_list->lv_first;
ri != NULL && ll_li != NULL; ) {
if (tv_check_lock(ll_li->li_tv.v_lock, (const char *)lp->ll_name,
- STRLEN(lp->ll_name))) {
+ TV_CSTRING)) {
return;
}
ri = ri->li_next;
@@ -2741,12 +2745,13 @@ void ex_call(exarg_T *eap)
* call, and the loop is broken.
*/
if (eap->skip) {
- ++emsg_skip;
- lnum = eap->line2; /* do it once, also with an invalid range */
- } else
+ emsg_skip++;
+ lnum = eap->line2; // Do it once, also with an invalid range.
+ } else {
lnum = eap->line1;
- for (; lnum <= eap->line2; ++lnum) {
- if (!eap->skip && eap->addr_count > 0) {
+ }
+ for (; lnum <= eap->line2; lnum++) {
+ if (!eap->skip && eap->addr_count > 0) { // -V560
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
@@ -2767,7 +2772,7 @@ void ex_call(exarg_T *eap)
}
tv_clear(&rettv);
- if (doesrange || eap->skip) {
+ if (doesrange || eap->skip) { // -V560
break;
}
@@ -2992,14 +2997,13 @@ int do_unlet(const char *const name, const size_t name_len, const int forceit)
}
if (hi != NULL && !HASHITEM_EMPTY(hi)) {
dictitem_T *const di = TV_DICT_HI2DI(hi);
- if (var_check_fixed(di->di_flags, (const char *)name, STRLEN(name))
- || var_check_ro(di->di_flags, (const char *)name, STRLEN(name))
- || tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) {
+ if (var_check_fixed(di->di_flags, (const char *)name, TV_CSTRING)
+ || var_check_ro(di->di_flags, (const char *)name, TV_CSTRING)
+ || tv_check_lock(d->dv_lock, (const char *)name, TV_CSTRING)) {
return FAIL;
}
- if (d == NULL
- || tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) {
+ if (tv_check_lock(d->dv_lock, (const char *)name, TV_CSTRING)) {
return FAIL;
}
@@ -4763,7 +4767,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
// Special key, e.g.: "\<C-W>"
case '<':
- extra = trans_special((const char_u **) &p, STRLEN(p), name, true);
+ extra = trans_special((const char_u **)&p, STRLEN(p), name, true, true);
if (extra != 0) {
name += extra;
break;
@@ -6508,7 +6512,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Error err = ERROR_INIT;
Object result = fn(INTERNAL_CALL, args, &err);
- if (err.set) {
+ if (ERROR_SET(&err)) {
nvim_err_writeln(cstr_as_string(err.msg));
goto end;
}
@@ -6520,6 +6524,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
end:
api_free_array(args);
api_free_object(result);
+ api_clear_error(&err);
}
/*
@@ -6553,10 +6558,8 @@ static void f_add(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = 1; /* Default: Failed */
if (argvars[0].v_type == VAR_LIST) {
- const char *const arg_errmsg = _("add() argument");
- const size_t arg_errmsg_len = strlen(arg_errmsg);
if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ && !tv_check_lock(l->lv_lock, "add() argument", TV_TRANSLATE)) {
tv_list_append_tv(l, &argvars[1]);
tv_copy(&argvars[0], rettv);
}
@@ -7305,18 +7308,14 @@ static void f_changenr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
static void f_char2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- if (has_mbyte) {
- int utf8 = 0;
-
- if (argvars[1].v_type != VAR_UNKNOWN) {
- utf8 = tv_get_number_chk(&argvars[1], NULL);
+ if (argvars[1].v_type != VAR_UNKNOWN) {
+ if (!tv_check_num(&argvars[1])) {
+ return;
}
-
- rettv->vval.v_number = (utf8 ? *utf_ptr2char : *mb_ptr2char)(
- (const char_u *)tv_get_string(&argvars[0]));
- } else {
- rettv->vval.v_number = (uint8_t)(tv_get_string(&argvars[0])[0]);
}
+
+ rettv->vval.v_number = utf_ptr2char(
+ (const char_u *)tv_get_string(&argvars[0]));
}
/*
@@ -8152,7 +8151,6 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
const char *const arg_errmsg = N_("extend() argument");
- const size_t arg_errmsg_len = strlen(arg_errmsg);
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST) {
long before;
@@ -8161,13 +8159,13 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
list_T *const l1 = argvars[0].vval.v_list;
list_T *const l2 = argvars[1].vval.v_list;
if (l1 == NULL) {
- const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, arg_errmsg_len);
+ const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, TV_TRANSLATE);
(void)locked;
assert(locked == true);
} else if (l2 == NULL) {
// Do nothing
tv_copy(&argvars[0], rettv);
- } else if (!tv_check_lock(l1->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ } else if (!tv_check_lock(l1->lv_lock, arg_errmsg, TV_TRANSLATE)) {
listitem_T *item;
if (argvars[2].v_type != VAR_UNKNOWN) {
before = tv_get_number_chk(&argvars[2], &error);
@@ -8195,13 +8193,13 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
dict_T *const d1 = argvars[0].vval.v_dict;
dict_T *const d2 = argvars[1].vval.v_dict;
if (d1 == NULL) {
- const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, arg_errmsg_len);
+ const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, TV_TRANSLATE);
(void)locked;
assert(locked == true);
} else if (d2 == NULL) {
// Do nothing
tv_copy(&argvars[0], rettv);
- } else if (!tv_check_lock(d1->dv_lock, arg_errmsg, arg_errmsg_len)) {
+ } else if (!tv_check_lock(d1->dv_lock, arg_errmsg, TV_TRANSLATE)) {
const char *action = "force";
// Check the third argument.
if (argvars[2].v_type != VAR_UNKNOWN) {
@@ -8349,20 +8347,19 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map)
int todo;
char_u *ermsg = (char_u *)(map ? "map()" : "filter()");
const char *const arg_errmsg = (map
- ? _("map() argument")
- : _("filter() argument"));
- const size_t arg_errmsg_len = strlen(arg_errmsg);
+ ? N_("map() argument")
+ : N_("filter() argument"));
int save_did_emsg;
int idx = 0;
if (argvars[0].v_type == VAR_LIST) {
if ((l = argvars[0].vval.v_list) == NULL
- || (!map && tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len))) {
+ || (!map && tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE))) {
return;
}
} else if (argvars[0].v_type == VAR_DICT) {
if ((d = argvars[0].vval.v_dict) == NULL
- || (!map && tv_check_lock(d->dv_lock, arg_errmsg, arg_errmsg_len))) {
+ || (!map && tv_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE))) {
return;
}
} else {
@@ -8395,8 +8392,8 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map)
di = TV_DICT_HI2DI(hi);
if (map
- && (tv_check_lock(di->di_tv.v_lock, arg_errmsg, arg_errmsg_len)
- || var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len))) {
+ && (tv_check_lock(di->di_tv.v_lock, arg_errmsg, TV_TRANSLATE)
+ || var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE))) {
break;
}
@@ -8407,8 +8404,8 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map)
break;
}
if (!map && rem) {
- if (var_check_fixed(di->di_flags, arg_errmsg, arg_errmsg_len)
- || var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len)) {
+ if (var_check_fixed(di->di_flags, arg_errmsg, TV_TRANSLATE)
+ || var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE)) {
break;
}
tv_dict_item_remove(d, di);
@@ -8421,7 +8418,7 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map)
for (li = l->lv_first; li != NULL; li = nli) {
if (map
- && tv_check_lock(li->li_tv.v_lock, arg_errmsg, arg_errmsg_len)) {
+ && tv_check_lock(li->li_tv.v_lock, arg_errmsg, TV_TRANSLATE)) {
break;
}
nli = li->li_next;
@@ -8666,7 +8663,6 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
char_u *r;
int len;
char *txt;
- long count;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
@@ -8694,8 +8690,8 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
s = skipwhite(s + 1);
}
}
- count = (long)(foldend - foldstart + 1);
- txt = _("+-%s%3ld lines: ");
+ unsigned long count = (unsigned long)(foldend - foldstart + 1);
+ txt = ngettext("+-%s%3ld line: ", "+-%s%3ld lines: ", count);
r = xmalloc(STRLEN(txt)
+ STRLEN(dashes) // for %s
+ 20 // for %3ld
@@ -8715,7 +8711,7 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
char_u *text;
- char_u buf[51];
+ char_u buf[FOLD_TEXT_LEN];
foldinfo_T foldinfo;
int fold_count;
@@ -8728,10 +8724,10 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
fold_count = foldedCount(curwin, lnum, &foldinfo);
if (fold_count > 0) {
- text = get_foldtext(curwin, lnum, lnum + fold_count - 1,
- &foldinfo, buf);
- if (text == buf)
+ text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf);
+ if (text == buf) {
text = vim_strsave(text);
+ }
rettv->vval.v_string = text;
}
}
@@ -8981,13 +8977,10 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) {
rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING);
const char *const n = (const char *)partial_name(pt);
- if (n == NULL) {
- rettv->vval.v_string = NULL;
- } else {
- rettv->vval.v_string = (char_u *)xstrdup(n);
- if (rettv->v_type == VAR_FUNC) {
- func_ref(rettv->vval.v_string);
- }
+ assert(n != NULL);
+ rettv->vval.v_string = (char_u *)xstrdup(n);
+ if (rettv->v_type == VAR_FUNC) {
+ func_ref(rettv->vval.v_string);
}
} else if (strcmp(what, "dict") == 0) {
rettv->v_type = VAR_DICT;
@@ -11008,18 +11001,19 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog)
cmdline_row = msg_row;
const char *defstr = "";
+ char buf[NUMBUFLEN];
if (argvars[1].v_type != VAR_UNKNOWN) {
- char buf[NUMBUFLEN];
defstr = tv_get_string_buf_chk(&argvars[1], buf);
if (defstr != NULL) {
stuffReadbuffSpec(defstr);
}
if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN) {
+ char buf2[NUMBUFLEN];
// input() with a third argument: completion
rettv->vval.v_string = NULL;
- const char *const xp_name = tv_get_string_buf_chk(&argvars[2], buf);
+ const char *const xp_name = tv_get_string_buf_chk(&argvars[2], buf2);
if (xp_name == NULL) {
return;
}
@@ -11157,13 +11151,12 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
list_T *l;
bool error = false;
- const char *const arg_errmsg = _("insert() argument");
- const size_t arg_errmsg_len = strlen(arg_errmsg);
if (argvars[0].v_type != VAR_LIST) {
EMSG2(_(e_listarg), "insert()");
} else if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ && !tv_check_lock(l->lv_lock, N_("insert() argument"),
+ TV_TRANSLATE)) {
long before = 0;
if (argvars[2].v_type != VAR_UNKNOWN) {
before = tv_get_number_chk(&argvars[2], &error);
@@ -12544,7 +12537,7 @@ static void f_min(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
static void f_mkdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- int prot = 0755;
+ int prot = 0755; // -V536
rettv->vval.v_number = FAIL;
if (check_restricted() || check_secure())
@@ -12769,25 +12762,32 @@ static void f_nextnonblank(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- char_u buf[NUMBUFLEN];
-
- if (has_mbyte) {
- int utf8 = 0;
-
- if (argvars[1].v_type != VAR_UNKNOWN) {
- utf8 = tv_get_number_chk(&argvars[1], NULL);
- }
- if (utf8) {
- buf[(*utf_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL;
- } else {
- buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL;
+ if (argvars[1].v_type != VAR_UNKNOWN) {
+ if (!tv_check_num(&argvars[1])) {
+ return;
}
- } else {
- buf[0] = (char_u)tv_get_number(&argvars[0]);
- buf[1] = NUL;
}
+
+ bool error = false;
+ const varnumber_T num = tv_get_number_chk(&argvars[0], &error);
+ if (error) {
+ return;
+ }
+ if (num < 0) {
+ emsgf(_("E5070: Character number must not be less than zero"));
+ return;
+ }
+ if (num > INT_MAX) {
+ emsgf(_("E5071: Character number must not be greater than INT_MAX (%i)"),
+ INT_MAX);
+ return;
+ }
+
+ char buf[MB_MAXBYTES];
+ const int len = utf_char2bytes((int)num, (char_u *)buf);
+
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = vim_strsave(buf);
+ rettv->vval.v_string = xmemdupz(buf, (size_t)len);
}
/*
@@ -13204,21 +13204,20 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
long end;
dict_T *d;
dictitem_T *di;
- const char *const arg_errmsg = _("remove() argument");
- const size_t arg_errmsg_len = strlen(arg_errmsg);
+ const char *const arg_errmsg = N_("remove() argument");
if (argvars[0].v_type == VAR_DICT) {
if (argvars[2].v_type != VAR_UNKNOWN) {
EMSG2(_(e_toomanyarg), "remove()");
} else if ((d = argvars[0].vval.v_dict) != NULL
- && !tv_check_lock(d->dv_lock, arg_errmsg, arg_errmsg_len)) {
+ && !tv_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE)) {
const char *key = tv_get_string_chk(&argvars[1]);
if (key != NULL) {
di = tv_dict_find(d, key, -1);
if (di == NULL) {
EMSG2(_(e_dictkey), key);
- } else if (!var_check_fixed(di->di_flags, arg_errmsg, arg_errmsg_len)
- && !var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len)) {
+ } else if (!var_check_fixed(di->di_flags, arg_errmsg, TV_TRANSLATE)
+ && !var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE)) {
*rettv = di->di_tv;
di->di_tv = TV_INITIAL_VALUE;
tv_dict_item_remove(d, di);
@@ -13231,7 +13230,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (argvars[0].v_type != VAR_LIST) {
EMSG2(_(e_listdictarg), "remove()");
} else if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ && !tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE)) {
bool error = false;
idx = tv_get_number_chk(&argvars[1], &error);
@@ -13415,14 +13414,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
q = (char *)path_tail((char_u *)p);
}
if (q > p && !path_is_absolute_path((const char_u *)buf)) {
- // Symlink is relative to directory of argument.
+ // Symlink is relative to directory of argument. Replace the
+ // symlink with the resolved name in the same directory.
const size_t p_len = strlen(p);
const size_t buf_len = strlen(buf);
- cpy = xmalloc(p_len + buf_len + 1);
- memcpy(cpy, p, p_len);
- memcpy(path_tail((char_u *)cpy), buf, buf_len + 1);
- xfree(p);
- p = cpy;
+ p = xrealloc(p, p_len + buf_len + 1);
+ memcpy(path_tail((char_u *)p), buf, buf_len + 1);
} else {
xfree(p);
p = xstrdup(buf);
@@ -13504,14 +13501,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
*/
static void f_reverse(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- const char *const arg_errmsg = _("reverse() argument");
- const size_t arg_errmsg_len = strlen(arg_errmsg);
-
list_T *l;
if (argvars[0].v_type != VAR_LIST) {
EMSG2(_(e_listarg), "reverse()");
} else if ((l = argvars[0].vval.v_list) != NULL
- && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ && !tv_check_lock(l->lv_lock, N_("reverse() argument"),
+ TV_TRANSLATE)) {
listitem_T *li = l->lv_last;
l->lv_first = l->lv_last = NULL;
l->lv_len = 0;
@@ -13789,7 +13784,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
restore_funccal(save_funccalp);
}
- if (err.set) {
+ if (ERROR_SET(&err)) {
nvim_err_writeln(cstr_as_string(err.msg));
goto end;
}
@@ -13800,6 +13795,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
end:
api_free_object(result);
+ api_clear_error(&err);
}
// "rpcstart()" function (DEPRECATED)
@@ -14307,7 +14303,7 @@ static void f_serverstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- if (argvars[0].v_type == VAR_UNKNOWN || argvars[0].v_type != VAR_STRING) {
+ if (argvars[0].v_type != VAR_STRING) {
EMSG(_(e_invarg));
return;
}
@@ -14331,7 +14327,7 @@ static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
buf_T *const buf = get_buf_tv(&argvars[0], false);
typval_T *varp = &argvars[2];
- if (buf != NULL && varname != NULL && varp != NULL) {
+ if (buf != NULL && varname != NULL) {
if (*varname == '&') {
long numval;
bool error = false;
@@ -14875,7 +14871,7 @@ static void f_settabvar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const varname = tv_get_string_chk(&argvars[1]);
typval_T *const varp = &argvars[2];
- if (varname != NULL && varp != NULL && tp != NULL) {
+ if (varname != NULL && tp != NULL) {
tabpage_T *const save_curtab = curtab;
goto_tabpage_tp(tp, false, false);
@@ -15203,16 +15199,14 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
sortinfo = &info;
const char *const arg_errmsg = (sort
- ? _("sort() argument")
- : _("uniq() argument"));
- const size_t arg_errmsg_len = strlen(arg_errmsg);
+ ? N_("sort() argument")
+ : N_("uniq() argument"));
if (argvars[0].v_type != VAR_LIST) {
EMSG2(_(e_listarg), sort ? "sort()" : "uniq()");
} else {
l = argvars[0].vval.v_list;
- if (l == NULL
- || tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) {
+ if (l == NULL || tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE)) {
goto theend;
}
rettv->vval.v_list = l;
@@ -16437,7 +16431,12 @@ static void f_taglist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern);
+ const char *fname = NULL;
+ if (argvars[1].v_type != VAR_UNKNOWN) {
+ fname = tv_get_string(&argvars[1]);
+ }
+ (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern,
+ (char_u *)fname);
}
/*
@@ -16526,11 +16525,13 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
curbuf->b_p_swf = false;
(void)setfname(curbuf, (char_u *)buf, NULL, true);
// Save the job id and pid in b:terminal_job_{id,pid}
- Error err;
+ Error err = ERROR_INIT;
dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_id"),
INTEGER_OBJ(rettv->vval.v_number), false, false, &err);
+ api_clear_error(&err);
dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_pid"),
INTEGER_OBJ(pid), false, false, &err);
+ api_clear_error(&err);
Terminal *term = terminal_open(topts);
data->term = term;
@@ -16647,6 +16648,77 @@ static bool set_ref_in_callback(Callback *callback, int copyID,
return false;
}
+static void add_timer_info(typval_T *rettv, timer_T *timer)
+{
+ list_T *list = rettv->vval.v_list;
+ dict_T *dict = tv_dict_alloc();
+
+ tv_list_append_dict(list, dict);
+ tv_dict_add_nr(dict, S_LEN("id"), timer->timer_id);
+ tv_dict_add_nr(dict, S_LEN("time"), timer->timeout);
+ tv_dict_add_nr(dict, S_LEN("paused"), timer->paused);
+
+ tv_dict_add_nr(dict, S_LEN("repeat"),
+ (timer->repeat_count < 0 ? -1 : timer->repeat_count));
+
+ dictitem_T *di = tv_dict_item_alloc("callback");
+ if (tv_dict_add(dict, di) == FAIL) {
+ xfree(di);
+ return;
+ }
+
+ if (timer->callback.type == kCallbackPartial) {
+ di->di_tv.v_type = VAR_PARTIAL;
+ di->di_tv.vval.v_partial = timer->callback.data.partial;
+ timer->callback.data.partial->pt_refcount++;
+ } else if (timer->callback.type == kCallbackFuncref) {
+ di->di_tv.v_type = VAR_FUNC;
+ di->di_tv.vval.v_string = vim_strsave(timer->callback.data.funcref);
+ }
+ di->di_tv.v_lock = 0;
+}
+
+static void add_timer_info_all(typval_T *rettv)
+{
+ timer_T *timer;
+ map_foreach_value(timers, timer, {
+ if (!timer->stopped) {
+ add_timer_info(rettv, timer);
+ }
+ })
+}
+
+/// "timer_info([timer])" function
+static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
+{
+ tv_list_alloc_ret(rettv);
+ if (argvars[0].v_type != VAR_UNKNOWN) {
+ if (argvars[0].v_type != VAR_NUMBER) {
+ EMSG(_(e_number_exp));
+ return;
+ }
+ timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0]));
+ if (timer != NULL && !timer->stopped) {
+ add_timer_info(rettv, timer);
+ }
+ } else {
+ add_timer_info_all(rettv);
+ }
+}
+
+/// "timer_pause(timer, paused)" function
+static void f_timer_pause(typval_T *argvars, typval_T *unused, FunPtr fptr)
+{
+ if (argvars[0].v_type != VAR_NUMBER) {
+ EMSG(_(e_number_exp));
+ return;
+ }
+ int paused = (bool)tv_get_number(&argvars[1]);
+ timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0]));
+ if (timer != NULL) {
+ timer->paused = paused;
+ }
+}
/// "timer_start(timeout, callback, opts)" function
static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr)
@@ -16681,6 +16753,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr)
timer = xmalloc(sizeof *timer);
timer->refcount = 1;
timer->stopped = false;
+ timer->paused = false;
timer->repeat_count = repeat;
timer->timeout = timeout;
timer->timer_id = last_timer_id++;
@@ -16690,8 +16763,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr)
timer->tw.events = multiqueue_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,
- timeout * (repeat != 1));
+ time_watcher_start(&timer->tw, timer_due_cb, timeout, timeout);
pmap_put(uint64_t)(timers, timer->timer_id, timer);
rettv->vval.v_number = timer->timer_id;
@@ -16715,13 +16787,19 @@ static void f_timer_stop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
timer_stop(timer);
}
+static void f_timer_stopall(typval_T *argvars, typval_T *unused, FunPtr fptr)
+{
+ timer_stop_all();
+}
+
// invoked on the main loop
static void timer_due_cb(TimeWatcher *tw, void *data)
{
timer_T *timer = (timer_T *)data;
- if (timer->stopped) {
+ if (timer->stopped || timer->paused) {
return;
}
+
timer->refcount++;
// if repeat was negative repeat forever
if (timer->repeat_count >= 0 && --timer->repeat_count == 0) {
@@ -16774,7 +16852,7 @@ static void timer_decref(timer_T *timer)
}
}
-void timer_teardown(void)
+static void timer_stop_all(void)
{
timer_T *timer;
map_foreach_value(timers, timer, {
@@ -16782,35 +16860,19 @@ void timer_teardown(void)
})
}
+void timer_teardown(void)
+{
+ timer_stop_all();
+}
+
/*
* "tolower(string)" function
*/
static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- char_u *p = (char_u *)xstrdup(tv_get_string(&argvars[0]));
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = p;
-
- while (*p != NUL) {
- int l;
-
- if (enc_utf8) {
- int c, lc;
-
- c = utf_ptr2char(p);
- lc = utf_tolower(c);
- l = utf_ptr2len(p);
- /* TODO: reallocate string when byte count changes. */
- if (utf_char2len(lc) == l)
- utf_char2bytes(lc, p);
- p += l;
- } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
- p += l; /* skip multi-byte character */
- else {
- *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */
- ++p;
- }
- }
+ rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]),
+ false);
}
/*
@@ -16819,7 +16881,8 @@ static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_toupper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = (char_u *)strup_save(tv_get_string(&argvars[0]));
+ rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]),
+ true);
}
/*
@@ -17288,7 +17351,7 @@ static bool write_list(FileDescriptor *const fp, const list_T *const list,
}
}
}
- if ((error = file_fsync(fp)) != 0) {
+ if ((error = file_flush(fp)) != 0) {
goto write_list_error;
}
return true;
@@ -17420,16 +17483,24 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
bool binary = false;
bool append = false;
+ bool do_fsync = !!p_fs;
if (argvars[2].v_type != VAR_UNKNOWN) {
const char *const flags = tv_get_string_chk(&argvars[2]);
if (flags == NULL) {
return;
}
- if (strchr(flags, 'b')) {
- binary = true;
- }
- if (strchr(flags, 'a')) {
- append = true;
+ for (const char *p = flags; *p; p++) {
+ switch (*p) {
+ case 'b': { binary = true; break; }
+ case 'a': { append = true; break; }
+ case 's': { do_fsync = true; break; }
+ case 'S': { do_fsync = false; break; }
+ default: {
+ // Using %s, p and not %c, *p to preserve multibyte characters
+ emsgf(_("E5060: Unknown flag: %s"), p);
+ return;
+ }
+ }
}
}
@@ -17438,21 +17509,21 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (fname == NULL) {
return;
}
- FileDescriptor *fp;
+ FileDescriptor fp;
int error;
rettv->vval.v_number = -1;
if (*fname == NUL) {
EMSG(_("E482: Can't open file with an empty name"));
- } else if ((fp = file_open_new(&error, fname,
- ((append ? kFileAppend : kFileTruncate)
- | kFileCreate), 0666)) == NULL) {
+ } else if ((error = file_open(&fp, fname,
+ ((append ? kFileAppend : kFileTruncate)
+ | kFileCreate), 0666)) != 0) {
emsgf(_("E482: Can't open file %s for writing: %s"),
fname, os_strerror(error));
} else {
- if (write_list(fp, argvars[0].vval.v_list, binary)) {
+ if (write_list(&fp, argvars[0].vval.v_list, binary)) {
rettv->vval.v_number = 0;
}
- if ((error = file_free(fp)) != 0) {
+ if ((error = file_close(&fp, do_fsync)) != 0) {
emsgf(_("E80: Error when closing file %s: %s"),
fname, os_strerror(error));
}
@@ -18884,24 +18955,43 @@ static void set_var(const char *name, const size_t name_len, typval_T *const tv,
///
/// @param[in] flags di_flags attribute value.
/// @param[in] name Variable name, for use in error message.
-/// @param[in] name_len Variable name length.
+/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate
+/// variable name and compute the length. Use #TV_CSTRING
+/// to compute the length with strlen() without
+/// translating.
+///
+/// Both #TV_… values are used for optimization purposes:
+/// variable name with its length is needed only in case
+/// of error, when no error occurs computing them is
+/// a waste of CPU resources. This especially applies to
+/// gettext.
///
/// @return True if variable is read-only: either always or in sandbox when
/// sandbox is enabled, false otherwise.
-bool var_check_ro(const int flags, const char *const name,
- const size_t name_len)
+bool var_check_ro(const int flags, const char *name,
+ size_t name_len)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
+ const char *error_message = NULL;
if (flags & DI_FLAGS_RO) {
- emsgf(_(e_readonlyvar), (int)name_len, name);
- return true;
+ error_message = N_(e_readonlyvar);
+ } else if ((flags & DI_FLAGS_RO_SBX) && sandbox) {
+ error_message = N_("E794: Cannot set variable in the sandbox: \"%.*s\"");
}
- if ((flags & DI_FLAGS_RO_SBX) && sandbox) {
- emsgf(_("E794: Cannot set variable in the sandbox: \"%.*s\""),
- (int)name_len, name);
- return true;
+
+ if (error_message == NULL) {
+ return false;
}
- return false;
+ if (name_len == TV_TRANSLATE) {
+ name = _(name);
+ name_len = strlen(name);
+ } else if (name_len == TV_CSTRING) {
+ name_len = strlen(name);
+ }
+
+ emsgf(_(error_message), (int)name_len, name);
+
+ return true;
}
/// Check whether variable is fixed (DI_FLAGS_FIX)
@@ -18910,14 +19000,29 @@ bool var_check_ro(const int flags, const char *const name,
///
/// @param[in] flags di_flags attribute value.
/// @param[in] name Variable name, for use in error message.
-/// @param[in] name_len Variable name length.
+/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate
+/// variable name and compute the length. Use #TV_CSTRING
+/// to compute the length with strlen() without
+/// translating.
+///
+/// Both #TV_… values are used for optimization purposes:
+/// variable name with its length is needed only in case
+/// of error, when no error occurs computing them is
+/// a waste of CPU resources. This especially applies to
+/// gettext.
///
/// @return True if variable is fixed, false otherwise.
-static bool var_check_fixed(const int flags, const char *const name,
- const size_t name_len)
+static bool var_check_fixed(const int flags, const char *name,
+ size_t name_len)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
if (flags & DI_FLAGS_FIX) {
+ if (name_len == TV_TRANSLATE) {
+ name = _(name);
+ name_len = strlen(name);
+ } else if (name_len == TV_CSTRING) {
+ name_len = strlen(name);
+ }
emsgf(_("E795: Cannot delete variable %.*s"), (int)name_len, name);
return true;
}
@@ -19388,8 +19493,9 @@ void ex_function(exarg_T *eap)
* interrupt, or an exception.
*/
if (!aborting()) {
- if (!eap->skip && fudi.fd_newkey != NULL)
+ if (fudi.fd_newkey != NULL) {
EMSG2(_(e_dictkey), fudi.fd_newkey);
+ }
xfree(fudi.fd_newkey);
return;
} else
@@ -19724,12 +19830,12 @@ void ex_function(exarg_T *eap)
}
if (fudi.fd_di == NULL) {
if (tv_check_lock(fudi.fd_dict->dv_lock, (const char *)eap->arg,
- STRLEN(eap->arg))) {
+ TV_CSTRING)) {
// Can't add a function to a locked dictionary
goto erret;
}
} else if (tv_check_lock(fudi.fd_di->di_tv.v_lock, (const char *)eap->arg,
- STRLEN(eap->arg))) {
+ TV_CSTRING)) {
// Can't change an existing function if it is locked
goto erret;
}
@@ -20711,13 +20817,7 @@ void func_unref(char_u *name)
abort();
#endif
}
- if (fp != NULL && --fp->uf_refcount <= 0) {
- // Only delete it when it's not being used. Otherwise it's done
- // when "uf_calls" becomes zero.
- if (fp->uf_calls == 0) {
- func_clear_free(fp, false);
- }
- }
+ func_ptr_unref(fp);
}
/// Unreference a Function: decrement the reference count and free it when it
@@ -20979,8 +21079,8 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars,
char *s = tofree;
emsg_off--;
if (s != NULL) {
+ char buf[MSG_BUF_LEN];
if (vim_strsize((char_u *)s) > MSG_BUF_CLEN) {
- char buf[MSG_BUF_LEN];
trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN,
sizeof(buf));
s = buf;
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index e3c5981b32..21b5bbb139 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -300,14 +300,17 @@ return {
tabpagenr={args={0, 1}},
tabpagewinnr={args={1, 2}},
tagfiles={},
- taglist={args=1},
+ taglist={args={1, 2}},
tan={args=1, func="float_op_wrapper", data="&tan"},
tanh={args=1, func="float_op_wrapper", data="&tanh"},
tempname={},
termopen={args={1, 2}},
test_garbagecollect_now={},
+ timer_info={args={0,1}},
+ timer_pause={args=2},
timer_start={args={2,3}},
timer_stop={args=1},
+ timer_stopall={args=0},
tolower={args=1},
toupper={args=1},
tr={args=3},
diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c
index 3cb68e093b..8905317f15 100644
--- a/src/nvim/eval/decode.c
+++ b/src/nvim/eval/decode.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stddef.h>
#include <msgpack.h>
@@ -222,8 +225,6 @@ static inline int json_decoder_pop(ValuesStackItem obj,
/// Parse JSON double-quoted string
///
-/// @param[in] conv Defines conversion necessary to convert UTF-8 string to
-/// &encoding.
/// @param[in] buf Buffer being converted.
/// @param[in] buf_len Length of the buffer.
/// @param[in,out] pp Pointer to the start of the string. Must point to '"'.
@@ -240,8 +241,7 @@ static inline int json_decoder_pop(ValuesStackItem obj,
/// value when decoder is restarted, otherwise unused.
///
/// @return OK in case of success, FAIL in case of error.
-static inline int parse_json_string(vimconv_T *const conv,
- const char *const buf, const size_t buf_len,
+static inline int parse_json_string(const char *const buf, const size_t buf_len,
const char **const pp,
ValuesStack *const stack,
ContainerStack *const container_stack,
@@ -416,20 +416,6 @@ static inline int parse_json_string(vimconv_T *const conv,
}
PUT_FST_IN_PAIR(fst_in_pair, str_end);
#undef PUT_FST_IN_PAIR
- if (conv->vc_type != CONV_NONE) {
- size_t str_len = (size_t) (str_end - str);
- char *const new_str = (char *) string_convert(conv, (char_u *) str,
- &str_len);
- if (new_str == NULL) {
- emsgf(_("E474: Failed to convert string \"%.*s\" from UTF-8"),
- (int) str_len, str);
- xfree(str);
- goto parse_json_string_fail;
- }
- xfree(str);
- str = new_str;
- str_end = new_str + str_len;
- }
if (hasnul) {
typval_T obj;
list_T *const list = tv_list_alloc();
@@ -626,9 +612,6 @@ int json_decode_string(const char *const buf, const size_t buf_len,
EMSG(_("E474: Attempt to decode a blank string"));
return FAIL;
}
- vimconv_T conv = { .vc_type = CONV_NONE };
- convert_setup(&conv, (char_u *) "utf-8", p_enc);
- conv.vc_fail = true;
int ret = OK;
ValuesStack stack = KV_INITIAL_VALUE;
ContainerStack container_stack = KV_INITIAL_VALUE;
@@ -774,7 +757,7 @@ json_decode_string_cycle_start:
break;
}
case '"': {
- if (parse_json_string(&conv, buf, buf_len, &p, &stack, &container_stack,
+ if (parse_json_string(buf, buf_len, &p, &stack, &container_stack,
&next_map_special, &didcomma, &didcolon)
== FAIL) {
// Error message was already given
@@ -973,7 +956,13 @@ int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv)
}
break;
}
- case MSGPACK_OBJECT_FLOAT: {
+#ifdef NVIM_MSGPACK_HAS_FLOAT32
+ case MSGPACK_OBJECT_FLOAT32:
+ case MSGPACK_OBJECT_FLOAT64:
+#else
+ case MSGPACK_OBJECT_FLOAT:
+#endif
+ {
*rettv = (typval_T) {
.v_type = VAR_FLOAT,
.v_lock = VAR_UNLOCKED,
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 26f9aaa27d..742497c1ca 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file encode.c
///
/// File containing functions for encoding and decoding VimL values.
@@ -11,7 +14,7 @@
#include <math.h>
#include "nvim/eval/encode.h"
-#include "nvim/buffer_defs.h" // vimconv_T
+#include "nvim/buffer_defs.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/garray.h"
@@ -29,10 +32,6 @@
#define utf_ptr2char(b) utf_ptr2char((char_u *)b)
#define utf_ptr2len(b) ((size_t)utf_ptr2len((char_u *)b))
#define utf_char2len(b) ((size_t)utf_char2len(b))
-#define string_convert(a, b, c) \
- ((char *)string_convert((vimconv_T *)a, (char_u *)b, c))
-#define convert_setup(vcp, from, to) \
- (convert_setup(vcp, (char_u *)from, (char_u *)to))
const char *const encode_special_var_names[] = {
[kSpecialVarNull] = "null",
@@ -183,9 +182,9 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
}
}
}
- EMSG3(msg, objname, (kv_size(*mpstack) == 0
- ? _("itself")
- : (char *) msg_ga.ga_data));
+ emsgf(msg, _(objname), (kv_size(*mpstack) == 0
+ ? _("itself")
+ : (char *)msg_ga.ga_data));
ga_clear(&msg_ga);
return FAIL;
}
@@ -537,17 +536,6 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
} \
} while (0)
-/// Last used p_enc value
-///
-/// Generic pointer: it is not used as a string, only pointer comparisons are
-/// performed. Must not be freed.
-static const void *last_p_enc = NULL;
-
-/// Conversion setup for converting from last_p_enc to UTF-8
-static vimconv_T p_enc_conv = {
- .vc_type = CONV_NONE,
-};
-
/// Escape sequences used in JSON
static const char escapes[][3] = {
[BS] = "\\b",
@@ -579,33 +567,15 @@ static inline int convert_to_json_string(garray_T *const gap,
} else {
size_t utf_len = len;
char *tofree = NULL;
- if (last_p_enc != (const void *) p_enc) {
- p_enc_conv.vc_type = CONV_NONE;
- convert_setup(&p_enc_conv, p_enc, "utf-8");
- p_enc_conv.vc_fail = true;
- last_p_enc = p_enc;
- }
- if (p_enc_conv.vc_type != CONV_NONE) {
- tofree = string_convert(&p_enc_conv, buf, &utf_len);
- if (tofree == NULL) {
- emsgf(_("E474: Failed to convert string \"%.*s\" to UTF-8"),
- utf_len, utf_buf);
- return FAIL;
- }
- utf_buf = tofree;
- }
size_t str_len = 0;
- // Encode character as \u0000 if
- // 1. It is an ASCII control character (0x0 .. 0x1F, 0x7F).
- // 2. &encoding is not UTF-8 and code point is above 0x7F.
- // 3. &encoding is UTF-8 and code point is not printable according to
- // utf_printable().
- // This is done to make it possible to :echo values when &encoding is not
- // UTF-8.
-#define ENCODE_RAW(p_enc_conv, ch) \
- (ch >= 0x20 && (p_enc_conv.vc_type == CONV_NONE \
- ? utf_printable(ch) \
- : ch < 0x7F))
+ // Encode character as \uNNNN if
+ // 1. It is an ASCII control character (0x0 .. 0x1F; 0x7F not
+ // utf_printable and thus not checked specially).
+ // 2. Code point is not printable according to utf_printable().
+ // This is done to make resulting values displayable on screen also not from
+ // Neovim.
+#define ENCODE_RAW(ch) \
+ (ch >= 0x20 && utf_printable(ch))
for (size_t i = 0; i < utf_len;) {
const int ch = utf_ptr2char(utf_buf + i);
const size_t shift = (ch == 0? 1: utf_ptr2len(utf_buf + i));
@@ -636,7 +606,7 @@ static inline int convert_to_json_string(garray_T *const gap,
utf_len - (i - shift), utf_buf + i - shift);
xfree(tofree);
return FAIL;
- } else if (ENCODE_RAW(p_enc_conv, ch)) {
+ } else if (ENCODE_RAW(ch)) {
str_len += shift;
} else {
str_len += ((sizeof("\\u1234") - 1)
@@ -666,7 +636,7 @@ static inline int convert_to_json_string(garray_T *const gap,
break;
}
default: {
- if (ENCODE_RAW(p_enc_conv, ch)) {
+ if (ENCODE_RAW(ch)) {
ga_concat_len(gap, utf_buf + i, shift);
} else if (ch < SURROGATE_FIRST_CHAR) {
ga_concat_len(gap, ((const char[]) {
@@ -823,7 +793,7 @@ char *encode_tv2string(typval_T *tv, size_t *len)
garray_T ga;
ga_init(&ga, (int)sizeof(char), 80);
const int evs_ret = encode_vim_to_string(&ga, tv,
- "encode_tv2string() argument");
+ N_("encode_tv2string() argument"));
(void)evs_ret;
assert(evs_ret == OK);
did_echo_string_emsg = false;
@@ -851,7 +821,7 @@ char *encode_tv2echo(typval_T *tv, size_t *len)
ga_concat(&ga, tv->vval.v_string);
}
} else {
- const int eve_ret = encode_vim_to_echo(&ga, tv, ":echo argument");
+ const int eve_ret = encode_vim_to_echo(&ga, tv, N_(":echo argument"));
(void)eve_ret;
assert(eve_ret == OK);
}
@@ -874,7 +844,8 @@ char *encode_tv2json(typval_T *tv, size_t *len)
{
garray_T ga;
ga_init(&ga, (int)sizeof(char), 80);
- const int evj_ret = encode_vim_to_json(&ga, tv, "encode_tv2json() argument");
+ const int evj_ret = encode_vim_to_json(&ga, tv,
+ N_("encode_tv2json() argument"));
if (!evj_ret) {
ga_clear(&ga);
}
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c
index ec6c86ac64..91bb61323f 100644
--- a/src/nvim/eval/executor.c
+++ b/src/nvim/eval/executor.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include "nvim/eval/typval.h"
#include "nvim/eval/executor.h"
#include "nvim/eval.h"
diff --git a/src/nvim/eval/gc.c b/src/nvim/eval/gc.c
index 5ce52ddd70..2bbf78d827 100644
--- a/src/nvim/eval/gc.c
+++ b/src/nvim/eval/gc.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include "nvim/eval/typval.h"
#include "nvim/eval/gc.h"
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 779bb18175..786b766689 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdio.h>
#include <stddef.h>
#include <string.h>
@@ -136,7 +139,7 @@ void tv_list_watch_fix(list_T *const l, const listitem_T *const item)
///
/// @return [allocated] new list.
list_T *tv_list_alloc(void)
- FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC
+ FUNC_ATTR_NONNULL_RET
{
list_T *const list = xcalloc(1, sizeof(list_T));
@@ -1011,7 +1014,6 @@ void tv_dict_item_free(dictitem_T *const item)
/// @return [allocated] new dictionary item.
static dictitem_T *tv_dict_item_copy(dictitem_T *const di)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
- FUNC_ATTR_MALLOC
{
dictitem_T *const new_di = tv_dict_item_alloc((const char *)di->di_key);
tv_copy(&di->di_tv, &new_di->di_tv);
@@ -1040,7 +1042,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
///
/// @return [allocated] new dictionary.
dict_T *tv_dict_alloc(void)
- FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
+ FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT
{
dict_T *const d = xmalloc(sizeof(dict_T));
@@ -1577,7 +1579,7 @@ void tv_dict_set_keys_readonly(dict_T *const dict)
///
/// @return [allocated] pointer to the created list.
list_T *tv_list_alloc_ret(typval_T *const ret_tv)
- FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC
+ FUNC_ATTR_NONNULL_ALL
{
list_T *const l = tv_list_alloc();
ret_tv->vval.v_list = l;
@@ -1799,11 +1801,13 @@ static inline void _nothing_conv_dict_end(typval_T *const tv,
#define TYPVAL_ENCODE_NAME nothing
#define TYPVAL_ENCODE_FIRST_ARG_TYPE const void *const
#define TYPVAL_ENCODE_FIRST_ARG_NAME ignored
+#define TYPVAL_ENCODE_TRANSLATE_OBJECT_NAME
#include "nvim/eval/typval_encode.c.h"
#undef TYPVAL_ENCODE_SCOPE
#undef TYPVAL_ENCODE_NAME
#undef TYPVAL_ENCODE_FIRST_ARG_TYPE
#undef TYPVAL_ENCODE_FIRST_ARG_NAME
+#undef TYPVAL_ENCODE_TRANSLATE_OBJECT_NAME
#undef TYPVAL_ENCODE_ALLOW_SPECIALS
#undef TYPVAL_ENCODE_CONV_NIL
@@ -1838,8 +1842,13 @@ static inline void _nothing_conv_dict_end(typval_T *const tv,
void tv_clear(typval_T *const tv)
{
if (tv != NULL && tv->v_type != VAR_UNKNOWN) {
- const int evn_ret = encode_vim_to_nothing(NULL, tv,
- _("tv_clear() argument"));
+ // WARNING: do not translate the string here, gettext is slow and function
+ // is used *very* often. At the current state encode_vim_to_nothing() does
+ // not error out and does not use the argument anywhere.
+ //
+ // If situation changes and this argument will be used, translate it in the
+ // place where it is used.
+ const int evn_ret = encode_vim_to_nothing(NULL, tv, "tv_clear() argument");
(void)evn_ret;
assert(evn_ret == OK);
}
@@ -2042,11 +2051,20 @@ bool tv_islocked(const typval_T *const tv)
///
/// @param[in] lock Lock status.
/// @param[in] name Variable name, used in the error message.
-/// @param[in] name_len Variable name length.
+/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate
+/// variable name and compute the length. Use #TV_CSTRING
+/// to compute the length with strlen() without
+/// translating.
+///
+/// Both #TV_… values are used for optimization purposes:
+/// variable name with its length is needed only in case
+/// of error, when no error occurs computing them is
+/// a waste of CPU resources. This especially applies to
+/// gettext.
///
/// @return true if variable is locked, false otherwise.
-bool tv_check_lock(const VarLockStatus lock, const char *const name,
- const size_t name_len)
+bool tv_check_lock(const VarLockStatus lock, const char *name,
+ size_t name_len)
FUNC_ATTR_WARN_UNUSED_RESULT
{
const char *error_message = NULL;
@@ -2065,10 +2083,17 @@ bool tv_check_lock(const VarLockStatus lock, const char *const name,
}
assert(error_message != NULL);
- const char *const unknown_name = _("Unknown");
+ if (name == NULL) {
+ name = _("Unknown");
+ name_len = strlen(name);
+ } else if (name_len == TV_TRANSLATE) {
+ name = _(name);
+ name_len = strlen(name);
+ } else if (name_len == TV_CSTRING) {
+ name_len = strlen(name);
+ }
- emsgf(_(error_message), (name != NULL ? name_len : strlen(unknown_name)),
- (name != NULL ? name : unknown_name));
+ emsgf(_(error_message), (int)name_len, name);
return true;
}
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h
index 7eab22bc12..0f659727ee 100644
--- a/src/nvim/eval/typval.h
+++ b/src/nvim/eval/typval.h
@@ -17,6 +17,7 @@
#include "nvim/pos.h" // for linenr_T
#include "nvim/gettext.h"
#include "nvim/message.h"
+#include "nvim/macros.h"
/// Type used for VimL VAR_NUMBER values
typedef int varnumber_T;
@@ -423,6 +424,23 @@ static inline bool tv_is_func(const typval_T tv)
return tv.v_type == VAR_FUNC || tv.v_type == VAR_PARTIAL;
}
+/// Specify that argument needs to be translated
+///
+/// Used for size_t length arguments to avoid calling gettext() and strlen()
+/// unless needed.
+#define TV_TRANSLATE (SIZE_MAX)
+
+/// Specify that argument is a NUL-terminated C string
+///
+/// Used for size_t length arguments to avoid calling strlen() unless needed.
+#define TV_CSTRING (SIZE_MAX - 1)
+
+#ifdef UNIT_TESTING
+// Do not use enum constants, see commit message.
+EXTERN const size_t kTVCstring INIT(= TV_CSTRING);
+EXTERN const size_t kTVTranslate INIT(= TV_TRANSLATE);
+#endif
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "eval/typval.h.generated.h"
#endif
diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h
index ad54eef4a0..b4a70fb188 100644
--- a/src/nvim/eval/typval_encode.c.h
+++ b/src/nvim/eval/typval_encode.c.h
@@ -489,7 +489,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
}
if (is_string) {
TYPVAL_ENCODE_CONV_STR_STRING(tv, buf, len);
- } else {
+ } else { // -V523
TYPVAL_ENCODE_CONV_STRING(tv, buf, len);
}
xfree(buf);
@@ -611,7 +611,7 @@ _convert_one_value_regular_dict: {}
typval_encode_stop_converting_one_item:
return OK;
// Prevent “unused label” warnings.
- goto typval_encode_stop_converting_one_item;
+ goto typval_encode_stop_converting_one_item; // -V779
}
TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(
@@ -814,6 +814,6 @@ encode_vim_to__error_ret:
_mp_destroy(mpstack);
return FAIL;
// Prevent “unused label” warnings.
- goto typval_encode_stop_converting_one_item;
+ goto typval_encode_stop_converting_one_item; // -V779
}
#endif // NVIM_EVAL_TYPVAL_ENCODE_C_H
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c
index 3da0c386b4..3116adbde8 100644
--- a/src/nvim/event/libuv_process.c
+++ b/src/nvim/event/libuv_process.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <uv.h>
@@ -8,6 +11,7 @@
#include "nvim/event/process.h"
#include "nvim/event/libuv_process.h"
#include "nvim/log.h"
+#include "nvim/os/os.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/libuv_process.c.generated.h"
@@ -24,6 +28,13 @@ int libuv_process_spawn(LibuvProcess *uvproc)
if (proc->detach) {
uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
}
+#ifdef WIN32
+ // libuv collapses the argv to a CommandLineToArgvW()-style string. cmd.exe
+ // expects a different syntax (must be prepared by the caller before now).
+ if (os_shell_is_cmdexe(proc->argv[0])) {
+ uvproc->uvopts.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS;
+ }
+#endif
uvproc->uvopts.exit_cb = exit_cb;
uvproc->uvopts.cwd = proc->cwd;
uvproc->uvopts.env = NULL;
diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c
index 0e1775d01b..6963978581 100644
--- a/src/nvim/event/loop.c
+++ b/src/nvim/event/loop.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdarg.h>
#include <stdint.h>
diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c
index 79b4dd9458..a17bae31e3 100644
--- a/src/nvim/event/multiqueue.c
+++ b/src/nvim/event/multiqueue.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// Multi-level queue for selective async event processing.
// Not threadsafe; access must be synchronized externally.
//
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c
index 4429a65f92..ffda10a494 100644
--- a/src/nvim/event/process.c
+++ b/src/nvim/event/process.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdlib.h>
diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c
index 2737dad305..854af474b2 100644
--- a/src/nvim/event/rstream.c
+++ b/src/nvim/event/rstream.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c
index 11ce15a882..fec46da4ff 100644
--- a/src/nvim/event/signal.c
+++ b/src/nvim/event/signal.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <uv.h>
#include "nvim/event/loop.h"
diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c
index 8f9327f3d4..e536d79a2a 100644
--- a/src/nvim/event/socket.c
+++ b/src/nvim/event/socket.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index 26083c20f4..860a957b3e 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c
index 77260546db..80289c27d1 100644
--- a/src/nvim/event/time.c
+++ b/src/nvim/event/time.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdint.h>
#include <uv.h>
diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c
index fc7aad8eb9..f453e5898d 100644
--- a/src/nvim/event/wstream.c
+++ b/src/nvim/event/wstream.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 9a847a4c0a..7726e0fc6d 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* ex_cmds.c: some functions for command line commands
*/
@@ -2874,8 +2877,11 @@ void ex_z(exarg_T *eap)
if (end > curbuf->b_ml.ml_line_count)
end = curbuf->b_ml.ml_line_count;
- if (curs > curbuf->b_ml.ml_line_count)
+ if (curs > curbuf->b_ml.ml_line_count) {
curs = curbuf->b_ml.ml_line_count;
+ } else if (curs < 1) {
+ curs = 1;
+ }
for (i = start; i <= end; i++) {
if (minus && i == lnum) {
@@ -2895,8 +2901,11 @@ void ex_z(exarg_T *eap)
}
}
- curwin->w_cursor.lnum = curs;
- ex_no_reprint = TRUE;
+ if (curwin->w_cursor.lnum != curs) {
+ curwin->w_cursor.lnum = curs;
+ curwin->w_cursor.col = 0;
+ }
+ ex_no_reprint = true;
}
/*
diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h
index 65bbd8a99e..b564cde56c 100644
--- a/src/nvim/ex_cmds.h
+++ b/src/nvim/ex_cmds.h
@@ -6,6 +6,8 @@
#include "nvim/os/time.h"
#include "nvim/pos.h"
#include "nvim/eval/typval.h"
+#include "nvim/buffer_defs.h"
+#include "nvim/ex_cmds_defs.h"
// flags for do_ecmd()
#define ECMD_HIDE 0x01 // don't free the current buffer
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index eeace789b2..a1a32d9f52 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file ex_cmds2.c
///
/// Some more functions for command line commands
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 0fd4ae48be..7568d71ac0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* ex_docmd.c: functions for executing an Ex command line.
*/
@@ -1304,7 +1307,6 @@ static char_u * do_one_cmd(char_u **cmdlinep,
/*
* 2. Handle command modifiers.
*/
- p = ea.cmd;
p = skip_range(ea.cmd, NULL);
switch (*p) {
/* When adding an entry, also modify cmd_exists(). */
@@ -1727,11 +1729,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
errormsg = (char_u *)_("E464: Ambiguous use of user-defined command");
goto doend;
}
- /* Check for wrong commands. */
- if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78) {
- errormsg = uc_fun_cmd();
- goto doend;
- }
+ // Check for wrong commands.
if (ea.cmdidx == CMD_SIZE) {
if (!ea.skip) {
STRCPY(IObuff, _("E492: Not an editor command"));
@@ -4100,14 +4098,12 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
xpc.xp_context = EXPAND_FILES;
if (p_wic)
options += WILD_ICASE;
- p = ExpandOne(&xpc, eap->arg, NULL,
- options, WILD_EXPAND_FREE);
- if (p == NULL)
+ p = ExpandOne(&xpc, eap->arg, NULL, options, WILD_EXPAND_FREE);
+ if (p == NULL) {
return FAIL;
- if (p != NULL) {
- (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
- xfree(p);
}
+ (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
+ xfree(p);
}
}
return OK;
@@ -4962,20 +4958,6 @@ static void uc_list(char_u *name, size_t name_len)
MSG(_("No user-defined commands found"));
}
-static char_u *uc_fun_cmd(void)
-{
- static char_u fcmd[] = {0x84, 0xaf, 0x60, 0xb9, 0xaf, 0xb5, 0x60, 0xa4,
- 0xa5, 0xad, 0xa1, 0xae, 0xa4, 0x60, 0xa1, 0x60,
- 0xb3, 0xa8, 0xb2, 0xb5, 0xa2, 0xa2, 0xa5, 0xb2,
- 0xb9, 0x7f, 0};
- int i;
-
- for (i = 0; fcmd[i]; ++i)
- IObuff[i] = fcmd[i] - 0x40;
- IObuff[i] = 0;
- return IObuff;
-}
-
static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def,
int *flags, int * compl, char_u **compl_arg,
int *addr_type_arg)
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 65112c4dd8..5d664b94a8 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// TODO(ZyX-I): move to eval/executor
/// @file ex_eval.c
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8810204c03..eed4bf6066 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* ex_getln.c: Functions for entering and editing an Ex command line.
*/
@@ -30,6 +33,7 @@
#include "nvim/if_cscope.h"
#include "nvim/indent.h"
#include "nvim/main.h"
+#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/menu.h"
@@ -350,6 +354,7 @@ static int command_line_check(VimState *state)
quit_more = false; // reset after CTRL-D which had a more-prompt
cursorcmd(); // set the cursor on the right spot
+ ui_cursor_shape();
return 1;
}
@@ -1231,7 +1236,7 @@ static int command_line_handle_key(CommandLineState *s)
// command line has no uppercase characters, convert
// the character to lowercase
if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff)) {
- s->c = vim_tolower(s->c);
+ s->c = mb_tolower(s->c);
}
if (s->c != NUL) {
@@ -2091,6 +2096,18 @@ redraw:
return (char_u *)line_ga.ga_data;
}
+bool cmdline_overstrike(void)
+{
+ return ccline.overstrike;
+}
+
+
+/// Return true if the cursor is at the end of the cmdline.
+bool cmdline_at_end(void)
+{
+ return (ccline.cmdpos >= ccline.cmdlen);
+}
+
/*
* Allocate a new command line buffer.
* Assigns the new buffer to ccline.cmdbuff and ccline.cmdbufflen.
@@ -2261,6 +2278,7 @@ void putcmdline(int c, int shift)
draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos);
msg_no_more = FALSE;
cursorcmd();
+ ui_cursor_shape();
}
/*
@@ -2280,6 +2298,7 @@ void unputcmdline(void)
draw_cmdline(ccline.cmdpos, 1);
msg_no_more = FALSE;
cursorcmd();
+ ui_cursor_shape();
}
/*
@@ -2597,6 +2616,7 @@ void redrawcmdline(void)
compute_cmdrow();
redrawcmd();
cursorcmd();
+ ui_cursor_shape();
}
static void redrawcmdprompt(void)
@@ -3018,7 +3038,7 @@ ExpandOne (
|| xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)) {
- if (vim_tolower(c0) != vim_tolower(ci)) {
+ if (mb_tolower(c0) != mb_tolower(ci)) {
break;
}
} else if (c0 != ci) {
diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h
index 5a1ca5213a..051564fbe1 100644
--- a/src/nvim/ex_getln.h
+++ b/src/nvim/ex_getln.h
@@ -3,6 +3,9 @@
#include "nvim/eval/typval.h"
#include "nvim/ex_cmds.h"
+#include "nvim/ex_cmds_defs.h"
+#include "nvim/os/time.h"
+#include "nvim/regexp_defs.h"
/* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */
#define WILD_FREE 1
diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c
index e7e93f756f..1053cb3ac2 100644
--- a/src/nvim/farsi.c
+++ b/src/nvim/farsi.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file farsi.c
///
/// Functions for Farsi language
@@ -321,7 +324,7 @@ static void put_curr_and_l_to_X(char_u c)
}
if ((curwin->w_cursor.col < (colnr_T)STRLEN(get_cursor_line_ptr()))) {
- if ((p_ri && curwin->w_cursor.col) || !p_ri) {
+ if (!p_ri || curwin->w_cursor.col) {
if (p_ri) {
dec_cursor();
} else {
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 9592235905..8094a1b266 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// File searching functions for 'path', 'tags' and 'cdpath' options.
//
// External visible functions:
@@ -1057,7 +1060,7 @@ static bool ff_wc_equal(char_u *s1, char_u *s2)
c1 = PTR2CHAR(s1 + i);
c2 = PTR2CHAR(s2 + j);
- if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
+ if ((p_fic ? mb_tolower(c1) != mb_tolower(c2) : c1 != c2)
&& (prev1 != '*' || prev2 != '*')) {
return false;
}
diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h
index 833a1a05ff..b128029123 100644
--- a/src/nvim/file_search.h
+++ b/src/nvim/file_search.h
@@ -1,6 +1,11 @@
#ifndef NVIM_FILE_SEARCH_H
#define NVIM_FILE_SEARCH_H
+#include <stdlib.h> // for size_t
+
+#include "nvim/types.h" // for char_u
+#include "nvim/globals.h" // for CdScope
+
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */
#define FINDFILE_DIR 1 /* only directories */
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index bd632b2755..3e062aecc0 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* fileio.c: read from and write to a file
*/
@@ -200,18 +203,14 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
{
int msg_scroll_save;
- if (msg_silent != 0)
+ if (msg_silent != 0) {
return;
- msg_add_fname(buf, name); /* put file name in IObuff with quotes */
- /* If it's extremely long, truncate it. */
- if (STRLEN(IObuff) > IOSIZE - 80)
- IObuff[IOSIZE - 80] = NUL;
- STRCAT(IObuff, s);
- /*
- * For the first message may have to start a new line.
- * For further ones overwrite the previous one, reset msg_scroll before
- * calling filemess().
- */
+ }
+ add_quoted_fname((char *)IObuff, IOSIZE - 80, buf, (const char *)name);
+ xstrlcat((char *)IObuff, (const char *)s, IOSIZE);
+ // For the first message may have to start a new line.
+ // For further ones overwrite the previous one, reset msg_scroll before
+ // calling filemess().
msg_scroll_save = msg_scroll;
if (shortmess(SHM_OVERALL) && !exiting && p_verbose == 0)
msg_scroll = FALSE;
@@ -734,43 +733,16 @@ readfile (
fenc = (char_u *)""; /* binary: don't convert */
fenc_alloced = FALSE;
} else if (curbuf->b_help) {
- char_u firstline[80];
- int fc;
-
- /* Help files are either utf-8 or latin1. Try utf-8 first, if this
- * fails it must be latin1.
- * Always do this when 'encoding' is "utf-8". Otherwise only do
- * this when needed to avoid [converted] remarks all the time.
- * It is needed when the first line contains non-ASCII characters.
- * That is only in *.??x files. */
- fenc = (char_u *)"latin1";
- c = enc_utf8;
- if (!c && !read_stdin) {
- fc = fname[STRLEN(fname) - 1];
- if (TOLOWER_ASC(fc) == 'x') {
- /* Read the first line (and a bit more). Immediately rewind to
- * the start of the file. If the read() fails "len" is -1. */
- len = read_eintr(fd, firstline, 80);
- lseek(fd, (off_t)0L, SEEK_SET);
- for (p = firstline; p < firstline + len; ++p)
- if (*p >= 0x80) {
- c = TRUE;
- break;
- }
- }
- }
+ // Help files are either utf-8 or latin1. Try utf-8 first, if this
+ // fails it must be latin1.
+ // It is needed when the first line contains non-ASCII characters.
+ // That is only in *.??x files.
+ fenc_next = (char_u *)"latin1";
+ fenc = (char_u *)"utf-8";
- if (c) {
- fenc_next = fenc;
- fenc = (char_u *)"utf-8";
+ fenc_alloced = false;
- /* When the file is utf-8 but a character doesn't fit in
- * 'encoding' don't retry. In help text editing utf-8 bytes
- * doesn't make sense. */
- if (!enc_utf8)
- keep_dest_enc = TRUE;
- }
- fenc_alloced = FALSE;
+ c = 1;
} else if (*p_fencs == NUL) {
fenc = curbuf->b_p_fenc; /* use format from buffer */
fenc_alloced = FALSE;
@@ -1800,8 +1772,8 @@ failed:
}
if (!filtering && !(flags & READ_DUMMY)) {
- msg_add_fname(curbuf, sfname); /* fname in IObuff with quotes */
- c = FALSE;
+ add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname);
+ c = false;
#ifdef UNIX
# ifdef S_ISFIFO
@@ -2258,9 +2230,16 @@ buf_write (
int len;
linenr_T lnum;
long nchars;
- char_u *errmsg = NULL;
- int errmsg_allocated = FALSE;
- char_u *errnum = NULL;
+#define SET_ERRMSG_NUM(num, msg) \
+ errnum = num, errmsg = msg, errmsgarg = 0
+#define SET_ERRMSG_ARG(msg, error) \
+ errnum = NULL, errmsg = msg, errmsgarg = error
+#define SET_ERRMSG(msg) \
+ errnum = NULL, errmsg = msg, errmsgarg = 0
+ const char *errnum = NULL;
+ char *errmsg = NULL;
+ int errmsgarg = 0;
+ bool errmsg_allocated = false;
char_u *buffer;
char_u smallbuf[SMBUFSIZE];
char_u *backup_ext;
@@ -2282,7 +2261,6 @@ buf_write (
/* writing everything */
int whole = (start == 1 && end == buf->b_ml.ml_line_count);
linenr_T old_line_count = buf->b_ml.ml_line_count;
- int attr;
int fileformat;
int write_bin;
struct bw_info write_info; /* info for buf_write_bytes() */
@@ -2577,13 +2555,11 @@ buf_write (
perm = file_info_old.stat.st_mode;
if (!S_ISREG(file_info_old.stat.st_mode)) { /* not a file */
if (S_ISDIR(file_info_old.stat.st_mode)) {
- errnum = (char_u *)"E502: ";
- errmsg = (char_u *)_("is a directory");
+ SET_ERRMSG_NUM("E502", _("is a directory"));
goto fail;
}
if (os_nodetype((char *)fname) != NODE_WRITABLE) {
- errnum = (char_u *)"E503: ";
- errmsg = (char_u *)_("is not a file or writable device");
+ SET_ERRMSG_NUM("E503", _("is not a file or writable device"));
goto fail;
}
/* It's a device of some kind (or a fifo) which we can write to
@@ -2599,8 +2575,7 @@ buf_write (
*/
c = os_nodetype((char *)fname);
if (c == NODE_OTHER) {
- errnum = (char_u *)"E503: ";
- errmsg = (char_u *)_("is not a file or writable device");
+ SET_ERRMSG_NUM("E503", _("is not a file or writable device"));
goto fail;
}
if (c == NODE_WRITABLE) {
@@ -2612,8 +2587,7 @@ buf_write (
if (perm < 0) {
newfile = true;
} else if (os_isdir(fname)) {
- errnum = (char_u *)"E502: ";
- errmsg = (char_u *)_("is a directory");
+ SET_ERRMSG_NUM("E502", _("is a directory"));
goto fail;
}
if (overwriting) {
@@ -2632,11 +2606,9 @@ buf_write (
if (!forceit && file_readonly) {
if (vim_strchr(p_cpo, CPO_FWRITE) != NULL) {
- errnum = (char_u *)"E504: ";
- errmsg = (char_u *)_(err_readonly);
+ SET_ERRMSG_NUM("E504", _(err_readonly));
} else {
- errnum = (char_u *)"E505: ";
- errmsg = (char_u *)_("is read-only (add ! to override)");
+ SET_ERRMSG_NUM("E505", _("is read-only (add ! to override)"));
}
goto fail;
}
@@ -2904,23 +2876,27 @@ buf_write (
while ((write_info.bw_len = read_eintr(fd, copybuf,
BUFSIZE)) > 0) {
if (buf_write_bytes(&write_info) == FAIL) {
- errmsg = (char_u *)_(
- "E506: Can't write to backup file (add ! to override)");
+ SET_ERRMSG(_(
+ "E506: Can't write to backup file (add ! to override)"));
break;
}
os_breakcheck();
if (got_int) {
- errmsg = (char_u *)_(e_interr);
+ SET_ERRMSG(_(e_interr));
break;
}
}
- if (close(bfd) < 0 && errmsg == NULL)
- errmsg = (char_u *)_(
- "E507: Close error for backup file (add ! to override)");
- if (write_info.bw_len < 0)
- errmsg = (char_u *)_(
- "E508: Can't read file for backup (add ! to override)");
+ int error;
+ if ((error = os_close(bfd)) != 0 && errmsg == NULL) {
+ SET_ERRMSG_ARG(_("E507: Close error for backup file "
+ "(add ! to override): %s"),
+ error);
+ }
+ if (write_info.bw_len < 0) {
+ SET_ERRMSG(_(
+ "E508: Can't read file for backup (add ! to override)"));
+ }
#ifdef UNIX
set_file_time(backup,
file_info_old.stat.st_atim.tv_sec,
@@ -2937,18 +2913,19 @@ buf_write (
}
}
nobackup:
- close(fd); /* ignore errors for closing read file */
+ os_close(fd); // Ignore errors for closing read file.
xfree(copybuf);
- if (backup == NULL && errmsg == NULL)
- errmsg = (char_u *)_(
- "E509: Cannot create backup file (add ! to override)");
- /* ignore errors when forceit is TRUE */
+ if (backup == NULL && errmsg == NULL) {
+ SET_ERRMSG(_(
+ "E509: Cannot create backup file (add ! to override)"));
+ }
+ // Ignore errors when forceit is TRUE.
if ((some_error || errmsg != NULL) && !forceit) {
retval = FAIL;
goto fail;
}
- errmsg = NULL;
+ SET_ERRMSG(NULL);
} else {
char_u *dirp;
char_u *p;
@@ -2963,8 +2940,7 @@ nobackup:
* anyway, thus we need an extra check here.
*/
if (file_readonly && vim_strchr(p_cpo, CPO_FWRITE) != NULL) {
- errnum = (char_u *)"E504: ";
- errmsg = (char_u *)_(err_readonly);
+ SET_ERRMSG_NUM("E504", _(err_readonly));
goto fail;
}
@@ -3028,7 +3004,7 @@ nobackup:
}
}
if (backup == NULL && !forceit) {
- errmsg = (char_u *)_("E510: Can't make backup file (add ! to override)");
+ SET_ERRMSG(_("E510: Can't make backup file (add ! to override)"));
goto fail;
}
}
@@ -3069,7 +3045,7 @@ nobackup:
&& !(exiting && backup != NULL)) {
ml_preserve(buf, FALSE);
if (got_int) {
- errmsg = (char_u *)_(e_interr);
+ SET_ERRMSG(_(e_interr));
goto restore_backup;
}
}
@@ -3140,8 +3116,8 @@ nobackup:
*/
if (*p_ccv != NUL) {
wfname = vim_tempname();
- if (wfname == NULL) { /* Can't write without a tempfile! */
- errmsg = (char_u *)_("E214: Can't find temp file for writing");
+ if (wfname == NULL) { // Can't write without a tempfile!
+ SET_ERRMSG(_("E214: Can't find temp file for writing"));
goto restore_backup;
}
}
@@ -3153,8 +3129,8 @@ nobackup:
&& wfname == fname
) {
if (!forceit) {
- errmsg = (char_u *)_(
- "E213: Cannot convert (add ! to write without conversion)");
+ SET_ERRMSG(_(
+ "E213: Cannot convert (add ! to write without conversion)"));
goto restore_backup;
}
notconverted = TRUE;
@@ -3189,11 +3165,10 @@ nobackup:
if ((!newfile && os_fileinfo_hardlinks(&file_info) > 1)
|| (os_fileinfo_link((char *)fname, &file_info)
&& !os_fileinfo_id_equal(&file_info, &file_info_old))) {
- errmsg = (char_u *)_("E166: Can't open linked file for writing");
- } else
+ SET_ERRMSG(_("E166: Can't open linked file for writing"));
+ } else {
#endif
- {
- errmsg = (char_u *)_("E212: Can't open file for writing");
+ SET_ERRMSG_ARG(_("E212: Can't open file for writing: %s"), fd);
if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL
&& perm >= 0) {
#ifdef UNIX
@@ -3211,7 +3186,9 @@ nobackup:
os_remove((char *)wfname);
continue;
}
+#ifdef UNIX
}
+#endif
}
restore_backup:
@@ -3253,7 +3230,7 @@ restore_backup:
xfree(wfname);
goto fail;
}
- errmsg = NULL;
+ SET_ERRMSG(NULL);
write_info.bw_fd = fd;
@@ -3373,7 +3350,6 @@ restore_backup:
nchars += len;
}
-#if defined(UNIX)
// On many journalling file systems there is a bug that causes both the
// original and the backup file to be lost when halting the system right
// after writing the file. That's because only the meta-data is
@@ -3382,11 +3358,11 @@ restore_backup:
// For a device do try the fsync() but don't complain if it does not work
// (could be a pipe).
// If the 'fsync' option is FALSE, don't fsync(). Useful for laptops.
- if (p_fs && os_fsync(fd) != 0 && !device) {
- errmsg = (char_u *)_("E667: Fsync failed");
+ int error;
+ if (p_fs && (error = os_fsync(fd)) != 0 && !device) {
+ SET_ERRMSG_ARG(_("E667: Fsync failed: %s"), error);
end = 0;
}
-#endif
#ifdef HAVE_SELINUX
/* Probably need to set the security context. */
@@ -3416,8 +3392,8 @@ restore_backup:
}
#endif
- if (close(fd) != 0) {
- errmsg = (char_u *)_("E512: Close failed");
+ if ((error = os_close(fd)) != 0) {
+ SET_ERRMSG_ARG(_("E512: Close failed: %s"), error);
end = 0;
}
@@ -3454,21 +3430,24 @@ restore_backup:
if (end == 0) {
if (errmsg == NULL) {
if (write_info.bw_conv_error) {
- if (write_info.bw_conv_error_lnum == 0)
- errmsg = (char_u *)_(
- "E513: write error, conversion failed (make 'fenc' empty to override)");
- else {
- errmsg_allocated = TRUE;
- errmsg = xmalloc(300);
- vim_snprintf((char *)errmsg, 300,
- _("E513: write error, conversion failed in line %" PRId64
+ if (write_info.bw_conv_error_lnum == 0) {
+ SET_ERRMSG(_(
+ "E513: write error, conversion failed "
+ "(make 'fenc' empty to override)"));
+ } else {
+ errmsg_allocated = true;
+ SET_ERRMSG(xmalloc(300));
+ vim_snprintf(
+ errmsg, 300,
+ _("E513: write error, conversion failed in line %" PRIdLINENR
" (make 'fenc' empty to override)"),
- (int64_t)write_info.bw_conv_error_lnum);
+ write_info.bw_conv_error_lnum);
}
- } else if (got_int)
- errmsg = (char_u *)_(e_interr);
- else
- errmsg = (char_u *)_("E514: write error (file system full?)");
+ } else if (got_int) {
+ SET_ERRMSG(_(e_interr));
+ } else {
+ SET_ERRMSG(_("E514: write error (file system full?)"));
+ }
}
/*
@@ -3523,8 +3502,8 @@ restore_backup:
fname = sfname; /* use shortname now, for the messages */
#endif
if (!filtering) {
- msg_add_fname(buf, fname); /* put fname in IObuff with quotes */
- c = FALSE;
+ add_quoted_fname((char *)IObuff, IOSIZE, buf, (const char *)fname);
+ c = false;
if (write_info.bw_conv_error) {
STRCAT(IObuff, _(" CONVERSION ERROR"));
c = TRUE;
@@ -3673,33 +3652,32 @@ nofail:
#endif
if (errmsg != NULL) {
- int numlen = errnum != NULL ? (int)STRLEN(errnum) : 0;
-
- attr = hl_attr(HLF_E); /* set highlight for error messages */
- msg_add_fname(buf,
+ // - 100 to save some space for further error message
#ifndef UNIX
- sfname
+ add_quoted_fname((char *)IObuff, IOSIZE - 100, buf, (const char *)sfname);
#else
- fname
+ add_quoted_fname((char *)IObuff, IOSIZE - 100, buf, (const char *)fname);
#endif
- ); /* put file name in IObuff with quotes */
- if (STRLEN(IObuff) + STRLEN(errmsg) + numlen >= IOSIZE)
- IObuff[IOSIZE - STRLEN(errmsg) - numlen - 1] = NUL;
- /* If the error message has the form "is ...", put the error number in
- * front of the file name. */
if (errnum != NULL) {
- STRMOVE(IObuff + numlen, IObuff);
- memmove(IObuff, errnum, (size_t)numlen);
+ if (errmsgarg != 0) {
+ emsgf("%s: %s%s: %s", errnum, IObuff, errmsg, os_strerror(errmsgarg));
+ } else {
+ emsgf("%s: %s%s", errnum, IObuff, errmsg);
+ }
+ } else if (errmsgarg != 0) {
+ emsgf(errmsg, os_strerror(errmsgarg));
+ } else {
+ emsgf(errmsg);
}
- STRCAT(IObuff, errmsg);
- emsg(IObuff);
- if (errmsg_allocated)
+ if (errmsg_allocated) {
xfree(errmsg);
+ }
retval = FAIL;
if (end == 0) {
+ const int attr = hl_attr(HLF_E); // Set highlight for error messages.
MSG_PUTS_ATTR(_("\nWARNING: Original file may be lost or damaged\n"),
- attr | MSG_HIST);
+ attr | MSG_HIST);
MSG_PUTS_ATTR(_(
"don't quit the editor until the file is successfully written!"),
attr | MSG_HIST);
@@ -3759,6 +3737,9 @@ nofail:
got_int |= prev_got_int;
return retval;
+#undef SET_ERRMSG
+#undef SET_ERRMSG_ARG
+#undef SET_ERRMSG_NUM
}
/*
@@ -3802,16 +3783,25 @@ static int set_rw_fname(char_u *fname, char_u *sfname)
return OK;
}
-/*
- * Put file name into IObuff with quotes.
- */
-void msg_add_fname(buf_T *buf, char_u *fname)
+/// Put file name into the specified buffer with quotes
+///
+/// Replaces home directory at the start with `~`.
+///
+/// @param[out] ret_buf Buffer to save results to.
+/// @param[in] buf_len ret_buf length.
+/// @param[in] buf buf_T file name is coming from.
+/// @param[in] fname File name to write.
+static void add_quoted_fname(char *const ret_buf, const size_t buf_len,
+ const buf_T *const buf, const char *fname)
+ FUNC_ATTR_NONNULL_ARG(1)
{
- if (fname == NULL)
- fname = (char_u *)"-stdin-";
- home_replace(buf, fname, IObuff + 1, IOSIZE - 4, TRUE);
- IObuff[0] = '"';
- STRCAT(IObuff, "\" ");
+ if (fname == NULL) {
+ fname = "-stdin-";
+ }
+ ret_buf[0] = '"';
+ home_replace(buf, (const char_u *)fname, (char_u *)ret_buf + 1,
+ (int)buf_len - 4, true);
+ xstrlcat(ret_buf, "\" ", buf_len);
}
/// Append message for text mode to IObuff.
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 36a5b0efd7..9c44e89eed 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// vim: set fdm=marker fdl=1 fdc=3
/*
@@ -1689,12 +1692,10 @@ static void foldDelMarker(linenr_T lnum, char_u *marker, size_t markerlen)
}
}
-/* get_foldtext() {{{2 */
-/*
- * Return the text for a closed fold at line "lnum", with last line "lnume".
- * When 'foldtext' isn't set puts the result in "buf[51]". Otherwise the
- * result is in allocated memory.
- */
+// get_foldtext() {{{2
+/// Return the text for a closed fold at line "lnum", with last line "lnume".
+/// When 'foldtext' isn't set puts the result in "buf[FOLD_TEXT_LEN]".
+/// Otherwise the result is in allocated memory.
char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
foldinfo_T *foldinfo, char_u *buf)
FUNC_ATTR_NONNULL_ARG(1)
@@ -1781,8 +1782,12 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
}
}
if (text == NULL) {
- sprintf((char *)buf, _("+--%3ld lines folded "),
- (long)(lnume - lnum + 1));
+ unsigned long count = (unsigned long)(lnume - lnum + 1);
+
+ vim_snprintf((char *)buf, FOLD_TEXT_LEN,
+ ngettext("+--%3ld line folded",
+ "+--%3ld lines folded ", count),
+ count);
text = buf;
}
return text;
@@ -2232,32 +2237,51 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level,
* before where we started looking, extend it. If it
* starts at another line, update nested folds to keep
* their position, compensating for the new fd_top. */
- if (fp->fd_top >= startlnum && fp->fd_top != firstlnum) {
- if (fp->fd_top > firstlnum)
- /* like lines are inserted */
+ if (fp->fd_top == firstlnum) {
+ // We have found a fold beginning exactly where we want one.
+ } else if (fp->fd_top >= startlnum) {
+ if (fp->fd_top > firstlnum) {
+ // We will move the start of this fold up, hence we move all
+ // nested folds (with relative line numbers) down.
foldMarkAdjustRecurse(&fp->fd_nested,
- (linenr_T)0, (linenr_T)MAXLNUM,
- (long)(fp->fd_top - firstlnum), 0L);
- else
- /* like lines are deleted */
+ (linenr_T)0, (linenr_T)MAXLNUM,
+ (long)(fp->fd_top - firstlnum), 0L);
+ } else {
+ // Will move fold down, move nested folds relatively up.
foldMarkAdjustRecurse(&fp->fd_nested,
- (linenr_T)0,
- (long)(firstlnum - fp->fd_top - 1),
- (linenr_T)MAXLNUM,
- (long)(fp->fd_top - firstlnum));
+ (linenr_T)0,
+ (long)(firstlnum - fp->fd_top - 1),
+ (linenr_T)MAXLNUM,
+ (long)(fp->fd_top - firstlnum));
+ }
fp->fd_len += fp->fd_top - firstlnum;
fp->fd_top = firstlnum;
- fold_changed = TRUE;
- } else if (flp->start != 0 && lvl == level
- && fp->fd_top != firstlnum) {
- /* Existing fold that includes startlnum must stop
- * if we find the start of a new fold at the same
- * level. Split it. Delete contained folds at
- * this point to split them too. */
- foldRemove(&fp->fd_nested, flp->lnum - fp->fd_top,
- flp->lnum - fp->fd_top);
+ fold_changed = true;
+ } else if ((flp->start != 0 && lvl == level)
+ || (firstlnum != startlnum)) {
+ // Before there was a fold spanning from above startlnum to below
+ // firstlnum. This fold is valid above startlnum (because we are
+ // not updating that range), but there is now a break in it.
+ // If the break is because we are now forced to start a new fold
+ // at the level "level" at line fline->lnum, then we need to
+ // split the fold at fline->lnum.
+ // If the break is because the range [startlnum, firstlnum) is
+ // now at a lower indent than "level", we need to split the fold
+ // in this range.
+ // Any splits have to be done recursively.
+ linenr_T breakstart;
+ linenr_T breakend;
+ if (firstlnum != startlnum) {
+ breakstart = startlnum;
+ breakend = firstlnum;
+ } else {
+ breakstart = flp->lnum;
+ breakend = flp->lnum;
+ }
+ foldRemove(&fp->fd_nested, breakstart - fp->fd_top,
+ breakend - fp->fd_top);
i = (int)(fp - (fold_T *)gap->ga_data);
- foldSplit(gap, i, flp->lnum, flp->lnum - 1);
+ foldSplit(gap, i, breakstart, breakend - 1);
fp = (fold_T *)gap->ga_data + i + 1;
/* If using the "marker" or "syntax" method, we
* need to continue until the end of the fold is
@@ -2267,6 +2291,16 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level,
|| getlevel == foldlevelSyntax)
finish = TRUE;
}
+ if (fp->fd_top == startlnum && concat) {
+ i = (int)(fp - (fold_T *)gap->ga_data);
+ if (i != 0) {
+ fp2 = fp - 1;
+ if (fp2->fd_top + fp2->fd_len == fp->fd_top) {
+ foldMerge(fp2, gap, fp);
+ fp = fp2;
+ }
+ }
+ }
break;
}
if (fp->fd_top >= startlnum) {
@@ -2736,10 +2770,13 @@ void foldMoveRange(garray_T *gap, const linenr_T line1, const linenr_T line2,
}
dest_index = FOLD_INDEX(fp, gap);
- // All folds are now correct, but they are not necessarily in the correct
- // order.
- // We have to swap folds in the range [move_end, dest_index) with those in
- // the range [move_start, move_end).
+ // All folds are now correct, but not necessarily in the correct order.
+ // We must swap folds in the range [move_end, dest_index) with those in the
+ // range [move_start, move_end).
+ if (move_end == 0) {
+ // There are no folds after those moved, so none were moved out of order.
+ return;
+ }
reverse_fold_order(gap, move_start, dest_index - 1);
reverse_fold_order(gap, move_start, move_start + dest_index - move_end - 1);
reverse_fold_order(gap, move_start + dest_index - move_end, dest_index - 1);
diff --git a/src/nvim/fold.h b/src/nvim/fold.h
index 2ff10c0e91..f35b328fb1 100644
--- a/src/nvim/fold.h
+++ b/src/nvim/fold.h
@@ -1,7 +1,12 @@
#ifndef NVIM_FOLD_H
#define NVIM_FOLD_H
+#include <stdio.h>
+
#include "nvim/pos.h"
+#include "nvim/garray.h"
+#include "nvim/types.h"
+#include "nvim/buffer_defs.h"
/*
* Info used to pass info about a fold from the fold-detection code to the
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index 9ed3b901ef..2d2af54c95 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file garray.c
///
/// Functions for handling growing arrays.
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 7143819e21..9d32df5a68 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* getchar.c
*
@@ -302,13 +305,13 @@ static void add_num_buff(buffheader_T *buf, long n)
*/
static void add_char_buff(buffheader_T *buf, int c)
{
- char bytes[MB_MAXBYTES + 1];
+ uint8_t bytes[MB_MAXBYTES + 1];
int len;
if (IS_SPECIAL(c)) {
len = 1;
} else {
- len = (*mb_char2bytes)(c, (char_u *)bytes);
+ len = mb_char2bytes(c, bytes);
}
for (int i = 0; i < len; i++) {
@@ -1849,11 +1852,12 @@ static int vgetorpeek(int advance)
mp_match = mp;
mp_match_len = keylen;
}
- } else
- /* No match; may have to check for
- * termcode at next character. */
- if (max_mlen < mlen)
- max_mlen = mlen;
+ } else {
+ // No match; may have to check for termcode at next character.
+ if (max_mlen < mlen) {
+ max_mlen = mlen;
+ }
+ }
}
}
@@ -1903,7 +1907,7 @@ static int vgetorpeek(int advance)
}
if ((mp == NULL || max_mlen >= mp_match_len)
- && keylen != KEYLEN_PART_MAP) {
+ && keylen != KEYLEN_PART_MAP && keylen != KEYLEN_PART_KEY) {
// No matching mapping found or found a non-matching mapping that
// matches at least what the matching mapping matched
keylen = 0;
diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h
index bdf65909b6..28584e0534 100644
--- a/src/nvim/getchar.h
+++ b/src/nvim/getchar.h
@@ -1,6 +1,10 @@
#ifndef NVIM_GETCHAR_H
#define NVIM_GETCHAR_H
+#include "nvim/types.h"
+#include "nvim/buffer_defs.h"
+#include "nvim/ex_cmds_defs.h"
+
/* Values for "noremap" argument of ins_typebuf(). Also used for
* map->m_noremap and menu->noremap[]. */
#define REMAP_YES 0 /* allow remapping */
@@ -12,6 +16,7 @@
#define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */
#define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "getchar.h.generated.h"
#endif
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index c15287aa38..df9f418951 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -464,6 +464,7 @@ typedef enum {
, HLF_CUL // 'cursurline'
, HLF_MC // 'colorcolumn'
, HLF_QFL // selected quickfix line
+ , HLF_0 // Whitespace
, HLF_COUNT // MUST be the last one
} hlf_T;
@@ -472,7 +473,7 @@ typedef enum {
#define HL_FLAGS { '8', '~', 'z', 'Z', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', \
'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', \
'A', 'C', 'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', \
- 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q' }
+ 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '0' }
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
EXTERN int highlight_user[9]; /* User[1-9] attributes */
@@ -547,6 +548,7 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */
FOR_ALL_TABS(tp) \
FOR_ALL_WINDOWS_IN_TAB(wp, tp)
+// -V:FOR_ALL_WINDOWS_IN_TAB:501
# define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \
for (win_T *wp = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next)
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 4cb05ffc12..abc4773d84 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* hardcopy.c: printing to paper
*/
@@ -2576,13 +2579,12 @@ int mch_print_begin(prt_settings_T *psettings)
prt_conv.vc_type = CONV_NONE;
if (!(enc_canon_props(p_enc) & enc_canon_props(p_encoding) & ENC_8BIT)) {
- /* Set up encoding conversion if required */
- if (FAIL == convert_setup(&prt_conv, p_enc, p_encoding)) {
- EMSG2(_("E620: Unable to convert to print encoding \"%s\""),
- p_encoding);
- return FALSE;
+ // Set up encoding conversion if required
+ if (convert_setup(&prt_conv, p_enc, p_encoding) == FAIL) {
+ emsgf(_("E620: Unable to convert to print encoding \"%s\""),
+ p_encoding);
+ return false;
}
- prt_do_conv = TRUE;
}
prt_do_conv = prt_conv.vc_type != CONV_NONE;
diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h
index 4ead8dd5d4..a70b20e6f5 100644
--- a/src/nvim/hardcopy.h
+++ b/src/nvim/hardcopy.h
@@ -2,6 +2,10 @@
#define NVIM_HARDCOPY_H
#include <stdint.h>
+#include <stdlib.h> // for size_t
+
+#include "nvim/types.h" // for char_u
+#include "nvim/ex_cmds_defs.h" // for exarg_T
/*
* Structure to hold printing color and font attributes.
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index 354c9718ba..3397788b00 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file hashtab.c
///
/// Handling of a hashtable with Vim-specific properties.
diff --git a/src/nvim/iconv.h b/src/nvim/iconv.h
index bf29b15247..d7234090c4 100644
--- a/src/nvim/iconv.h
+++ b/src/nvim/iconv.h
@@ -10,9 +10,7 @@
// USE_ICONV, or to put the USE_ICONV definition in config.h.in directly. As
// it stands, globals.h needs to be included alongside iconv.h.
-#ifdef HAVE_CONFIG_H
-# include "auto/config.h"
-#endif
+#include "auto/config.h"
// Use iconv() when it's available, either by linking to the library at
// compile time or by loading it at runtime.
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index b647b8146a..e1c7df9175 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
* Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
diff --git a/src/nvim/if_cscope.h b/src/nvim/if_cscope.h
index 351d9caef6..e20462576a 100644
--- a/src/nvim/if_cscope.h
+++ b/src/nvim/if_cscope.h
@@ -1,6 +1,9 @@
#ifndef NVIM_IF_CSCOPE_H
#define NVIM_IF_CSCOPE_H
+#include "nvim/types.h" // for char_u and expand_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "if_cscope.h.generated.h"
#endif
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 7f31bb8c5c..5471b41b2c 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -7,6 +10,7 @@
#include "nvim/eval.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
+#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/misc1.h"
@@ -598,7 +602,7 @@ int get_lisp_indent(void)
paren = *pos;
pos = findmatch(NULL, '[');
- if ((pos == NULL) || ltp(pos, &paren)) {
+ if ((pos == NULL) || lt(*pos, paren)) {
pos = &paren;
}
}
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 4a73fbaf61..4806f46705 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdint.h>
@@ -10,6 +13,7 @@
#include "nvim/edit.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
+#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/option.h"
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 72b0d0aa40..9c5fe78c7c 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
@@ -490,17 +493,19 @@ char_u *get_special_key_name(int c, int modifiers)
/// @param[out] dst Location where translation result will be kept. Must have
/// at least six bytes.
/// @param[in] keycode Prefer key code, e.g. K_DEL in place of DEL.
+/// @param[in] in_string Inside a double quoted string
///
/// @return Number of characters added to dst, zero for no match.
unsigned int trans_special(const char_u **srcp, const size_t src_len,
- char_u *const dst, const bool keycode)
+ char_u *const dst, const bool keycode,
+ const bool in_string)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
int modifiers = 0;
int key;
unsigned int dlen = 0;
- key = find_special_key(srcp, src_len, &modifiers, keycode, false);
+ key = find_special_key(srcp, src_len, &modifiers, keycode, false, in_string);
if (key == 0) {
return 0;
}
@@ -536,10 +541,12 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len,
/// @param[out] modp Location where information about modifiers is saved.
/// @param[in] keycode Prefer key code, e.g. K_DEL in place of DEL.
/// @param[in] keep_x_key Don’t translate xHome to Home key.
+/// @param[in] in_string In string, double quote is escaped
///
/// @return Key and modifiers or 0 if there is no match.
int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
- const bool keycode, const bool keep_x_key)
+ const bool keycode, const bool keep_x_key,
+ const bool in_string)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
const char_u *last_dash;
@@ -573,10 +580,14 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
} else {
l = 1;
}
- if (end - bp > l && bp[l] != '"' && bp[l + 1] == '>') {
- // Anything accepted, like <C-?>, except <C-">, because the "
- // ends the string.
+ // Anything accepted, like <C-?>.
+ // <C-"> or <M-"> are not special in strings as " is
+ // the string delimiter. With a backslash it works: <M-\">
+ if (end - bp > l && !(in_string && bp[1] == '"') && bp[2] == '>') {
bp += l;
+ } else if (end - bp > 2 && in_string && bp[1] == '\\'
+ && bp[2] == '"' && bp[3] == '>') {
+ bp += 2;
}
}
}
@@ -612,18 +623,17 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0);
key = (int)n;
} else {
- /*
- * Modifier with single letter, or special key name.
- */
- if (has_mbyte) {
- l = mb_ptr2len(last_dash + 1);
- } else {
- l = 1;
+ int off = 1;
+
+ // Modifier with single letter, or special key name.
+ if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') {
+ off = 2;
}
+ l = mb_ptr2len(last_dash + 1);
if (modifiers != 0 && last_dash[l + 1] == '>') {
- key = PTR2CHAR(last_dash + 1);
+ key = PTR2CHAR(last_dash + off);
} else {
- key = get_special_key_code(last_dash + 1);
+ key = get_special_key_code(last_dash + off);
if (!keep_x_key) {
key = handle_x_keys(key);
}
@@ -828,7 +838,8 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len,
}
}
- slen = trans_special(&src, (size_t) (end - src) + 1, result + dlen, true);
+ slen = trans_special(&src, (size_t)(end - src) + 1, result + dlen, true,
+ true);
if (slen) {
dlen += slen;
continue;
diff --git a/src/nvim/log.c b/src/nvim/log.c
index bbb4dfb944..d059e28d5d 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdarg.h>
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 5042663041..214af82422 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -29,25 +29,6 @@
#define S_LEN(s) (s), (sizeof(s) - 1)
/*
- * Position comparisons
- */
-# define lt(a, b) (((a).lnum != (b).lnum) \
- ? (a).lnum < (b).lnum \
- : (a).col != (b).col \
- ? (a).col < (b).col \
- : (a).coladd < (b).coladd)
-# define ltp(a, b) (((a)->lnum != (b)->lnum) \
- ? (a)->lnum < (b)->lnum \
- : (a)->col != (b)->col \
- ? (a)->col < (b)->col \
- : (a)->coladd < (b)->coladd)
-# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && \
- ((a).coladd == (b).coladd))
-# define clearpos(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0; }
-
-#define ltoreq(a, b) (lt(a, b) || equalpos(a, b))
-
-/*
* lineempty() - return TRUE if the line is empty
*/
#define lineempty(p) (*ml_get(p) == NUL)
@@ -62,7 +43,7 @@
* toupper() and tolower() that use the current locale.
* Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the
* range 0 - 255. toupper()/tolower() on some systems can't handle others.
- * Note: It is often better to use vim_tolower() and vim_toupper(), because many
+ * Note: It is often better to use mb_tolower() and mb_toupper(), because many
* toupper() and tolower() implementations only work for ASCII.
*/
#define TOUPPER_LOC toupper
@@ -94,7 +75,7 @@
do { \
if (*p_langmap \
&& (condition) \
- && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \
+ && (p_lrm || KeyTyped) \
&& !KeyStuffed \
&& (c) >= 0) \
{ \
@@ -120,8 +101,10 @@
/* mch_open_rw(): invoke os_open() with third argument for user R/W. */
#if defined(UNIX) /* open in rw------- mode */
# define mch_open_rw(n, f) os_open((n), (f), (mode_t)0600)
+#elif defined(WIN32)
+# define mch_open_rw(n, f) os_open((n), (f), S_IREAD | S_IWRITE)
#else
-# define mch_open_rw(n, f) os_open((n), (f), 0)
+# define mch_open_rw(n, f) os_open((n), (f), 0)
#endif
# define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 33e1551351..1095d4d3b5 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#define EXTERN
#include <assert.h>
#include <stdint.h>
@@ -283,7 +286,7 @@ int main(int argc, char **argv)
cmdline_row = (int)(Rows - p_ch);
msg_row = cmdline_row;
screenalloc(false); /* allocate screen buffers */
- set_init_2();
+ set_init_2(params.headless);
TIME_MSG("inits 2");
msg_scroll = TRUE;
diff --git a/src/nvim/map.c b/src/nvim/map.c
index 73af487f90..366b286d14 100644
--- a/src/nvim/map.c
+++ b/src/nvim/map.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
@@ -139,7 +142,6 @@ static inline bool String_eq(String a, String b)
MAP_IMPL(int, int, DEFAULT_INITIALIZER)
-MAP_IMPL(cstr_t, uint64_t, DEFAULT_INITIALIZER)
MAP_IMPL(cstr_t, ptr_t, DEFAULT_INITIALIZER)
MAP_IMPL(ptr_t, ptr_t, DEFAULT_INITIALIZER)
MAP_IMPL(uint64_t, ptr_t, DEFAULT_INITIALIZER)
diff --git a/src/nvim/map.h b/src/nvim/map.h
index ba3e84cb31..a4fccf47f9 100644
--- a/src/nvim/map.h
+++ b/src/nvim/map.h
@@ -25,7 +25,6 @@
void map_##T##_##U##_clear(Map(T, U) *map);
MAP_DECLS(int, int)
-MAP_DECLS(cstr_t, uint64_t)
MAP_DECLS(cstr_t, ptr_t)
MAP_DECLS(ptr_t, ptr_t)
MAP_DECLS(uint64_t, ptr_t)
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index ae94ec7ecd..675fe4d57f 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* mark.c: functions for setting marks and jumping to them
*/
diff --git a/src/nvim/mark.h b/src/nvim/mark.h
index efba9708db..a356c1f398 100644
--- a/src/nvim/mark.h
+++ b/src/nvim/mark.h
@@ -4,10 +4,12 @@
#include "nvim/macros.h"
#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
+#include "nvim/func_attr.h"
#include "nvim/mark_defs.h"
#include "nvim/memory.h"
#include "nvim/pos.h"
#include "nvim/os/time.h"
+#include "nvim/ex_cmds_defs.h" // for exarg_T
/// Set fmark using given value
#define SET_FMARK(fmarkp_, mark_, fnum_) \
@@ -74,6 +76,45 @@ static inline int mark_local_index(const char name)
: -1))));
}
+static inline bool lt(pos_T, pos_T) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE;
+static inline bool equalpos(pos_T, pos_T)
+ REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE;
+static inline bool ltoreq(pos_T, pos_T)
+ REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE;
+static inline void clearpos(pos_T *) REAL_FATTR_ALWAYS_INLINE;
+
+/// Return true if position a is before (less than) position b.
+static inline bool lt(pos_T a, pos_T b)
+{
+ if (a.lnum != b.lnum) {
+ return a.lnum < b.lnum;
+ } else if (a.col != b.col) {
+ return a.col < b.col;
+ } else {
+ return a.coladd < b.coladd;
+ }
+}
+
+/// Return true if position a and b are equal.
+static inline bool equalpos(pos_T a, pos_T b)
+{
+ return (a.lnum == b.lnum) && (a.col == b.col) && (a.coladd == b.coladd);
+}
+
+/// Return true if position a is less than or equal to b.
+static inline bool ltoreq(pos_T a, pos_T b)
+{
+ return lt(a, b) || equalpos(a, b);
+}
+
+/// Clear the pos_T structure pointed to by a.
+static inline void clearpos(pos_T *a)
+{
+ a->lnum = 0;
+ a->col = 0;
+ a->coladd = 0;
+}
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark.h.generated.h"
#endif
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index d96848754c..b21ec944c1 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// mbyte.c: Code specifically for handling multi-byte characters.
/// Multibyte extensions partly by Sung-Hoon Baek
///
@@ -1174,11 +1177,14 @@ int utf_fold(int a)
return utf_convert(a, foldCase, ARRAY_SIZE(foldCase));
}
-/*
- * Return the upper-case equivalent of "a", which is a UCS-4 character. Use
- * simple case folding.
- */
-int utf_toupper(int a)
+// Vim's own character class functions. These exist because many library
+// islower()/toupper() etc. do not work properly: they crash when used with
+// invalid values or can't handle latin1 when the locale is C.
+// Speed is most important here.
+
+/// Return the upper-case equivalent of "a", which is a UCS-4 character. Use
+/// simple case folding.
+int mb_toupper(int a)
{
/* If 'casemap' contains "keepascii" use ASCII style toupper(). */
if (a < 128 && (cmp_flags & CMP_KEEPASCII))
@@ -1198,17 +1204,15 @@ int utf_toupper(int a)
return utf_convert(a, toUpper, ARRAY_SIZE(toUpper));
}
-bool utf_islower(int a)
+bool mb_islower(int a)
{
- /* German sharp s is lower case but has no upper case equivalent. */
- return (utf_toupper(a) != a) || a == 0xdf;
+ // German sharp s is lower case but has no upper case equivalent.
+ return (mb_toupper(a) != a) || a == 0xdf;
}
-/*
- * Return the lower-case equivalent of "a", which is a UCS-4 character. Use
- * simple case folding.
- */
-int utf_tolower(int a)
+/// Return the lower-case equivalent of "a", which is a UCS-4 character. Use
+/// simple case folding.
+int mb_tolower(int a)
{
/* If 'casemap' contains "keepascii" use ASCII style tolower(). */
if (a < 128 && (cmp_flags & CMP_KEEPASCII))
@@ -1228,9 +1232,9 @@ int utf_tolower(int a)
return utf_convert(a, toLower, ARRAY_SIZE(toLower));
}
-bool utf_isupper(int a)
+bool mb_isupper(int a)
{
- return utf_tolower(a) != a;
+ return mb_tolower(a) != a;
}
static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1,
@@ -1304,6 +1308,7 @@ static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1,
# define CP_UTF8 65001 /* magic number from winnls.h */
#endif
+/// Reassigns `strw` to a new, allocated pointer to a UTF16 string.
int utf8_to_utf16(const char *str, WCHAR **strw)
FUNC_ATTR_NONNULL_ALL
{
@@ -1345,40 +1350,40 @@ int utf8_to_utf16(const char *str, WCHAR **strw)
return 0;
}
+/// Reassigns `str` to a new, allocated pointer to a UTF8 string.
int utf16_to_utf8(const WCHAR *strw, char **str)
FUNC_ATTR_NONNULL_ALL
{
// Compute the space required to store the string as UTF-8.
- ssize_t utf8_len = WideCharToMultiByte(CP_UTF8,
- 0,
- strw,
- -1,
- NULL,
- 0,
- NULL,
- NULL);
+ DWORD utf8_len = WideCharToMultiByte(CP_UTF8,
+ 0,
+ strw,
+ -1,
+ NULL,
+ 0,
+ NULL,
+ NULL);
if (utf8_len == 0) {
return GetLastError();
}
- ssize_t buf_sz = utf8_len * sizeof(char);
- char *buf = xmalloc(buf_sz);
- char *pos = buf;
+ *str = xmalloc(utf8_len);
- // Convert string to UTF-8.
- int r = WideCharToMultiByte(CP_UTF8,
- 0,
- strw,
- -1,
- pos,
- utf8_len,
- NULL,
- NULL);
- assert(r == utf8_len);
- if (r != utf8_len) {
- EMSG2("WideCharToMultiByte failed: %d", r);
- }
- *str = pos;
+ // Convert to UTF-8.
+ utf8_len = WideCharToMultiByte(CP_UTF8,
+ 0,
+ strw,
+ -1,
+ *str,
+ utf8_len,
+ NULL,
+ NULL);
+ if (utf8_len == 0) {
+ free(*str);
+ *str = NULL;
+ return GetLastError();
+ }
+ (*str)[utf8_len] = '\0';
return 0;
}
diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h
index 3565202466..ad9e38004c 100644
--- a/src/nvim/mbyte.h
+++ b/src/nvim/mbyte.h
@@ -7,6 +7,7 @@
#include "nvim/iconv.h"
#include "nvim/func_attr.h"
#include "nvim/os/os_defs.h" // For WCHAR, indirect
+#include "nvim/types.h" // for char_u
/*
* Return byte length of character that starts with byte "b".
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 5d6639c4d0..efaf1f94c5 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// An abstraction to handle blocks of memory which can be stored in a file.
/// This is the implementation of a sort of virtual memory.
///
diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h
index cc71e1a7ff..b3c2f3564c 100644
--- a/src/nvim/memfile_defs.h
+++ b/src/nvim/memfile_defs.h
@@ -3,8 +3,10 @@
#include <stdint.h>
#include <stdbool.h>
+#include <stdlib.h>
#include "nvim/types.h"
+#include "nvim/pos.h"
/// A block number.
///
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 5ea2397db3..40a6761225 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/* for debugging */
/* #define CHECK(c, s) if (c) EMSG(s) */
#define CHECK(c, s)
@@ -616,7 +619,7 @@ static bool ml_check_b0_strings(ZERO_BL *b0p)
return (memchr(b0p->b0_version, NUL, 10)
&& memchr(b0p->b0_uname, NUL, B0_UNAME_SIZE)
&& memchr(b0p->b0_hname, NUL, B0_HNAME_SIZE)
- && memchr(b0p->b0_fname, NUL, B0_FNAME_SIZE_CRYPT));
+ && memchr(b0p->b0_fname, NUL, B0_FNAME_SIZE_CRYPT)); // -V512
}
/*
@@ -3362,29 +3365,32 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname,
}
if (swap_exists_action != SEA_NONE && choice == 0) {
- char *name;
+ const char *const sw_msg_1 = _("Swap file \"");
+ const char *const sw_msg_2 = _("\" already exists!");
const size_t fname_len = strlen(fname);
- name = xmalloc(fname_len
- + strlen(_("Swap file \""))
- + strlen(_("\" already exists!")) + 5);
- STRCPY(name, _("Swap file \""));
- home_replace(NULL, (char_u *) fname, (char_u *)&name[strlen(name)],
- fname_len, true);
- STRCAT(name, _("\" already exists!"));
- choice = do_dialog(VIM_WARNING,
- (char_u *)_("VIM - ATTENTION"),
- (char_u *)(name == NULL
- ? _("Swap file already exists!")
- : name),
+ const size_t sw_msg_1_len = strlen(sw_msg_1);
+ const size_t sw_msg_2_len = strlen(sw_msg_2);
+
+ const size_t name_len = sw_msg_1_len + fname_len + sw_msg_2_len + 5;
+
+ char *const name = xmalloc(name_len);
+ memcpy(name, sw_msg_1, sw_msg_1_len + 1);
+ home_replace(NULL, (char_u *)fname, (char_u *)&name[sw_msg_1_len],
+ fname_len, true);
+ xstrlcat(name, sw_msg_2, name_len);
+ choice = do_dialog(VIM_WARNING, (char_u *)_("VIM - ATTENTION"),
+ (char_u *)name,
# if defined(UNIX)
- process_still_running
- ? (char_u *)_(
- "&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort") :
+ process_still_running
+ ? (char_u *)_(
+ "&Open Read-Only\n&Edit anyway\n&Recover"
+ "\n&Quit\n&Abort") :
# endif
- (char_u *)_(
- "&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"),
- 1, NULL, FALSE);
+ (char_u *)_(
+ "&Open Read-Only\n&Edit anyway\n&Recover"
+ "\n&Delete it\n&Quit\n&Abort"),
+ 1, NULL, false);
# if defined(UNIX)
if (process_still_running && choice >= 4)
diff --git a/src/nvim/memline.h b/src/nvim/memline.h
index f84e86fea0..a239c6a031 100644
--- a/src/nvim/memline.h
+++ b/src/nvim/memline.h
@@ -2,6 +2,8 @@
#define NVIM_MEMLINE_H
#include "nvim/types.h"
+#include "nvim/pos.h" // for pos_T, linenr_T, colnr_T
+#include "nvim/buffer_defs.h" // for buf_T
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "memline.h.generated.h"
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index b4fdd86a6d..0ee4776581 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// Various routines dealing with allocation and deallocation of memory.
#include <assert.h>
@@ -495,6 +498,13 @@ bool strequal(const char *a, const char *b)
return (a == NULL && b == NULL) || (a && b && strcmp(a, b) == 0);
}
+/// Case-insensitive `strequal`.
+bool striequal(const char *a, const char *b)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0);
+}
+
/*
* Avoid repeating the error message many times (they take 1 second each).
* Did_outofmem_msg is reset when a character is read.
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 529978e3f0..4e621b49c1 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* Code for menus. Used for the GUI and 'wildmenu'.
* GUI/Motif support by Robert Webb
diff --git a/src/nvim/menu.h b/src/nvim/menu.h
index 3266c511b4..a84b7d812e 100644
--- a/src/nvim/menu.h
+++ b/src/nvim/menu.h
@@ -1,6 +1,11 @@
#ifndef NVIM_MENU_H
#define NVIM_MENU_H
+#include <stdbool.h> // for bool
+
+#include "nvim/types.h" // for char_u and expand_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
+
/* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */
#define MENU_INDEX_INVALID -1
#define MENU_INDEX_NORMAL 0
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 83f2735b50..146937c25a 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* message.c: functions for displaying messages on the command line
*/
@@ -573,16 +576,17 @@ void emsg_invreg(int name)
/// Print an error message with unknown number of arguments
bool emsgf(const char *const fmt, ...)
{
+ static char errbuf[IOSIZE];
if (emsg_not_now()) {
return true;
}
va_list ap;
va_start(ap, fmt);
- vim_vsnprintf((char *) IObuff, IOSIZE, fmt, ap, NULL);
+ vim_vsnprintf(errbuf, sizeof(errbuf), fmt, ap, NULL);
va_end(ap);
- return emsg(IObuff);
+ return emsg((const char_u *)errbuf);
}
static void msg_emsgf_event(void **argv)
@@ -1164,15 +1168,9 @@ int msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
* Normal characters are printed several at a time.
*/
while (--len >= 0) {
- if (enc_utf8) {
- // Don't include composing chars after the end.
- mb_l = utfc_ptr2len_len((char_u *)str, len + 1);
- } else if (has_mbyte) {
- mb_l = (*mb_ptr2len)((char_u *)str);
- } else {
- mb_l = 1;
- }
- if (has_mbyte && mb_l > 1) {
+ // Don't include composing chars after the end.
+ mb_l = utfc_ptr2len_len((char_u *)str, len + 1);
+ if (mb_l > 1) {
c = (*mb_ptr2char)((char_u *)str);
if (vim_isprintc(c)) {
// Printable multi-byte char: count the cells.
@@ -1662,16 +1660,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
// Display char in last column before showing more-prompt.
if (*s >= ' ' && !cmdmsg_rl) {
- if (has_mbyte) {
- if (enc_utf8 && maxlen >= 0)
- /* avoid including composing chars after the end */
- l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
- else
- l = (*mb_ptr2len)(s);
- s = screen_puts_mbyte((char_u *)s, l, attr);
+ if (maxlen >= 0) {
+ // Avoid including composing chars after the end.
+ l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
} else {
- msg_screen_putchar(*s++, attr);
+ l = utfc_ptr2len(s);
}
+ s = screen_puts_mbyte((char_u *)s, l, attr);
did_last_char = true;
} else {
did_last_char = false;
@@ -2729,8 +2724,8 @@ do_dialog (
break;
}
- /* Make the character lowercase, as chars in "hotkeys" are. */
- c = vim_tolower(c);
+ // Make the character lowercase, as chars in "hotkeys" are.
+ c = mb_tolower(c);
retval = 1;
for (i = 0; hotkeys[i]; ++i) {
if (has_mbyte) {
@@ -2776,7 +2771,7 @@ copy_char (
if (has_mbyte) {
if (lowercase) {
- c = vim_tolower((*mb_ptr2char)(from));
+ c = mb_tolower((*mb_ptr2char)(from));
return (*mb_char2bytes)(c, to);
} else {
len = (*mb_ptr2len)(from);
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 0b74b4437e..6de74fddf2 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* misc1.c: functions that didn't seem to fit elsewhere
*/
@@ -2678,7 +2681,8 @@ void fast_breakcheck(void)
}
}
-// Call shell. Calls os_call_shell, with 'shellxquote' added.
+// os_call_shell wrapper. Handles 'verbose', :profile, and v:shell_error.
+// Invalidates cached tags.
int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
{
int retval;
@@ -2686,8 +2690,7 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
if (p_verbose > 3) {
verbose_enter();
- smsg(_("Calling shell to execute: \"%s\""),
- cmd == NULL ? p_sh : cmd);
+ smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd);
ui_putc('\n');
verbose_leave();
}
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index 2ebe199f47..b1c146d406 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include "nvim/mouse.h"
@@ -456,6 +459,7 @@ void setmouse(void)
{
int checkfor;
+ ui_cursor_shape();
/* be quick when mouse is off */
if (*p_mouse == NUL)
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 4feabf624b..d5be4cb8c3 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* move.c: Functions for moving the cursor and scrolling text.
*
diff --git a/src/nvim/move.h b/src/nvim/move.h
index 3f3bf70929..00fbcc580f 100644
--- a/src/nvim/move.h
+++ b/src/nvim/move.h
@@ -2,6 +2,8 @@
#define NVIM_MOVE_H
#include <stdbool.h>
+#include "nvim/buffer_defs.h"
+#include "nvim/pos.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "move.h.generated.h"
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 259dcc523c..59594357de 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
@@ -189,7 +192,7 @@ Object channel_send_call(uint64_t id,
Channel *channel = NULL;
if (!(channel = pmap_get(uint64_t)(channels, id)) || channel->closed) {
- api_set_error(err, Exception, _("Invalid channel \"%" PRIu64 "\""), id);
+ api_set_error(err, kErrorTypeException, "Invalid channel: %" PRIu64, id);
api_free_array(args);
return NIL;
}
@@ -209,7 +212,8 @@ Object channel_send_call(uint64_t id,
if (frame.errored) {
if (frame.result.type == kObjectTypeString) {
- api_set_error(err, Exception, "%s", frame.result.data.string.data);
+ api_set_error(err, kErrorTypeException, "%s",
+ frame.result.data.string.data);
} else if (frame.result.type == kObjectTypeArray) {
// Should be an error in the form [type, message]
Array array = frame.result.data.array;
@@ -217,14 +221,13 @@ Object channel_send_call(uint64_t id,
&& (array.items[0].data.integer == kErrorTypeException
|| array.items[0].data.integer == kErrorTypeValidation)
&& array.items[1].type == kObjectTypeString) {
- err->type = (ErrorType) array.items[0].data.integer;
- xstrlcpy(err->msg, array.items[1].data.string.data, sizeof(err->msg));
- err->set = true;
+ api_set_error(err, (ErrorType)array.items[0].data.integer, "%s",
+ array.items[1].data.string.data);
} else {
- api_set_error(err, Exception, "%s", "unknown error");
+ api_set_error(err, kErrorTypeException, "%s", "unknown error");
}
} else {
- api_set_error(err, Exception, "%s", "unknown error");
+ api_set_error(err, kErrorTypeException, "%s", "unknown error");
}
api_free_object(frame.result);
@@ -395,7 +398,7 @@ static void handle_request(Channel *channel, msgpack_object *request)
Error error = ERROR_INIT;
msgpack_rpc_validate(&request_id, request, &error);
- if (error.set) {
+ if (ERROR_SET(&error)) {
// Validation failed, send response with error
if (channel_write(channel,
serialize_response(channel->id,
@@ -409,9 +412,9 @@ static void handle_request(Channel *channel, msgpack_object *request)
channel->id);
call_set_error(channel, buf);
}
+ api_clear_error(&error);
return;
}
-
// Retrieve the request handler
MsgpackRpcRequestHandler handler;
msgpack_object *method = msgpack_rpc_method(request);
@@ -467,6 +470,7 @@ static void on_request_event(void **argv)
api_free_array(args);
decref(channel);
xfree(e);
+ api_clear_error(&error);
}
static bool channel_write(Channel *channel, WBuffer *buffer)
@@ -509,12 +513,13 @@ static bool channel_write(Channel *channel, WBuffer *buffer)
static void send_error(Channel *channel, uint64_t id, char *err)
{
Error e = ERROR_INIT;
- api_set_error(&e, Exception, "%s", err);
+ api_set_error(&e, kErrorTypeException, "%s", err);
channel_write(channel, serialize_response(channel->id,
id,
&e,
NIL,
&out_buffer));
+ api_clear_error(&e);
}
static void send_request(Channel *channel,
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index 808bb863fd..0228582d37 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
@@ -114,7 +117,13 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
}
break;
}
- case MSGPACK_OBJECT_FLOAT: {
+#ifdef NVIM_MSGPACK_HAS_FLOAT32
+ case MSGPACK_OBJECT_FLOAT32:
+ case MSGPACK_OBJECT_FLOAT64:
+#else
+ case MSGPACK_OBJECT_FLOAT:
+#endif
+ {
STATIC_ASSERT(sizeof(Float) == sizeof(cur.mobj->via.f64),
"Msgpack floating-point size does not match API integer");
*cur.aobj = FLOATING_OBJ(cur.mobj->via.f64);
@@ -181,7 +190,12 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg)
case MSGPACK_OBJECT_BOOLEAN:
case MSGPACK_OBJECT_POSITIVE_INTEGER:
case MSGPACK_OBJECT_NEGATIVE_INTEGER:
+#ifdef NVIM_MSGPACK_HAS_FLOAT32
+ case MSGPACK_OBJECT_FLOAT32:
+ case MSGPACK_OBJECT_FLOAT64:
+#else
case MSGPACK_OBJECT_FLOAT:
+#endif
case MSGPACK_OBJECT_EXT:
case MSGPACK_OBJECT_MAP:
case MSGPACK_OBJECT_ARRAY: {
@@ -461,8 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id,
Array args,
Error *error)
{
- snprintf(error->msg, sizeof(error->msg), "Invalid method name");
- error->set = true;
+ api_set_error(error, kErrorTypeException, "Invalid method name");
return NIL;
}
@@ -471,8 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id,
Array args,
Error *error)
{
- snprintf(error->msg, sizeof(error->msg), "Invalid method arguments");
- error->set = true;
+ api_set_error(error, kErrorTypeException, "Invalid method arguments");
return NIL;
}
@@ -505,7 +517,7 @@ void msgpack_rpc_serialize_response(uint64_t response_id,
msgpack_pack_int(pac, 1);
msgpack_pack_uint64(pac, response_id);
- if (err->set) {
+ if (ERROR_SET(err)) {
// error represented by a [type, message] array
msgpack_pack_array(pac, 2);
msgpack_rpc_from_integer(err->type, pac);
@@ -558,49 +570,49 @@ void msgpack_rpc_validate(uint64_t *response_id,
*response_id = NO_RESPONSE;
// Validate the basic structure of the msgpack-rpc payload
if (req->type != MSGPACK_OBJECT_ARRAY) {
- api_set_error(err, Validation, _("Message is not an array"));
+ api_set_error(err, kErrorTypeValidation, "Message is not an array");
return;
}
if (req->via.array.size == 0) {
- api_set_error(err, Validation, _("Message is empty"));
+ api_set_error(err, kErrorTypeValidation, "Message is empty");
return;
}
if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) {
- api_set_error(err, Validation, _("Message type must be an integer"));
+ api_set_error(err, kErrorTypeValidation, "Message type must be an integer");
return;
}
uint64_t type = req->via.array.ptr[0].via.u64;
if (type != kMessageTypeRequest && type != kMessageTypeNotification) {
- api_set_error(err, Validation, _("Unknown message type"));
+ api_set_error(err, kErrorTypeValidation, "Unknown message type");
return;
}
if ((type == kMessageTypeRequest && req->via.array.size != 4)
|| (type == kMessageTypeNotification && req->via.array.size != 3)) {
- api_set_error(err, Validation, _("Request array size should be 4 (request) "
- "or 3 (notification)"));
+ api_set_error(err, kErrorTypeValidation,
+ "Request array size must be 4 (request) or 3 (notification)");
return;
}
if (type == kMessageTypeRequest) {
msgpack_object *id_obj = msgpack_rpc_msg_id(req);
if (!id_obj) {
- api_set_error(err, Validation, _("ID must be a positive integer"));
+ api_set_error(err, kErrorTypeValidation, "ID must be a positive integer");
return;
}
*response_id = id_obj->via.u64;
}
if (!msgpack_rpc_method(req)) {
- api_set_error(err, Validation, _("Method must be a string"));
+ api_set_error(err, kErrorTypeValidation, "Method must be a string");
return;
}
if (!msgpack_rpc_args(req)) {
- api_set_error(err, Validation, _("Parameters must be an array"));
+ api_set_error(err, kErrorTypeValidation, "Parameters must be an array");
return;
}
}
diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c
index d7c2926a0f..b6958088ca 100644
--- a/src/nvim/msgpack_rpc/server.c
+++ b/src/nvim/msgpack_rpc/server.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index d4919dc3b6..51da9429b6 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* normal.c: Contains the main routine for processing characters in command
* mode. Communicates closely with the code in ops.c to handle
@@ -694,7 +697,6 @@ static void normal_get_additional_char(NormalState *s)
if (langmap_active) {
// Undo the decrement done above
no_mapping++;
- State = NORMAL_BUSY;
}
State = NORMAL_BUSY;
s->need_flushbuf |= add_to_showcmd(*cp);
@@ -2334,10 +2336,11 @@ do_mouse (
if (regname == 0 && eval_has_provider("clipboard")) {
regname = '*';
}
- if ((State & REPLACE_FLAG) && !yank_register_mline(regname))
+ if ((State & REPLACE_FLAG) && !yank_register_mline(regname)) {
insert_reg(regname, true);
- else {
- do_put(regname, NULL, BACKWARD, 1L, fixindent | PUT_CURSEND);
+ } else {
+ do_put(regname, NULL, BACKWARD, 1L,
+ (fixindent ? PUT_FIXINDENT : 0) | PUT_CURSEND);
/* Repeat it with CTRL-R CTRL-O r or CTRL-R CTRL-P r */
AppendCharToRedobuff(Ctrl_R);
@@ -2689,7 +2692,8 @@ do_mouse (
*/
if (restart_edit != 0)
where_paste_started = curwin->w_cursor;
- do_put(regname, NULL, dir, count, fixindent | PUT_CURSEND);
+ do_put(regname, NULL, dir, count,
+ (fixindent ? PUT_FIXINDENT : 0)| PUT_CURSEND);
}
/*
* Ctrl-Mouse click or double click in a quickfix window jumps to the
@@ -4670,6 +4674,7 @@ static void nv_ident(cmdarg_T *cap)
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg'
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
+ bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
size_t buf_size = n * 2 + 30 + STRLEN(kp);
char *buf = xmalloc(buf_size);
buf[0] = NUL;
@@ -4692,7 +4697,9 @@ static void nv_ident(cmdarg_T *cap)
break;
case 'K':
- if (kp_ex) {
+ if (kp_help) {
+ STRCPY(buf, "he! ");
+ } else if (kp_ex) {
if (cap->count0 != 0) { // Send the count to the ex command.
snprintf(buf, buf_size, "%" PRId64, (int64_t)(cap->count0));
}
@@ -4755,7 +4762,7 @@ static void nv_ident(cmdarg_T *cap)
}
// Now grab the chars in the identifier
- if (cmdchar == 'K') {
+ if (cmdchar == 'K' && !kp_help) {
ptr = vim_strnsave(ptr, n);
if (kp_ex) {
// Escape the argument properly for an Ex command
@@ -7609,11 +7616,13 @@ static void nv_record(cmdarg_T *cap)
if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?') {
stuffcharReadbuff(cap->nchar);
stuffcharReadbuff(K_CMDWIN);
- } else
- /* (stop) recording into a named register, unless executing a
- * register */
- if (!Exec_reg && do_record(cap->nchar) == false)
- clearopbeep(cap->oap);
+ } else {
+ // (stop) recording into a named register, unless executing a
+ // register.
+ if (!Exec_reg && do_record(cap->nchar) == FAIL) {
+ clearopbeep(cap->oap);
+ }
+ }
}
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 68ef27222c..c77781b1d1 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* ops.c: implementation of various operators: op_shift, op_delete, op_tilde,
* op_change, op_yank, do_put, do_join
@@ -802,7 +805,6 @@ static bool is_append_register(int regname)
/// Returns a copy of contents in register `name`
/// for use in do_put. Should be freed by caller.
yankreg_T *copy_register(int name)
- FUNC_ATTR_MALLOC
FUNC_ATTR_NONNULL_RET
{
yankreg_T *reg = get_yank_register(name, YREG_PASTE);
@@ -1956,16 +1958,18 @@ int swapchar(int op_type, pos_T *pos)
if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */
return FALSE;
nc = c;
- if (vim_islower(c)) {
- if (op_type == OP_ROT13)
+ if (mb_islower(c)) {
+ if (op_type == OP_ROT13) {
nc = ROT13(c, 'a');
- else if (op_type != OP_LOWER)
- nc = vim_toupper(c);
- } else if (vim_isupper(c)) {
- if (op_type == OP_ROT13)
+ } else if (op_type != OP_LOWER) {
+ nc = mb_toupper(c);
+ }
+ } else if (mb_isupper(c)) {
+ if (op_type == OP_ROT13) {
nc = ROT13(c, 'A');
- else if (op_type != OP_UPPER)
- nc = vim_tolower(c);
+ } else if (op_type != OP_UPPER) {
+ nc = mb_tolower(c);
+ }
}
if (nc != c) {
if (enc_utf8 && (c >= 0x80 || nc >= 0x80)) {
@@ -2784,7 +2788,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
}
if (curbuf->terminal) {
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) { // -V756
// feed the lines to the terminal
for (size_t j = 0; j < y_size; j++) {
if (j) {
@@ -3327,10 +3331,11 @@ void ex_display(exarg_T *eap)
get_clipboard(name, &yb, true);
- if (name == vim_tolower(redir_reg)
- || (redir_reg == '"' && yb == y_previous))
- continue; /* do not list register being written to, the
- * pointer can be freed */
+ if (name == mb_tolower(redir_reg)
+ || (redir_reg == '"' && yb == y_previous)) {
+ continue; // do not list register being written to, the
+ // pointer can be freed
+ }
if (yb->y_array != NULL) {
msg_putchar('\n');
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index 13d0142343..a8867e02ea 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -8,6 +8,8 @@
#include "nvim/types.h"
#include "nvim/eval/typval.h"
#include "nvim/os/time.h"
+#include "nvim/normal.h" // for MotionType and oparg_T
+#include "nvim/ex_cmds_defs.h" // for exarg_T
typedef int (*Indenter)(void);
diff --git a/src/nvim/option.c b/src/nvim/option.c
index eddfdd6218..74392ccfb5 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// User-settable options. Checklist for adding a new option:
// - Put it in options.lua
// - For a global option: Add a variable for it in option_defs.h.
@@ -246,7 +249,8 @@ typedef struct vimoption {
"A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal," \
"B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel," \
"x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill," \
- "!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine"
+ "!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine," \
+ "0:Whitespace"
/*
* options[] is initialized here.
@@ -939,11 +943,8 @@ void free_all_options(void)
#endif
-/*
- * Initialize the options, part two: After getting Rows and Columns and
- * setting 'term'.
- */
-void set_init_2(void)
+/// Initialize the options, part two: After getting Rows and Columns.
+void set_init_2(bool headless)
{
int idx;
@@ -966,8 +967,12 @@ void set_init_2(void)
p_window = Rows - 1;
}
set_number_default("window", Rows - 1);
- parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */
- (void)parse_printoptions(); /* parse 'printoptions' default value */
+ if (!headless && !os_term_is_nice()) {
+ set_string_option_direct((char_u *)"guicursor", -1, (char_u *)"",
+ OPT_GLOBAL, SID_NONE);
+ }
+ parse_shape_opt(SHAPE_CURSOR); // set cursor shapes from 'guicursor'
+ (void)parse_printoptions(); // parse 'printoptions' default value
}
/*
@@ -1055,13 +1060,15 @@ void set_init_3(void)
*/
void set_helplang_default(const char *lang)
{
- int idx;
+ if (lang == NULL) {
+ return;
+ }
const size_t lang_len = strlen(lang);
- if (lang == NULL || lang_len < 2) { // safety check
+ if (lang_len < 2) { // safety check
return;
}
- idx = findoption("hlg");
+ int idx = findoption("hlg");
if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) {
if (options[idx].flags & P_ALLOCED)
free_string_option(p_hlg);
@@ -2839,9 +2846,10 @@ did_set_string_option (
}
}
- /* 'guicursor' */
- else if (varp == &p_guicursor)
+ // 'guicursor'
+ else if (varp == &p_guicursor) {
errmsg = parse_shape_opt(SHAPE_CURSOR);
+ }
else if (varp == &p_popt)
errmsg = parse_printoptions();
@@ -3628,6 +3636,12 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
} else if ((int *)varp == &p_force_off && p_force_off == true) {
p_force_off = false;
return (char *)e_unsupportedoption;
+ } else if ((int *)varp == &p_lrm) {
+ // 'langremap' -> !'langnoremap'
+ p_lnr = !p_lrm;
+ } else if ((int *)varp == &p_lnr) {
+ // 'langnoremap' -> !'langremap'
+ p_lrm = !p_lnr;
// 'undofile'
} else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) {
// Only take action when the option was set. When reset we do not
@@ -4121,7 +4135,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value,
}
} else if (pp == &curbuf->b_p_scbk || pp == &p_scbk) {
if (value < -1 || value > SB_MAX
- || (opt_flags == OPT_LOCAL && !curbuf->terminal)) {
+ || (value != -1 && opt_flags == OPT_LOCAL && !curbuf->terminal)) {
errmsg = e_invarg;
}
} else if (pp == &curbuf->b_p_sw || pp == &p_sw) {
@@ -4781,7 +4795,7 @@ int find_key_option_len(const char_u *arg, size_t len)
} else {
arg--; // put arg at the '<'
modifiers = 0;
- key = find_special_key(&arg, len + 1, &modifiers, true, true);
+ key = find_special_key(&arg, len + 1, &modifiers, true, true, false);
if (modifiers) { // can't handle modifiers here
key = 0;
}
@@ -6937,7 +6951,7 @@ bool signcolumn_on(win_T *wp)
/// Get window or buffer local options
dict_T *get_winbuf_options(const int bufopt)
- FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
+ FUNC_ATTR_WARN_UNUSED_RESULT
{
dict_T *const d = tv_dict_alloc();
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 2475a0b6a1..4ee0f4f225 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -476,8 +476,9 @@ EXTERN char_u *p_isp; // 'isprint'
EXTERN int p_js; // 'joinspaces'
EXTERN char_u *p_kp; // 'keywordprg'
EXTERN char_u *p_km; // 'keymodel'
-EXTERN char_u *p_langmap; // 'langmap'*/
-EXTERN int p_lnr; // 'langnoremap'*/
+EXTERN char_u *p_langmap; // 'langmap'
+EXTERN int p_lnr; // 'langnoremap'
+EXTERN int p_lrm; // 'langremap'
EXTERN char_u *p_lm; // 'langmenu'
EXTERN char_u *p_lispwords; // 'lispwords'
EXTERN long p_ls; // 'laststatus'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index ee2b8a563d..4e7be63b63 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -1000,7 +1000,7 @@ return {
deny_duplicates=true,
vi_def=true,
varname='p_guicursor',
- defaults={if_true={vi="n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block"}}
+ defaults={if_true={vi="n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175"}}
},
{
full_name='guifont', abbreviation='gfn',
@@ -1026,13 +1026,6 @@ return {
enable_if=false,
},
{
- full_name='guiheadroom', abbreviation='ghr',
- type='number', scope={'global'},
- vi_def=true,
- enable_if=false,
- defaults={if_true={vi=50}}
- },
- {
full_name='guioptions', abbreviation='go',
type='string', list='flags', scope={'global'},
vi_def=true,
@@ -1347,6 +1340,12 @@ return {
defaults={if_true={vi=false, vim=true}}
},
{
+ full_name='langremap', abbreviation='lrm',
+ type='bool', scope={'global'},
+ varname='p_lrm',
+ defaults={if_true={vi=true, vim=false}}
+ },
+ {
full_name='laststatus', abbreviation='ls',
type='number', scope={'global'},
vim=true,
@@ -2052,7 +2051,11 @@ return {
secure=true,
vi_def=true,
varname='p_srr',
- defaults={if_true={vi=">"}}
+ defaults={
+ condition='WIN32',
+ if_true={vi=">%s 2>&1"},
+ if_false={vi=">"}
+ }
},
{
full_name='shellslash', abbreviation='ssl',
diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c
index fef02cc784..267cf5ae4b 100644
--- a/src/nvim/os/dl.c
+++ b/src/nvim/os/dl.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// Functions for using external native libraries
#include <stdbool.h>
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index a73d753e46..8f7a6e72b5 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -1,11 +1,11 @@
-// env.c -- environment variable access
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
-#include <assert.h>
+// Environment inspection
+#include <assert.h>
#include <uv.h>
-// vim.h must be included before charset.h (and possibly others) or things
-// blow up
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/charset.h"
@@ -118,7 +118,6 @@ char *os_getenvname_at_index(size_t index)
return name;
}
-
/// Get the process ID of the Neovim process.
///
/// @return the process ID.
@@ -145,10 +144,27 @@ void os_get_hostname(char *hostname, size_t size)
} else {
xstrlcpy(hostname, vutsname.nodename, size);
}
+#elif defined(WIN32)
+ WCHAR host_utf16[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD host_wsize = sizeof(host_utf16) / sizeof(host_utf16[0]);
+ if (GetComputerNameW(host_utf16, &host_wsize) == 0) {
+ *hostname = '\0';
+ DWORD err = GetLastError();
+ EMSG2("GetComputerNameW failed: %d", err);
+ return;
+ }
+ host_utf16[host_wsize] = '\0';
+
+ char *host_utf8;
+ int conversion_result = utf16_to_utf8(host_utf16, &host_utf8);
+ if (conversion_result != 0) {
+ EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ return;
+ }
+ xstrlcpy(hostname, host_utf8, size);
+ xfree(host_utf8);
#else
- // TODO(unknown): Implement this for windows.
- // See the implementation used in vim:
- // https://code.google.com/p/vim/source/browse/src/os_win32.c?r=6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72#2899
+ EMSG("os_get_hostname failed: missing uname()");
*hostname = '\0';
#endif
}
@@ -615,9 +631,9 @@ char *vim_getenv(const char *name)
vim_path = (char *)p_hf;
}
+ char exe_name[MAXPATHL];
// Find runtime path relative to the nvim binary: ../share/nvim/runtime
if (vim_path == NULL) {
- char exe_name[MAXPATHL];
size_t exe_name_len = MAXPATHL;
if (os_exepath(exe_name, &exe_name_len) == 0) {
char *path_end = (char *)path_tail_with_sep((char_u *)exe_name);
@@ -628,7 +644,7 @@ char *vim_getenv(const char *name)
exe_name,
"share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR,
MAXPATHL) == OK) {
- vim_path = exe_name;
+ vim_path = exe_name; // -V507
}
}
}
@@ -662,6 +678,7 @@ char *vim_getenv(const char *name)
vim_path = NULL;
}
}
+ assert(vim_path != exe_name);
}
#ifdef HAVE_PATHDEF
@@ -703,7 +720,8 @@ char *vim_getenv(const char *name)
/// @param dstlen Maximum length of the result
/// @param one If true, only replace one file name, including spaces and commas
/// in the file name
-void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one)
+void home_replace(const buf_T *const buf, const char_u *src,
+ char_u *dst, size_t dstlen, bool one)
{
size_t dirlen = 0, envlen = 0;
size_t len;
@@ -717,7 +735,7 @@ void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one)
* If the file is a help file, remove the path completely.
*/
if (buf != NULL && buf->b_help) {
- STRCPY(dst, path_tail(src));
+ xstrlcpy((char *)dst, (char *)path_tail(src), dstlen);
return;
}
@@ -809,7 +827,7 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
len += STRLEN(src);
}
char_u *dst = xmalloc(len);
- home_replace(buf, src, dst, (int)len, true);
+ home_replace(buf, src, dst, len, true);
return dst;
}
@@ -888,3 +906,45 @@ bool os_setenv_append_path(const char *fname)
}
return false;
}
+
+/// Returns true if the terminal can be assumed to silently ignore unknown
+/// control codes.
+bool os_term_is_nice(void)
+{
+#if defined(__APPLE__) || defined(WIN32)
+ return true;
+#else
+ const char *vte_version = os_getenv("VTE_VERSION");
+ if ((vte_version && atoi(vte_version) >= 3900)
+ || os_getenv("KONSOLE_PROFILE_NAME")
+ || os_getenv("KONSOLE_DBUS_SESSION")) {
+ return true;
+ }
+ const char *termprg = os_getenv("TERM_PROGRAM");
+ if (termprg && striequal(termprg, "iTerm.app")) {
+ return true;
+ }
+ const char *term = os_getenv("TERM");
+ if (term && strncmp(term, "rxvt", 4) == 0) {
+ return true;
+ }
+ return false;
+#endif
+}
+
+/// Returns true if `sh` looks like it resolves to "cmd.exe".
+bool os_shell_is_cmdexe(const char *sh)
+ FUNC_ATTR_NONNULL_ALL
+{
+ if (*sh == NUL) {
+ return false;
+ }
+ if (striequal(sh, "$COMSPEC")) {
+ const char *comspec = os_getenv("COMSPEC");
+ return striequal("cmd.exe", (char *)path_tail((char_u *)comspec));
+ }
+ if (striequal(sh, "cmd.exe") || striequal(sh, "cmd")) {
+ return true;
+ }
+ return striequal("cmd.exe", (char *)path_tail((char_u *)sh));
+}
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c
index 775f2bd449..4309ac723c 100644
--- a/src/nvim/os/fileio.c
+++ b/src/nvim/os/fileio.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file fileio.c
///
/// Buffered reading/writing to a file. Unlike fileio.c this is not dealing with
@@ -47,6 +50,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname,
int os_open_flags = 0;
int fd;
TriState wr = kNone;
+ // -V:FLAG:501
#define FLAG(flags, flag, fcntl_flags, wrval, cond) \
do { \
if (flags & flag) { \
@@ -100,7 +104,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname,
/// @return [allocated] Opened file or NULL in case of error.
FileDescriptor *file_open_new(int *const error, const char *const fname,
const int flags, const int mode)
- FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
FileDescriptor *const fp = xmalloc(sizeof(*fp));
if ((*error = file_open(fp, fname, flags, mode)) != 0) {
@@ -113,27 +117,31 @@ FileDescriptor *file_open_new(int *const error, const char *const fname,
/// Close file and free its buffer
///
/// @param[in,out] fp File to close.
+/// @param[in] do_fsync If true, use fsync() to write changes to disk.
///
/// @return 0 or error code.
-int file_close(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL
+int file_close(FileDescriptor *const fp, const bool do_fsync)
+ FUNC_ATTR_NONNULL_ALL
{
- const int error = file_fsync(fp);
- const int error2 = os_close(fp->fd);
+ const int flush_error = (do_fsync ? file_fsync(fp) : file_flush(fp));
+ const int close_error = os_close(fp->fd);
rbuffer_free(fp->rv);
- if (error2 != 0) {
- return error2;
+ if (close_error != 0) {
+ return close_error;
}
- return error;
+ return flush_error;
}
/// Close and free file obtained using file_open_new()
///
/// @param[in,out] fp File to close.
+/// @param[in] do_fsync If true, use fsync() to write changes to disk.
///
/// @return 0 or error code.
-int file_free(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL
+int file_free(FileDescriptor *const fp, const bool do_fsync)
+ FUNC_ATTR_NONNULL_ALL
{
- const int ret = file_close(fp);
+ const int ret = file_close(fp, do_fsync);
xfree(fp);
return ret;
}
@@ -143,21 +151,36 @@ int file_free(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL
/// @param[in,out] fp File to work with.
///
/// @return 0 or error code.
-int file_fsync(FileDescriptor *const fp)
+int file_flush(FileDescriptor *const fp)
FUNC_ATTR_NONNULL_ALL
{
if (!fp->wr) {
return 0;
}
file_rb_write_full_cb(fp->rv, fp);
- if (fp->_error != 0) {
- const int error = fp->_error;
- fp->_error = 0;
- return error;
+ const int error = fp->_error;
+ fp->_error = 0;
+ return error;
+}
+
+/// Flush file modifications to disk and run fsync()
+///
+/// @param[in,out] fp File to work with.
+///
+/// @return 0 or error code.
+int file_fsync(FileDescriptor *const fp)
+ FUNC_ATTR_NONNULL_ALL
+{
+ if (!fp->wr) {
+ return 0;
}
- const int error = os_fsync(fp->fd);
- if (error != UV_EINVAL && error != UV_EROFS) {
- return error;
+ const int flush_error = file_flush(fp);
+ if (flush_error != 0) {
+ return flush_error;
+ }
+ const int fsync_error = os_fsync(fp->fd);
+ if (fsync_error != UV_EINVAL && fsync_error != UV_EROFS) {
+ return fsync_error;
}
return 0;
}
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 3833a43f5f..c39ff5d358 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// fs.c -- filesystem access
#include <stdbool.h>
#include <stddef.h>
@@ -1009,7 +1012,7 @@ char *os_resolve_shortcut(const char *fname)
WCHAR *p;
const int conversion_result = utf8_to_utf16(fname, &p);
if (conversion_result != 0) {
- EMSG2("utf8_to_utf16 failed: %s", uv_strerror(conversion_result));
+ EMSG2("utf8_to_utf16 failed: %d", conversion_result);
}
if (p != NULL) {
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 5f0f2ec677..7b5e14dd19 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <string.h>
#include <stdbool.h>
@@ -182,7 +185,8 @@ size_t input_enqueue(String keys)
while (rbuffer_space(input_buffer) >= 6 && ptr < end) {
uint8_t buf[6] = { 0 };
unsigned int new_size
- = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true);
+ = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true,
+ true);
if (new_size) {
new_size = handle_mouse_event(&ptr, buf, new_size);
diff --git a/src/nvim/os/mem.c b/src/nvim/os/mem.c
index 871ece7a0e..eccb3c97e5 100644
--- a/src/nvim/os/mem.c
+++ b/src/nvim/os/mem.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// Functions for accessing system memory information.
#include <uv.h>
diff --git a/src/nvim/os/pty_process_unix.c b/src/nvim/os/pty_process_unix.c
index 71a5e13de5..eb9335b03c 100644
--- a/src/nvim/os/pty_process_unix.c
+++ b/src/nvim/os/pty_process_unix.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// Some of the code came from pangoterm and libuv
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index b449cc3d5a..fc8ab7dc8f 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <string.h>
#include <assert.h>
#include <stdbool.h>
@@ -47,7 +50,7 @@ typedef struct {
/// @param extra_args Extra arguments to the shell, or NULL.
/// @return Newly allocated argument vector. Must be freed with shell_free_argv.
char **shell_build_argv(const char *cmd, const char *extra_args)
- FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC
+ FUNC_ATTR_NONNULL_RET
{
size_t argc = tokenize(p_sh, NULL) + (cmd ? tokenize(p_shcf, NULL) : 0);
char **rv = xmalloc((argc + 4) * sizeof(*rv));
@@ -124,11 +127,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
}
size_t nread;
-
int exitcode = do_os_system(shell_build_argv((char *)cmd, (char *)extra_args),
input.data, input.len, output_ptr, &nread,
emsg_silent, forward_output);
-
xfree(input.data);
if (output) {
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 1ac6d3f5e1..fd6d3b32e4 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdbool.h>
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index afb9bdec31..a41fb7c621 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include "nvim/os/stdpaths_defs.h"
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c
index 8ce2ecf4f4..c471352c02 100644
--- a/src/nvim/os/time.c
+++ b/src/nvim/os/time.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index 1c94ef0067..82bb918f70 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// users.c -- operating system user information
#include <uv.h>
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index acd86f06dc..c5a42204be 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* os_unix.c -- code for all flavors of Unix (BSD, SYSV, SVR4, POSIX, ...)
*
diff --git a/src/nvim/path.c b/src/nvim/path.c
index d0248690d9..12952f49db 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -84,15 +87,15 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname)
///
/// @return pointer just past the last path separator (empty string, if fname
/// ends in a slash), or empty string if fname is NULL.
-char_u *path_tail(char_u *fname)
+char_u *path_tail(const char_u *fname)
FUNC_ATTR_NONNULL_RET
{
if (fname == NULL) {
return (char_u *)"";
}
- char_u *tail = get_past_head(fname);
- char_u *p = tail;
+ const char_u *tail = get_past_head(fname);
+ const char_u *p = tail;
// Find last part of path.
while (*p != NUL) {
if (vim_ispathsep_nocolon(*p)) {
@@ -100,7 +103,7 @@ char_u *path_tail(char_u *fname)
}
mb_ptr_adv(p);
}
- return tail;
+ return (char_u *)tail;
}
/// Get pointer to tail of "fname", including path separators.
@@ -174,9 +177,9 @@ const char *path_next_component(const char *fname)
/// Get a pointer to one character past the head of a path name.
/// Unix: after "/"; Win: after "c:\"
/// If there is no head, path is returned.
-char_u *get_past_head(char_u *path)
+char_u *get_past_head(const char_u *path)
{
- char_u *retval = path;
+ const char_u *retval = path;
#ifdef WIN32
// May skip "c:"
@@ -189,7 +192,7 @@ char_u *get_past_head(char_u *path)
++retval;
}
- return retval;
+ return (char_u *)retval;
}
/*
@@ -1853,7 +1856,7 @@ int pathcmp(const char *p, const char *q, int maxlen)
break;
}
- if ((p_fic ? vim_toupper(c1) != vim_toupper(c2) : c1 != c2)
+ if ((p_fic ? mb_toupper(c1) != mb_toupper(c2) : c1 != c2)
#ifdef BACKSLASH_IN_FILENAME
/* consider '/' and '\\' to be equal */
&& !((c1 == '/' && c2 == '\\')
@@ -1864,8 +1867,8 @@ int pathcmp(const char *p, const char *q, int maxlen)
return -1;
if (vim_ispathsep(c2))
return 1;
- return p_fic ? vim_toupper(c1) - vim_toupper(c2)
- : c1 - c2; /* no match */
+ return p_fic ? mb_toupper(c1) - mb_toupper(c2)
+ : c1 - c2; // no match
}
i += MB_PTR2LEN((char_u *)p + i);
diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po
index d30faeb554..3551c07ff2 100644
--- a/src/nvim/po/fi.po
+++ b/src/nvim/po/fi.po
@@ -1,247 +1,419 @@
# Finnish translation for Vim.
# Copyright (C) 2003-2006 Free Software Foundation, Inc.
-# 2007-2010, Flammie Pirinen <flammie@iki.fi>
+# 2007-2016, Flammie Pirinen <flammie@iki.fi>
#
-# Vimin kyttjt on nrttej. Sanasto on jargonia :-p
-#
-# Lhinn latin-1:t, sill vim pit portata ilmeisen obskuureille
-# alustoille. Mys: pluralit puuttuu, ohjelman kyttliittymn fontti
-# tasavlinen, tila rajattu, jne. jne., luovia ratkaisuja edess.
+# Jargonia ei ole yritetty suotta kotoperäistää missä teknisempi lainasanasto
+# tulee paremmin kyseeseen.
#
# Sanastosta:
-# Fold on sellainen moderneissa ohjelmointi-IDE:iss oleva toiminto, jolla
-# lohko koodia esim. funktio piilotetaan nkymst: suom. taitos alkup.
+# * Fold on sellainen moderneissa ohjelmointi-IDE:issä oleva toiminto, jolla
+# lohko koodia esim. funktio piilotetaan näkymästä: suom. taitos alkup.
# analogian mukaan
-# source v. lataa tiedoston, kuten bash-komento source (tai .)
+# * source, v. lataa tiedoston, kuten bash-komento source (tai .)
+# * dictionary (dict) on vaihtelevasti sanakirja tai tietorakenne
#
msgid ""
msgstr ""
"Project-Id-Version: Vim 7\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-05-26 14:21+0200\n"
-"PO-Revision-Date: 2010-08-09 02:35+0300\n"
-"Last-Translator: Flammie Pirinen <flammie@iki.fi>\n"
+"POT-Creation-Date: 2017-04-19 16:46+0200\n"
+"PO-Revision-Date: 2016-08-29 11:27+0200\n"
+"Last-Translator: Flammie A Pirinen <flammie@iki.fi>\n"
"Language-Team: Finnish <laatu@lokalisointi.org>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: ../api/private/helpers.c:201
#, fuzzy
-msgid "Unable to get option value"
-msgstr "Roskaa argumentin perss"
+#~ msgid "Index out of bounds"
+#~ msgstr "ei löytynyt "
-#: ../api/private/helpers.c:204
-msgid "internal error: unknown option type"
-msgstr ""
+#, fuzzy
+#~ msgid "Line index is too high"
+#~ msgstr "ikkunan indeksi alueen ulkopuolella"
+
+#~ msgid "Argument \"start\" is higher than \"end\""
+#~ msgstr ""
+
+#~ msgid "All items in the replacement array must be strings"
+#~ msgstr ""
+
+msgid "string cannot contain newlines"
+msgstr "merkkijono ei saa sisältää rivinvaihtoja"
+
+#, fuzzy
+#~ msgid "Failed to save undo information"
+#~ msgstr "ei voitu tallentaa kumoustietoja"
+
+#, fuzzy
+#~ msgid "Failed to delete line"
+#~ msgstr "ei voitu poistaa riviä"
+
+#~ msgid "Index value is too high"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Failed to replace line"
+#~ msgstr "ei voitu korvata riviä"
+
+#, fuzzy
+#~ msgid "Failed to insert line"
+#~ msgstr "ei voitu lisätä riviä"
+
+#, fuzzy
+#~ msgid "Failed to rename buffer"
+#~ msgstr "ei voity uudelleennimetä puskuria"
+
+#, fuzzy
+#~ msgid "Mark name must be a single character"
+#~ msgstr "merkin nimen pitää olla yksi merkki"
+
+#, fuzzy
+#~ msgid "Invalid mark name"
+#~ msgstr "virheellinen merkin nimi"
+
+#, fuzzy
+#~ msgid "Line number outside range"
+#~ msgstr "rivinumero arvoalueen ulkopuolella"
+
+#, fuzzy
+#~ msgid "Column value outside range"
+#~ msgstr "rivinumero arvoalueen ulkopuolella"
+
+#, fuzzy
+#~ msgid "Keyboard interrupt"
+#~ msgstr "näppäimistökeskeytys"
+
+#, fuzzy
+#~ msgid "Key not found"
+#~ msgstr "ei löytynyt "
+
+#, fuzzy
+#~ msgid "Dictionary is locked"
+#~ msgstr "dictionary on lukittu"
+
+#, fuzzy
+#~ msgid "Empty variable names aren't allowed"
+#~ msgstr "tyhjiä avaimia ei voi käyttää"
+
+#, fuzzy
+#~ msgid "Key length is too high"
+#~ msgstr "Liian pitkä polku"
+
+#, c-format
+#~ msgid "Key is read-only: %s"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "Key is fixed: %s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "Key is locked: %s"
+#~ msgstr "E741: Arvo on lukittu: %s"
+
+#. Doesn't exist, fail
+#, fuzzy, c-format
+#~ msgid "Key does not exist: %s"
+#~ msgstr "Tiedostoa %s ei ole"
+
+#, fuzzy
+#~ msgid "Empty option name"
+#~ msgstr "E792: tyhjä valikkonimi"
+
+#, fuzzy, c-format
+#~ msgid "Invalid option name \"%s\""
+#~ msgstr "E755: Virheellinen alue kohteelle %s"
+
+#, fuzzy, c-format
+#~ msgid "Unable to get value for option \"%s\""
+#~ msgstr "ei voi tyhjentää yleistä asetusta %s"
+
+#, fuzzy, c-format
+#~ msgid "Unknown type for option \"%s\""
+#~ msgstr "E113: Tuntematon asetus: %s"
+
+#, fuzzy, c-format
+#~ msgid "Unable to unset option \"%s\""
+#~ msgstr "ei voi tyhjentää yleistä asetusta %s"
+
+#, fuzzy, c-format
+#~ msgid "Cannot unset option \"%s\" because it doesn't have a global value"
+#~ msgstr "ei voi tyhjentää asetusta %s jolla ei ole yleistä arvoa"
+
+#, c-format
+#~ msgid "Option \"%s\" requires a boolean value"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "Option \"%s\" requires an integer value"
+#~ msgstr "E709: [:] toimii vain listalla"
+
+#, c-format
+#~ msgid "Value for option \"%s\" is outside range"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "Option \"%s\" requires a string value"
+#~ msgstr "E709: [:] toimii vain listalla"
+
+#, fuzzy
+#~ msgid "Invalid buffer id"
+#~ msgstr "virheellinen puskurinumero"
+
+#, fuzzy
+#~ msgid "Invalid window id"
+#~ msgstr "E534: Viallinen leveä fontti"
+
+#, fuzzy
+#~ msgid "Invalid tabpage id"
+#~ msgstr "Väärä argumentti valitsimelle"
+
+#~ msgid "Integer value outside range"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Empty dictionary keys aren't allowed"
+#~ msgstr "tyhjiä avaimia ei voi käyttää"
+
+#, fuzzy
+#~ msgid "Problem while switching windows"
+#~ msgstr "virhe ikkunaa vaihtaessa"
+
+#, fuzzy
+#~ msgid "UI already attached for channel"
+#~ msgstr "Vanhimmassa muutoksessa"
+
+#~ msgid "Expected width > 0 and height > 0"
+#~ msgstr ""
+
+#~ msgid "UI is not attached for channel"
+#~ msgstr ""
+
+#~ msgid "rgb must be a Boolean"
+#~ msgstr ""
+
+#~ msgid "popupmenu_external must be a Boolean"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "No such ui option"
+#~ msgstr "E24: Lyhennettä ei ole"
+
+#~ msgid "Function called with too many arguments."
+#~ msgstr ""
+
+#~ msgid "Error calling function."
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "String length is too high"
+#~ msgstr "Liian pitkä polku"
+
+#~ msgid "Directory string is too long"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Failed to change directory"
+#~ msgstr "hakemistoa ei voitu muuttaa"
+
+#, fuzzy, c-format
+#~ msgid "Failed to switch to buffer %d"
+#~ msgstr "ei voitu vaihtaa puskuriin %d"
+
+#, fuzzy, c-format
+#~ msgid "Failed to switch to window %d"
+#~ msgstr "ei voitu vaihtaa puskuriin %d"
+
+#, fuzzy, c-format
+#~ msgid "Failed to switch to tabpage %d"
+#~ msgstr "ei voitu vaihtaa puskuriin %d"
+
+#~ msgid "All items in calls array must be arrays"
+#~ msgstr ""
+
+#~ msgid "All items in calls array must be arrays of size 2"
+#~ msgstr ""
+
+#~ msgid "name must be String"
+#~ msgstr ""
+
+#~ msgid "args must be Array"
+#~ msgstr ""
+
+# datarakenteita
+#, fuzzy
+#~ msgid "Argument \"pos\" must be a [row, col] array"
+#~ msgstr "E712: Argumentin %s pitää olla lista tai sanakirja"
+
+#, fuzzy
+#~ msgid "Cursor position outside buffer"
+#~ msgstr "kursorin sijainti puskurin ulkopuolella"
+
+#~ msgid "Height value outside range"
+#~ msgstr ""
+
+#~ msgid "Width value outside range"
+#~ msgstr ""
-#: ../buffer.c:92
msgid "[Location List]"
msgstr "[Sijaintiluettelo]"
-#: ../buffer.c:93
msgid "[Quickfix List]"
msgstr "[Pikakorjausluettelo]"
-#: ../buffer.c:94
-#, fuzzy
msgid "E855: Autocommands caused command to abort"
-msgstr "E812: Autocommands muutti puskurin tai sen nimen"
+msgstr "E855: Autocommands lopetti komennon"
-#: ../buffer.c:135
msgid "E82: Cannot allocate any buffer, exiting..."
-msgstr "E82: Mitn puskuria ei voitu varata, lopetetaan..."
+msgstr "E82: Mitään puskuria ei voitu varata, lopetetaan..."
-#: ../buffer.c:138
msgid "E83: Cannot allocate buffer, using other one..."
-msgstr "E83: Puskuria ei voitu varata, kytetn toista..."
+msgstr "E83: Puskuria ei voitu varata, käytetään toista..."
+
+#, fuzzy
+#~ msgid "E937: Attempt to delete a buffer that is in use"
+#~ msgstr "E934: Ei voida hypätä puskuriin jolla ei ole nimeä"
-#: ../buffer.c:763
msgid "E515: No buffers were unloaded"
msgstr "E515: Puskureita ei vapautettu"
-#: ../buffer.c:765
msgid "E516: No buffers were deleted"
msgstr "E516: Puskureita ei poistettu"
-#: ../buffer.c:767
msgid "E517: No buffers were wiped out"
msgstr "E517: Puskureita ei pyyhitty"
-#: ../buffer.c:772
msgid "1 buffer unloaded"
msgstr "1 puskuri vapautettiin"
-#: ../buffer.c:774
#, c-format
msgid "%d buffers unloaded"
msgstr "%d puskuria vapautettiin"
-#: ../buffer.c:777
msgid "1 buffer deleted"
msgstr "1 puskuri poistettu"
-#: ../buffer.c:779
#, c-format
msgid "%d buffers deleted"
msgstr "%d puskuria poistettu"
-#: ../buffer.c:782
msgid "1 buffer wiped out"
msgstr "1 puskuri pyyhitty"
-#: ../buffer.c:784
#, c-format
msgid "%d buffers wiped out"
msgstr "%d puskuria pyyhitty"
-#: ../buffer.c:806
msgid "E90: Cannot unload last buffer"
-msgstr "E90: Ei voi vapauttaa viimeist puskuria"
+msgstr "E90: Ei voi vapauttaa viimeistä puskuria"
-#: ../buffer.c:874
msgid "E84: No modified buffer found"
msgstr "E84: Ei muokattuja puskureita"
#. back where we started, didn't find anything.
-#: ../buffer.c:903
msgid "E85: There is no listed buffer"
msgstr "E85: Luetteloitua puskuria ei ole"
-#: ../buffer.c:913
-#, c-format
-msgid "E86: Buffer %<PRId64> does not exist"
-msgstr "E86: Puskuria %<PRId64> ei ole"
-
-#: ../buffer.c:915
msgid "E87: Cannot go beyond last buffer"
-msgstr "E87: Viimeisen puskurin ohi ei voi edet"
+msgstr "E87: Viimeisen puskurin ohi ei voi edetä"
-#: ../buffer.c:917
msgid "E88: Cannot go before first buffer"
-msgstr "E88: Ensimmisen puskurin ohi ei voi edet"
+msgstr "E88: Ensimmäisen puskurin ohi ei voi edetä"
-#: ../buffer.c:945
-#, c-format
+#, fuzzy, c-format
+#~ msgid "E89: %s will be killed(add ! to override)"
+#~ msgstr "E189: %s on jo olemassa (lisää komentoon ! ohittaaksesi)"
+
+#, fuzzy, c-format
msgid ""
"E89: No write since last change for buffer %<PRId64> (add ! to override)"
msgstr ""
-"E89: Puskurin %<PRId64> muutoksia ei ole tallennettu (lis komentoon ! "
+"E89: Puskurin %ld muutoksia ei ole tallennettu (lisää komentoon ! "
"ohittaaksesi)"
#. wrap around (may cause duplicates)
-#: ../buffer.c:1423
msgid "W14: Warning: List of file names overflow"
msgstr "W14: Varoitus: Tiedostonimiluettelon ylivuoto"
-#: ../buffer.c:1555 ../quickfix.c:3361
-#, c-format
-msgid "E92: Buffer %<PRId64> not found"
-msgstr "E92: Puskuria %<PRId64> ei lydy"
+#, fuzzy, c-format
+#~ msgid "E92: Buffer %<PRId64> not found"
+#~ msgstr "E92: Puskuria %ld ei löydy"
-#: ../buffer.c:1798
#, c-format
msgid "E93: More than one match for %s"
-msgstr "E93: %s tsm useampaan kuin yhteen puskuriin"
+msgstr "E93: %s täsmää useampaan kuin yhteen puskuriin"
-#: ../buffer.c:1800
#, c-format
msgid "E94: No matching buffer for %s"
-msgstr "E94: %s ei tsm yhteenkn puskuriin"
+msgstr "E94: %s ei täsmää yhteenkään puskuriin"
-#: ../buffer.c:2161
-#, c-format
-msgid "line %<PRId64>"
-msgstr "rivi %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "line %<PRId64>"
+#~ msgstr "rivi %ld"
-#: ../buffer.c:2233
msgid "E95: Buffer with this name already exists"
msgstr "E95: Samanniminen puskuri on jo olemassa"
-#: ../buffer.c:2498
msgid " [Modified]"
msgstr " [Muokattu]"
-#: ../buffer.c:2501
msgid "[Not edited]"
msgstr "[Muokkaamaton]"
-#: ../buffer.c:2504
msgid "[New file]"
msgstr "[Uusi tiedosto]"
-#: ../buffer.c:2505
msgid "[Read errors]"
-msgstr "[Lukuvirheit]"
+msgstr "[Lukuvirheitä]"
-#: ../buffer.c:2506 ../buffer.c:3217 ../fileio.c:1807 ../screen.c:4895
msgid "[RO]"
msgstr "[Luku]"
-#: ../buffer.c:2507 ../fileio.c:1807
msgid "[readonly]"
msgstr "[kirjoitussuojattu]"
-#: ../buffer.c:2524
#, c-format
msgid "1 line --%d%%--"
msgstr "1 rivi --%d %%--"
-#: ../buffer.c:2526
-#, c-format
-msgid "%<PRId64> lines --%d%%--"
-msgstr "%<PRId64> rivi --%d %%--"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines --%d%%--"
+#~ msgstr "%ld riviä --%d %%--"
-#: ../buffer.c:2530
-#, c-format
-msgid "line %<PRId64> of %<PRId64> --%d%%-- col "
-msgstr "rivi %<PRId64>/%<PRId64> --%d %%-- sarake "
+#, fuzzy, c-format
+#~ msgid "line %<PRId64> of %<PRId64> --%d%%-- col "
+#~ msgstr "rivi %ld/%ld --%d %%-- sarake "
-#: ../buffer.c:2632 ../buffer.c:4292 ../memline.c:1554
msgid "[No Name]"
-msgstr "[Nimetn]"
+msgstr "[Nimetön]"
#. must be a help buffer
-#: ../buffer.c:2667
msgid "help"
msgstr "ohje"
-#: ../buffer.c:3225 ../screen.c:4883
msgid "[Help]"
msgstr "[Ohje]"
-#: ../buffer.c:3254 ../screen.c:4887
msgid "[Preview]"
msgstr "[Esikatselu]"
# sijainti tiedostossa -indikaattoreja:
-# 4 merkki sais riitt
-#: ../buffer.c:3528
+# 4 merkkiä sais riittää
msgid "All"
msgstr "Kaik"
-#: ../buffer.c:3528
msgid "Bot"
msgstr "Loppu"
-#: ../buffer.c:3531
msgid "Top"
msgstr "Alku"
-#: ../buffer.c:4244
-msgid ""
-"\n"
-"# Buffer list:\n"
-msgstr ""
-"\n"
-"# Puskuriluettelo:\n"
-
-#: ../buffer.c:4289
msgid "[Scratch]"
msgstr "[Raapust]"
-#: ../buffer.c:4529
msgid ""
"\n"
"--- Signs ---"
@@ -249,795 +421,669 @@ msgstr ""
"\n"
"--- Merkit ---"
-#: ../buffer.c:4538
#, c-format
msgid "Signs for %s:"
msgstr "Merkit kohteelle %s:"
-#: ../buffer.c:4543
-#, c-format
-msgid " line=%<PRId64> id=%d name=%s"
-msgstr " rivi=%<PRId64> id=%d nimi=%s"
+#, fuzzy, c-format
+#~ msgid " line=%<PRId64> id=%d name=%s"
+#~ msgstr " rivi=%ld id=%d nimi=%s"
-#: ../cursor_shape.c:68
msgid "E545: Missing colon"
msgstr "E545: Kaksoispiste puuttuu"
-#: ../cursor_shape.c:70 ../cursor_shape.c:94
msgid "E546: Illegal mode"
msgstr "E546: Virheellinen tila"
-#: ../cursor_shape.c:134
msgid "E548: digit expected"
-msgstr "E548: pit olla numero"
+msgstr "E548: pitää olla numero"
-#: ../cursor_shape.c:138
msgid "E549: Illegal percentage"
msgstr "E549: Virheellinen prosenttiluku"
-#: ../diff.c:146
-#, c-format
-msgid "E96: Can not diff more than %<PRId64> buffers"
-msgstr "E96: Ei voi diffata enemp kuin %<PRId64> puskuria"
+#, fuzzy, c-format
+#~ msgid "E96: Cannot diff more than %<PRId64> buffers"
+#~ msgstr "E96: Ei voi diffata enempää kuin %ld puskuria"
-#: ../diff.c:753
msgid "E810: Cannot read or write temp files"
-msgstr "E810: Ei voi lukea tai kirjoittaa vliaikaistiedostoja"
+msgstr "E810: Ei voi lukea tai kirjoittaa väliaikaistiedostoja"
-#: ../diff.c:755
msgid "E97: Cannot create diffs"
-msgstr "E97: Ei voi luoda diffej"
+msgstr "E97: Ei voi luoda diffejä"
-#: ../diff.c:966
msgid "E816: Cannot read patch output"
msgstr "E816: Ei voi lukea patchin tulostetta"
-#: ../diff.c:1220
msgid "E98: Cannot read diff output"
msgstr "E98: Ei voi lukea diffin tulostetta"
-#: ../diff.c:2081
msgid "E99: Current buffer is not in diff mode"
-msgstr "E99: Tm puskuri ei ole diff-tilassa"
+msgstr "E99: Tämä puskuri ei ole diff-tilassa"
-#: ../diff.c:2100
msgid "E793: No other buffer in diff mode is modifiable"
-msgstr "E793: Yksikn muu diff-tilan puskurit ei ole muokattavissa"
+msgstr "E793: Yksikään muu diff-tilan puskurit ei ole muokattavissa"
-#: ../diff.c:2102
msgid "E100: No other buffer in diff mode"
-msgstr "E100: Yksikn muu puskuri ei ole diff-tilassa"
+msgstr "E100: Yksikään muu puskuri ei ole diff-tilassa"
-#: ../diff.c:2112
msgid "E101: More than two buffers in diff mode, don't know which one to use"
-msgstr "E101: Monta puskuria on diff-tilassa, kytettvn valinta ei onnistu"
+msgstr "E101: Monta puskuria on diff-tilassa, käytettävän valinta ei onnistu"
-#: ../diff.c:2141
#, c-format
msgid "E102: Can't find buffer \"%s\""
-msgstr "E102: Puskuria %s ei lydy"
+msgstr "E102: Puskuria %s ei löydy"
-#: ../diff.c:2152
#, c-format
msgid "E103: Buffer \"%s\" is not in diff mode"
msgstr "E103: Puskuri %s ei ole diff-tilassa"
-#: ../diff.c:2193
msgid "E787: Buffer changed unexpectedly"
msgstr "E787: Puskuri vaihtui odottamatta"
-#: ../digraph.c:1598
msgid "E104: Escape not allowed in digraph"
-msgstr "E104: Escapea ei voi kytt digraafissa"
+msgstr "E104: Escapea ei voi käyttää digraafissa"
-#: ../digraph.c:1760
msgid "E544: Keymap file not found"
-msgstr "E544: Nppinkarttaa ei lydy"
+msgstr "E544: Näppäinkarttaa ei löydy"
-#: ../digraph.c:1785
msgid "E105: Using :loadkeymap not in a sourced file"
-msgstr "E105: Kytetn :loadkeymapia ladatun tiedoston ulkopuolella"
+msgstr "E105: Käytetään :loadkeymapia ladatun tiedoston ulkopuolella"
-#: ../digraph.c:1821
msgid "E791: Empty keymap entry"
-msgstr "E791: Tyhj keymap-kentt"
+msgstr "E791: Tyhjä keymap-kenttä"
-#: ../edit.c:82
msgid " Keyword completion (^N^P)"
-msgstr " Avainsanatydennys (^N^P)"
+msgstr " Avainsanatäydennys (^N^P)"
#. ctrl_x_mode == 0, ^P/^N compl.
-#: ../edit.c:83
msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)"
msgstr " ^X-tila (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)"
-#: ../edit.c:85
msgid " Whole line completion (^L^N^P)"
-msgstr " Tysrivitydennys (^L^N^P)"
+msgstr " Täysrivitäydennys (^L^N^P)"
-#: ../edit.c:86
msgid " File name completion (^F^N^P)"
-msgstr " Tiedostonimitydennys (^F^N^P)"
+msgstr " Tiedostonimitäydennys (^F^N^P)"
-#: ../edit.c:87
msgid " Tag completion (^]^N^P)"
-msgstr " Tgitydennys (^]^N^P)"
+msgstr " Tägitäydennys (^]^N^P)"
-#: ../edit.c:88
msgid " Path pattern completion (^N^P)"
-msgstr " Polkukuviotydennys (^N^P)"
+msgstr " Polkukuviotäydennys (^N^P)"
-#: ../edit.c:89
msgid " Definition completion (^D^N^P)"
-msgstr " Mritelmtydennys (^D^N^P)"
+msgstr " Määritelmätäydennys (^D^N^P)"
-#: ../edit.c:91
msgid " Dictionary completion (^K^N^P)"
-msgstr " Sanakirjatydennys (^K^N^P)"
+msgstr " Sanakirjatäydennys (^K^N^P)"
-#: ../edit.c:92
msgid " Thesaurus completion (^T^N^P)"
-msgstr " Thesaurus-tydennys (^T^N^P)"
+msgstr " Thesaurus-täydennys (^T^N^P)"
-#: ../edit.c:93
msgid " Command-line completion (^V^N^P)"
-msgstr " Komentorivitydennys (^V^N^P)"
+msgstr " Komentorivitäydennys (^V^N^P)"
-#: ../edit.c:94
msgid " User defined completion (^U^N^P)"
-msgstr " Kyttjn mrittelem tydennys (^U^N^P)"
+msgstr " Käyttäjän määrittelemä täydennys (^U^N^P)"
-#: ../edit.c:95
msgid " Omni completion (^O^N^P)"
-msgstr " Omnitydennys (^O^N^P)"
+msgstr " Omnitäydennys (^O^N^P)"
-#: ../edit.c:96
msgid " Spelling suggestion (s^N^P)"
msgstr " Oikaisulukuehdotus (s^N^P)"
-#: ../edit.c:97
msgid " Keyword Local completion (^N^P)"
-msgstr " Avainsanan paikallinen tydennys (^N^P)"
+msgstr " Avainsanan paikallinen täydennys (^N^P)"
-#: ../edit.c:100
msgid "Hit end of paragraph"
msgstr "Kappaleen loppu tuli vastaan"
-#: ../edit.c:101
-#, fuzzy
msgid "E839: Completion function changed window"
-msgstr "E813: Ei voi sulkea autocmd-ikkunaa"
+msgstr "E839: Täydennys vaihtoi ikkunaa"
-#: ../edit.c:102
msgid "E840: Completion function deleted text"
-msgstr ""
+msgstr "E840: Täydennys poisti tekstiä"
-#: ../edit.c:1847
msgid "'dictionary' option is empty"
-msgstr "dictionary-asetus on tyhj"
+msgstr "dictionary-asetus on tyhjä"
-#: ../edit.c:1848
msgid "'thesaurus' option is empty"
-msgstr "thesaurus-asetus on tyhj"
+msgstr "thesaurus-asetus on tyhjä"
-#: ../edit.c:2655
#, c-format
msgid "Scanning dictionary: %s"
msgstr "Luetaan sanakirjaa: %s"
-#: ../edit.c:3079
msgid " (insert) Scroll (^E/^Y)"
-msgstr " (sytt) Vieritys (^E/^Y)"
+msgstr " (syöttö) Vieritys (^E/^Y)"
-#: ../edit.c:3081
msgid " (replace) Scroll (^E/^Y)"
msgstr " (korvaus) Vieritys (^E/^Y)"
-#: ../edit.c:3587
#, c-format
msgid "Scanning: %s"
msgstr "Luetaan: %s"
-#: ../edit.c:3614
msgid "Scanning tags."
-msgstr "Luetaan tgej."
+msgstr "Luetaan tägejä."
-#: ../edit.c:4519
msgid " Adding"
-msgstr " Listn"
+msgstr " Lisätään"
#. showmode might reset the internal line pointers, so it must
#. * be called before line = ml_get(), or when this address is no
#. * longer needed. -- Acevedo.
#.
-#: ../edit.c:4562
msgid "-- Searching..."
msgstr "-- Haetaan..."
-#: ../edit.c:4618
msgid "Back at original"
-msgstr "Takaisin lhtpisteess"
+msgstr "Takaisin lähtöpisteessä"
-#: ../edit.c:4621
msgid "Word from other line"
-msgstr "Sana toisella rivill"
+msgstr "Sana toisella rivillä"
-#: ../edit.c:4624
msgid "The only match"
-msgstr "Ainoa tsmys"
+msgstr "Ainoa täsmäys"
-#: ../edit.c:4680
#, c-format
msgid "match %d of %d"
-msgstr "tsmys %d/%d"
+msgstr "täsmäys %d/%d"
-#: ../edit.c:4684
#, c-format
msgid "match %d"
-msgstr "tsmys %d"
+msgstr "täsmäys %d"
-#: ../eval.c:137
msgid "E18: Unexpected characters in :let"
-msgstr "E18: Odottamattomia merkkej komennossa :let"
-
-#: ../eval.c:138
-#, c-format
-msgid "E684: list index out of range: %<PRId64>"
-msgstr "E684: Indeksi %<PRId64> luettelon rajojen ulkopuolella"
+msgstr "E18: Odottamattomia merkkejä komennossa :let"
-#: ../eval.c:139
-#, c-format
-msgid "E121: Undefined variable: %s"
-msgstr "E121: Mrittelemtn muuttuja: %s"
-
-#: ../eval.c:140
msgid "E111: Missing ']'"
msgstr "E111: ] puuttuu"
-#: ../eval.c:141
#, c-format
msgid "E686: Argument of %s must be a List"
-msgstr "E686: Argumentin %s pit olla lista"
+msgstr "E686: Argumentin %s pitää olla lista"
# datarakenteita
-#: ../eval.c:143
#, c-format
msgid "E712: Argument of %s must be a List or Dictionary"
-msgstr "E712: Argumentin %s pit olla lista tai sanakirja"
-
-#: ../eval.c:144
-msgid "E713: Cannot use empty key for Dictionary"
-msgstr "E713: Sanakirjassa ei voi olla tyhji avaimia"
+msgstr "E712: Argumentin %s pitää olla lista tai sanakirja"
-#: ../eval.c:145
msgid "E714: List required"
msgstr "E714: Lista tarvitaan"
-#: ../eval.c:146
msgid "E715: Dictionary required"
msgstr "E715: Sanakirja tarvitaan"
-#: ../eval.c:147
+msgid "E928: String required"
+msgstr "E928: Merkkijono puuttuu"
+
#, c-format
msgid "E118: Too many arguments for function: %s"
msgstr "E118: Liikaa argumentteja funktiolle: %s"
-#: ../eval.c:148
#, c-format
msgid "E716: Key not present in Dictionary: %s"
msgstr "E716: Avainta %s ei ole sanakirjassa"
-#: ../eval.c:150
#, c-format
msgid "E122: Function %s already exists, add ! to replace it"
-msgstr "E122: Funktio %s on jo olemassa, lis ! korvataksesi"
+msgstr "E122: Funktio %s on jo olemassa, lisää ! korvataksesi"
-#: ../eval.c:151
msgid "E717: Dictionary entry already exists"
msgstr "E717: Sanakirja-alkio on jo olemassa"
-#: ../eval.c:152
msgid "E718: Funcref required"
msgstr "E718: Funcref tarvitaan"
-#: ../eval.c:153
msgid "E719: Cannot use [:] with a Dictionary"
-msgstr "E719: Sanakirjassa ei voi kytt merkint [:]"
+msgstr "E719: Sanakirjassa ei voi käyttää merkintää [:]"
-#: ../eval.c:154
-#, c-format
-msgid "E734: Wrong variable type for %s="
-msgstr "E734: Vr muuttujatyyppi muuttujalle %s="
-
-#: ../eval.c:155
#, c-format
msgid "E130: Unknown function: %s"
msgstr "E130: Tuntematon funktio: %s"
-#: ../eval.c:156
#, c-format
msgid "E461: Illegal variable name: %s"
msgstr "E461: Virheellinen muuttujanimi: %s"
-#: ../eval.c:157
-msgid "E806: using Float as a String"
-msgstr "E806: Float ei ky merkkijonosta"
+#, fuzzy, c-format
+#~ msgid "E46: Cannot change read-only variable \"%.*s\""
+#~ msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa"
+
+#. TODO(ZyX-I): move to eval/executor
+#, c-format
+msgid "E734: Wrong variable type for %s="
+msgstr "E734: Väärä muuttujatyyppi muuttujalle %s="
-#: ../eval.c:1830
msgid "E687: Less targets than List items"
-msgstr "E687: Kohteita on vhemmn kuin listan alkioita"
+msgstr "E687: Kohteita on vähemmän kuin listan alkioita"
-#: ../eval.c:1834
msgid "E688: More targets than List items"
-msgstr "E688: Kohteita on enemmn kuin listan alkioita"
+msgstr "E688: Kohteita on enemmän kuin listan alkioita"
-#: ../eval.c:1906
msgid "Double ; in list of variables"
-msgstr "Kaksi ;:tt listan muuttujissa"
+msgstr "Kaksi ;:ttä listan muuttujissa"
-#: ../eval.c:2078
#, c-format
msgid "E738: Can't list variables for %s"
msgstr "E738: Kohteen %s muuttujia ei voi listata"
-#: ../eval.c:2391
+#, fuzzy, c-format
+#~ msgid "E121: Undefined variable: %.*s"
+#~ msgstr "E121: Määrittelemätön muuttuja: %s"
+
msgid "E689: Can only index a List or Dictionary"
-msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksej"
+msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksejä"
-#: ../eval.c:2396
msgid "E708: [:] must come last"
-msgstr "E708: [:]:n pit olla viimeisen"
+msgstr "E708: [:]:n pitää olla viimeisenä"
+
+#, fuzzy
+#~ msgid "E713: Cannot use empty key after ."
+#~ msgstr "E713: Sanakirjassa ei voi olla tyhjiä avaimia"
-#: ../eval.c:2439
msgid "E709: [:] requires a List value"
msgstr "E709: [:] toimii vain listalla"
-#: ../eval.c:2674
msgid "E710: List value has more items than target"
-msgstr "E710: Listalla on enemmn alkioita kuin kohteella"
+msgstr "E710: Listalla on enemmän alkioita kuin kohteella"
-#: ../eval.c:2678
msgid "E711: List value has not enough items"
msgstr "E711: Listalla ei ole tarpeeksi alkioita"
-#: ../eval.c:2867
msgid "E690: Missing \"in\" after :for"
msgstr "E690: :for-kommenolta puuttuu in"
-#: ../eval.c:3063
#, c-format
msgid "E107: Missing parentheses: %s"
msgstr "E107: Sulkeita puuttuu: %s"
-#: ../eval.c:3263
#, c-format
msgid "E108: No such variable: \"%s\""
msgstr "E108: Muuttujaa %s ei ole"
-#: ../eval.c:3333
-msgid "E743: variable nested too deep for (un)lock"
-msgstr "E743: muuttujassa liian monta tasoa lukituksen ksittelyyn"
+#. For historical reasons this error is not given for Lists and
+#. Dictionaries. E.g. b: dictionary may be locked/unlocked.
+#, fuzzy, c-format
+#~ msgid "E940: Cannot lock or unlock variable %s"
+#~ msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa"
-#: ../eval.c:3630
msgid "E109: Missing ':' after '?'"
-msgstr "E109: ?:n jlkeen puuttuu :"
+msgstr "E109: ?:n jälkeen puuttuu :"
-#: ../eval.c:3893
msgid "E691: Can only compare List with List"
msgstr "E691: Listaa voi verrata vain listaan"
-#: ../eval.c:3895
-msgid "E692: Invalid operation for Lists"
+msgid "E692: Invalid operation for List"
msgstr "E692: Virheellinen toiminto listalle"
-#: ../eval.c:3915
msgid "E735: Can only compare Dictionary with Dictionary"
msgstr "E735: Sanakirjaa voi verrata vain sanakirjaan"
-#: ../eval.c:3917
msgid "E736: Invalid operation for Dictionary"
msgstr "E736: Virheellinen toiminto sanakirjalle"
-#: ../eval.c:3932
-msgid "E693: Can only compare Funcref with Funcref"
-msgstr "E693: Funcrefi voi verrata vain funcrefiin"
-
-#: ../eval.c:3934
msgid "E694: Invalid operation for Funcrefs"
msgstr "E694: Virheellinen toiminto funcrefille"
-#: ../eval.c:4277
msgid "E804: Cannot use '%' with Float"
-msgstr "E804: Ei voi kytt '%':a Floatin kanssa"
+msgstr "E804: Ei voi käyttää '%':a Floatin kanssa"
-#: ../eval.c:4478
msgid "E110: Missing ')'"
msgstr "E110: ) puuttuu"
-#: ../eval.c:4609
msgid "E695: Cannot index a Funcref"
-msgstr "E695: Funcrefi ei voi indeksoida"
+msgstr "E695: Funcrefiä ei voi indeksoida"
+
+msgid "E909: Cannot index a special variable"
+msgstr "E909: erikoismuuttujaa ei voi indeksoida"
-#: ../eval.c:4839
#, c-format
msgid "E112: Option name missing: %s"
msgstr "E112: Asetuksen nimi puuttuu: %s"
-#: ../eval.c:4855
#, c-format
msgid "E113: Unknown option: %s"
msgstr "E113: Tuntematon asetus: %s"
-#: ../eval.c:4904
#, c-format
msgid "E114: Missing quote: %s"
msgstr "E114: Puuttuva lainausmerkki: %s"
-#: ../eval.c:5020
#, c-format
msgid "E115: Missing quote: %s"
msgstr "E115: Puuttuva lainausmerkki: %s"
-#: ../eval.c:5084
#, c-format
msgid "E696: Missing comma in List: %s"
msgstr "E696: Listasta puuttuu pilkku: %s"
-#: ../eval.c:5091
#, c-format
msgid "E697: Missing end of List ']': %s"
msgstr "E697: Listan lopusta puuttuu ]: %s"
-#: ../eval.c:6475
+msgid "Not enough memory to set references, garbage collection aborted!"
+msgstr ""
+"Ei tarpeeksi muistia viitteiden asettamista varten, roskiekeruu peruttiin."
+
#, c-format
msgid "E720: Missing colon in Dictionary: %s"
msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s"
-#: ../eval.c:6499
#, c-format
msgid "E721: Duplicate key in Dictionary: \"%s\""
msgstr "E721: Kaksi samaa avainta sanakirjassa: %s"
-#: ../eval.c:6517
#, c-format
msgid "E722: Missing comma in Dictionary: %s"
msgstr "E722: Sanakirjasta puuttuu pilkku: %s"
-#: ../eval.c:6524
#, c-format
msgid "E723: Missing end of Dictionary '}': %s"
msgstr "E723: Sanakirjan lopusta puuttuu }: %s"
-#: ../eval.c:6555
-msgid "E724: variable nested too deep for displaying"
-msgstr "E724: muuttuja on upotettu liian syvlle nytettvksi"
+#, c-format
+msgid "E125: Illegal argument: %s"
+msgstr "E125: Virheellinen argumentti: %s"
+
+#, c-format
+msgid "E853: Duplicate argument name: %s"
+msgstr "E853: Kaksoiskappale argumentin nimestä: %s"
-#: ../eval.c:7188
#, c-format
msgid "E740: Too many arguments for function %s"
msgstr "E740: Liikaa argumentteja funktiolle %s"
-#: ../eval.c:7190
#, c-format
msgid "E116: Invalid arguments for function %s"
-msgstr "E116: Vri argumentteja funktiolle %s"
+msgstr "E116: Vääriä argumentteja funktiolle %s"
-#: ../eval.c:7377
#, c-format
msgid "E117: Unknown function: %s"
msgstr "E117: Tuntematon funktio: %s"
-#: ../eval.c:7383
+#, c-format
+msgid "E933: Function was deleted: %s"
+msgstr "E933: Funktion nimi poistettu: %s"
+
#, c-format
msgid "E119: Not enough arguments for function: %s"
msgstr "E119: Liikaa argumentteja funktiolle %s"
-#: ../eval.c:7387
#, c-format
msgid "E120: Using <SID> not in a script context: %s"
msgstr "E120: <SID> skriptin ulkopuolella: %s"
-#: ../eval.c:7391
#, c-format
msgid "E725: Calling dict function without Dictionary: %s"
msgstr "E725: dict-funktio ilman sanakirjaa: %s"
-#: ../eval.c:7453
-msgid "E808: Number or Float required"
-msgstr "E808: Number tai Float vaaditaan"
+#, fuzzy, c-format
+#~ msgid "Error converting the call result: %s"
+#~ msgstr "virhe Schemestä Vimiin konversiossa"
-#: ../eval.c:7503
-#, fuzzy
msgid "add() argument"
-msgstr "-c-argumentti"
+msgstr "add()-argumentti"
-#: ../eval.c:7907
msgid "E699: Too many arguments"
msgstr "E699: Liikaa argumentteja"
-#: ../eval.c:8073
msgid "E785: complete() can only be used in Insert mode"
-msgstr "E785: complete() toimii vain sytttilassa"
+msgstr "E785: complete() toimii vain syöttötilassa"
-#: ../eval.c:8156
msgid "&Ok"
msgstr "&Ok"
-#: ../eval.c:8676
-#, c-format
-msgid "E737: Key already exists: %s"
-msgstr "E737: Avain on jo olemassa: %s"
-
-#: ../eval.c:8692
#, fuzzy
+#~ msgid "dictwatcheradd() argument"
+#~ msgstr "add()-argumentti"
+
msgid "extend() argument"
-msgstr "--cmd-argumentti"
+msgstr "extend()-argumentti"
-#: ../eval.c:8915
-#, fuzzy
msgid "map() argument"
-msgstr "-c-argumentti"
+msgstr "map()-argumentti"
-#: ../eval.c:8916
-#, fuzzy
msgid "filter() argument"
-msgstr "-c-argumentti"
+msgstr "filter()-argumentti"
-#: ../eval.c:9229
-#, c-format
-msgid "+-%s%3ld lines: "
-msgstr "+-%s%3ld rivi: "
+#, fuzzy, c-format
+#~ msgid "+-%s%3ld lines: "
+#~ msgstr "+-%s%3ld rivi: "
-#: ../eval.c:9291
#, c-format
msgid "E700: Unknown function: %s"
msgstr "E700: Tuntematon funktio: %s"
-#: ../eval.c:10729
+msgid "E922: expected a dict"
+msgstr "E922: odotettiin dictiä"
+
+# datarakenteita
+msgid "E923: Second argument of function() must be a list or a dict"
+msgstr "E923: toisen function()-argumentin pitää olla lista tai sanakirja"
+
+#, fuzzy
+#~ msgid "E5000: Cannot find tab number."
+#~ msgstr "E695: Funcrefiä ei voi indeksoida"
+
+#~ msgid "E5001: Higher scope cannot be -1 if lower scope is >= 0."
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E5002: Cannot find window number."
+#~ msgstr "E671: Ikkunan otsikkoa ei löydy %s"
+
msgid "called inputrestore() more often than inputsave()"
msgstr "inputrestore() suoritettu useammin kuin inputsave()"
-#: ../eval.c:10771
-#, fuzzy
msgid "insert() argument"
-msgstr "-c-argumentti"
+msgstr "insert()-argumentti"
-#: ../eval.c:10841
msgid "E786: Range not allowed"
-msgstr "E786: Aluetta ei voi kytt"
+msgstr "E786: Aluetta ei voi käyttää"
+
+#~ msgid "Invalid stream on rpc job, use jobclose(id, 'rpc')"
+#~ msgstr ""
+
+#~ msgid "Invalid job stream: Not an rpc job"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "Invalid job stream \"%s\""
+#~ msgstr ""
+
+#~ msgid "Can't send data to the job: stdin is closed"
+#~ msgstr ""
+
+#~ msgid "Can't send raw data to rpc channel"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E474: Failed to convert list to string"
+#~ msgstr "ei voitu konvertoida tyypistä %s vim-listaksi"
+
+#, fuzzy, c-format
+#~ msgid "E474: Failed to parse %.*s"
+#~ msgstr "E241: Kohteeseen %s lähettäminen ei onnistunut"
-#: ../eval.c:11140
msgid "E701: Invalid type for len()"
msgstr "E701: Virheellinen tyyppi funktiolle len()"
-#: ../eval.c:11980
+#, fuzzy, c-format
+#~ msgid "msgpackdump() argument, index %i"
+#~ msgstr "map()-argumentti"
+
+#, fuzzy
+#~ msgid "E5070: Character number must not be less than zero"
+#~ msgstr "luvun on oltava nollaa suurempi"
+
+#, fuzzy, c-format
+#~ msgid "E5071: Character number must not be greater than INT_MAX (%i)"
+#~ msgstr "luvun on oltava nollaa suurempi"
+
msgid "E726: Stride is zero"
msgstr "E726: Stride on nolla"
-#: ../eval.c:11982
msgid "E727: Start past end"
-msgstr "E727: Alku on lopun jlkeen"
+msgstr "E727: Alku on lopun jälkeen"
-#: ../eval.c:12024 ../eval.c:15297
msgid "<empty>"
-msgstr "<tyhj>"
+msgstr "<tyhjä>"
-#: ../eval.c:12282
-#, fuzzy
msgid "remove() argument"
-msgstr "--cmd-argumentti"
+msgstr "remove()-argumentti"
-#: ../eval.c:12466
msgid "E655: Too many symbolic links (cycle?)"
-msgstr "E655: Liikaa symbolisia linkkej (mahdollinen sykli)"
+msgstr "E655: Liikaa symbolisia linkkejä (mahdollinen sykli)"
-#: ../eval.c:12593
-#, fuzzy
msgid "reverse() argument"
-msgstr "-c-argumentti"
+msgstr "reverse()-argumentti"
+
+#, c-format
+msgid "E927: Invalid action: '%s'"
+msgstr "E927: Viallinen toiminto: %s"
-#: ../eval.c:13721
-#, fuzzy
msgid "sort() argument"
-msgstr "-c-argumentti"
+msgstr "sort()-argumentti"
-#: ../eval.c:13721
-#, fuzzy
msgid "uniq() argument"
-msgstr "-c-argumentti"
+msgstr "uniq()-argumentti"
-#: ../eval.c:13776
msgid "E702: Sort compare function failed"
msgstr "E702: Lajittelun vertausfunktio ei onnistunut"
-#: ../eval.c:13806
-#, fuzzy
msgid "E882: Uniq compare function failed"
-msgstr "E702: Lajittelun vertausfunktio ei onnistunut"
+msgstr "E882: Uniqin vertausfunktio ei onnistunut"
-#: ../eval.c:14085
msgid "(Invalid)"
msgstr "(Virheellinen)"
-#: ../eval.c:14590
-msgid "E677: Error writing temp file"
-msgstr "E677: Vliaikaistiedostoon kirjoittaminen ei onnistunut"
+#, c-format
+msgid "E935: invalid submatch number: %d"
+msgstr "E935: Virheellinen alitäsmäyksen numero: %d"
-#: ../eval.c:16159
-msgid "E805: Using a Float as a Number"
-msgstr "E805: Float ei ky Numberista"
+#~ msgid "Can only call this function in an unmodified buffer"
+#~ msgstr ""
-#: ../eval.c:16162
-msgid "E703: Using a Funcref as a Number"
-msgstr "E703: Funcref ei ky Numberista"
+msgid "E921: Invalid callback argument"
+msgstr "E921: Virheellinen callback-argumentti"
-#: ../eval.c:16170
-msgid "E745: Using a List as a Number"
-msgstr "E745: Lista ei ky Numberista"
+#, fuzzy, c-format
+#~ msgid "E80: Error while writing: %s"
+#~ msgstr "E80: Kirjoitusvirhe"
-#: ../eval.c:16173
-msgid "E728: Using a Dictionary as a Number"
-msgstr "E728: Sanakirja ei ky Numberista"
+#. Using %s, p and not %c, *p to preserve multibyte characters
+#, fuzzy, c-format
+#~ msgid "E5060: Unknown flag: %s"
+#~ msgstr "E235: Tuntematon fontti: %s"
-#: ../eval.c:16259
-msgid "E729: using Funcref as a String"
-msgstr "E729: Funcref ei ky merkkijonosta"
+#, fuzzy
+#~ msgid "E482: Can't open file with an empty name"
+#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu"
-#: ../eval.c:16262
-msgid "E730: using List as a String"
-msgstr "E730: Lista ei ky merkkijonosta"
+#, fuzzy, c-format
+#~ msgid "E482: Can't open file %s for writing: %s"
+#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu"
-#: ../eval.c:16265
-msgid "E731: using Dictionary as a String"
-msgstr "E731: Sanakirja ei ky merkkijonosta"
+#, fuzzy, c-format
+#~ msgid "E80: Error when closing file %s: %s"
+#~ msgstr "E209: Virhe suljettaessa tiedostoa %s"
-#: ../eval.c:16619
-#, c-format
-msgid "E706: Variable type mismatch for: %s"
-msgstr "E706: Muuttujatyyppi ei tsm: %s"
+#, fuzzy, c-format
+#~ msgid "E794: Cannot set variable in the sandbox: \"%.*s\""
+#~ msgstr "E794: Muuttujaa ei voi asettaa hiekkalaatikossa: %s"
-#: ../eval.c:16705
-#, c-format
-msgid "E795: Cannot delete variable %s"
-msgstr "E795: Muuttujaa %s ei voi poistaa"
+#, fuzzy, c-format
+#~ msgid "E795: Cannot delete variable %.*s"
+#~ msgstr "E795: Muuttujaa %s ei voi poistaa"
-#: ../eval.c:16724
#, c-format
msgid "E704: Funcref variable name must start with a capital: %s"
-msgstr "E704: Funcrefin muuttujanimen pit alkaa suuraakkosella: %s"
+msgstr "E704: Funcrefin muuttujanimen pitää alkaa suuraakkosella: %s"
-#: ../eval.c:16732
#, c-format
msgid "E705: Variable name conflicts with existing function: %s"
msgstr "E705: Muuttujanimi on sama kuin olemassaolevan funktion: %s"
-#: ../eval.c:16763
-#, c-format
-msgid "E741: Value is locked: %s"
-msgstr "E741: Arvo on lukittu: %s"
-
-#: ../eval.c:16764 ../eval.c:16769 ../message.c:1839
-msgid "Unknown"
-msgstr "Tuntematon"
-
-#: ../eval.c:16768
-#, c-format
-msgid "E742: Cannot change value of %s"
-msgstr "E742: Ei voi muuttaa muuttujan %s arvoa"
-
-#: ../eval.c:16838
msgid "E698: variable nested too deep for making a copy"
-msgstr "E698: muuttuja on upotettu liian syvlle kopioitavaksi"
+msgstr "E698: muuttuja on upotettu liian syvälle kopioitavaksi"
-#: ../eval.c:17249
#, c-format
msgid "E123: Undefined function: %s"
msgstr "E123: Tuntematon funktio: %s"
-#: ../eval.c:17260
#, c-format
msgid "E124: Missing '(': %s"
msgstr "E124: ( puuttuu: %s"
-#: ../eval.c:17293
-#, fuzzy
msgid "E862: Cannot use g: here"
-msgstr "E284: Ei voi asettaa IC-arvoja"
+msgstr "E862: g: ei toimi täällä"
-#: ../eval.c:17312
-#, c-format
-msgid "E125: Illegal argument: %s"
-msgstr "E125: Virheellinen argumentti: %s"
-
-#: ../eval.c:17323
#, fuzzy, c-format
-msgid "E853: Duplicate argument name: %s"
-msgstr "Kaksoiskappale kentn nimest: %s"
+#~ msgid "E932: Closure function should not be at top level: %s"
+#~ msgstr "E932 Sulkeumafunktio ei voi olla uloimmalla tasolla: %s"
-#: ../eval.c:17416
msgid "E126: Missing :endfunction"
msgstr "E126: :endfunction puuttuu"
-#: ../eval.c:17537
#, c-format
msgid "E707: Function name conflicts with variable: %s"
msgstr "E707: Funktion nimi on ristiriidassa muuttujan kanssa: %s"
-#: ../eval.c:17549
#, c-format
msgid "E127: Cannot redefine function %s: It is in use"
-msgstr "E127: Funktiota %s ei voi mritell uudestaan, koska se on kytss"
+msgstr "E127: Funktiota %s ei voi määritellä uudestaan, koska se on käytössä"
-#: ../eval.c:17604
#, c-format
msgid "E746: Function name does not match script file name: %s"
msgstr "E746: Funktion nimi ei ole sama kuin skriptin tiedostonnimi: %s"
-#: ../eval.c:17716
msgid "E129: Function name required"
msgstr "E129: Funktion nimi puuttuu"
-#: ../eval.c:17824
-#, fuzzy, c-format
+#, c-format
msgid "E128: Function name must start with a capital or \"s:\": %s"
-msgstr ""
-"E128: Funktion nimen pit alkaa suuraakkosella tai sislt kaksoispisteen: "
-"%s"
+msgstr "E128: Funktion nimen pitää alkaa suuraakkosella tai merkeillä ’s:’: %s"
-#: ../eval.c:17833
-#, fuzzy, c-format
+#, c-format
msgid "E884: Function name cannot contain a colon: %s"
-msgstr ""
-"E128: Funktion nimen pit alkaa suuraakkosella tai sislt kaksoispisteen: "
-"%s"
+msgstr "E884: Funktion nimessä ei saa olla kaksoispistettä: %s"
-#: ../eval.c:18336
#, c-format
msgid "E131: Cannot delete function %s: It is in use"
msgstr "E131: Funktiota %s ei voi poistaa"
-#: ../eval.c:18441
+#, fuzzy, c-format
+#~ msgid "Cannot delete function %s: It is being used internally"
+#~ msgstr "E131: Funktiota %s ei voi poistaa"
+
msgid "E132: Function call depth is higher than 'maxfuncdepth'"
-msgstr "E132: Funktiokutsujen syvyys on enemmn kuin maxfuncdepth"
+msgstr "E132: Funktiokutsujen syvyys on enemmän kuin maxfuncdepth"
-#: ../eval.c:18568
#, c-format
msgid "calling %s"
msgstr "kutsutaan funktiota %s"
-#: ../eval.c:18651
#, c-format
msgid "%s aborted"
msgstr "%s keskeytettiin"
-#: ../eval.c:18653
-#, c-format
-msgid "%s returning #%<PRId64>"
-msgstr "%s palaa kohdassa #%<PRId64>"
+#, fuzzy, c-format
+#~ msgid "%s returning #%<PRId64>"
+#~ msgstr "%s palaa kohdassa #%ld"
-#: ../eval.c:18670
#, c-format
msgid "%s returning %s"
msgstr "%s palaa kohdassa %s"
-#: ../eval.c:18691 ../ex_cmds2.c:2695
#, c-format
msgid "continuing in %s"
msgstr "jatkaa kohdassa %s"
-#: ../eval.c:18795
msgid "E133: :return not inside a function"
-msgstr "E133: :return ei ole funktion sisll"
+msgstr "E133: :return ei ole funktion sisällä"
-#: ../eval.c:19159
-msgid ""
-"\n"
-"# global variables:\n"
-msgstr ""
-"\n"
-"# globaalit muuttujat:\n"
-
-#: ../eval.c:19254
msgid ""
"\n"
"\tLast set from "
@@ -1045,154 +1091,396 @@ msgstr ""
"\n"
"\tViimeksi asetettu kohteesta "
-#: ../eval.c:19272
msgid "No old files"
msgstr "Ei vanhoja tiedostoja"
-# puhutaan merkin ulkoasusta snprintf(..., c, c, c, c)
-#: ../ex_cmds.c:122
#, c-format
-msgid "<%s>%s%s %d, Hex %02x, Octal %03o"
-msgstr "<%s>%s%s %d, heksana %02x, oktaalina %03o"
+#~ msgid "E474: Expected comma before list item: %s"
+#~ msgstr ""
-#: ../ex_cmds.c:145
#, c-format
-msgid "> %d, Hex %04x, Octal %o"
-msgstr "> %d, heksana %04x, oktaalina %o"
+#~ msgid "E474: Expected colon before dictionary value: %s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected string key: %s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected comma before dictionary key: %s"
+#~ msgstr "E722: Sanakirjasta puuttuu pilkku: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Unfinished escape sequence: %.*s"
+#~ msgstr "E540: Sulkematon lausekesarja"
-#: ../ex_cmds.c:146
#, c-format
-msgid "> %d, Hex %08x, Octal %o"
-msgstr "> %d, hekdana %08x, oktaalina %o"
+#~ msgid "E474: Unfinished unicode escape sequence: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:684
-msgid "E134: Move lines into themselves"
-msgstr "E134: Rivien siirto itsejens plle"
+#, c-format
+#~ msgid "E474: Expected four hex digits after \\u: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:747
-msgid "1 line moved"
-msgstr "1 rivi siirretty"
+#, fuzzy, c-format
+#~ msgid "E474: Unknown escape sequence: %.*s"
+#~ msgstr "E409: Tuntematon ryhmän nimi: %s"
-#: ../ex_cmds.c:749
#, c-format
-msgid "%<PRId64> lines moved"
-msgstr "%<PRId64> rivi siirretty"
+#~ msgid "E474: ASCII control characters cannot be present inside string: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1175
#, c-format
-msgid "%<PRId64> lines filtered"
-msgstr "%<PRId64> rivi suodatettu"
+#~ msgid "E474: Only UTF-8 strings allowed: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1194
-msgid "E135: *Filter* Autocommands must not change current buffer"
-msgstr "E135: *Filter*-autocommand ei voi vaihtaa puskuria"
+#, c-format
+#~ msgid ""
+#~ "E474: Only UTF-8 code points up to U+10FFFF are allowed to appear unescaped: "
+#~ "%.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1244
-msgid "[No write since last change]\n"
-msgstr "[Viimeisint muutosta ei ole kirjoitettu]\n"
+#, fuzzy, c-format
+#~ msgid "E474: Expected string end: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Leading zeroes are not allowed: %.*s"
+#~ msgstr "E786: Aluetta ei voi käyttää"
+
+#, fuzzy, c-format
+#~ msgid "E474: Missing number after minus sign: %.*s"
+#~ msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen"
+
+#, fuzzy, c-format
+#~ msgid "E474: Missing number after decimal dot: %.*s"
+#~ msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen"
+
+#, fuzzy, c-format
+#~ msgid "E474: Missing exponent: %.*s"
+#~ msgstr "E114: Puuttuva lainausmerkki: %s"
-#: ../ex_cmds.c:1424
#, c-format
-msgid "%sviminfo: %s in line: "
-msgstr "%sviminfo: %s rivill: "
+#~ msgid ""
+#~ "E685: internal error: while converting number \"%.*s\" to float string2float "
+#~ "consumed %zu bytes in place of %zu"
+#~ msgstr ""
-#: ../ex_cmds.c:1431
-msgid "E136: viminfo: Too many errors, skipping rest of file"
-msgstr "E136: viminfo: liikaa virheit, ohitetaan lopputiedosto"
+#, c-format
+#~ msgid ""
+#~ "E685: internal error: while converting number \"%.*s\" to integer vim_str2nr "
+#~ "consumed %i bytes in place of %zu"
+#~ msgstr ""
+
+#~ msgid "E474: Attempt to decode a blank string"
+#~ msgstr ""
-#: ../ex_cmds.c:1458
#, c-format
-msgid "Reading viminfo file \"%s\"%s%s%s"
-msgstr "Luetaan viminfo-tiedostoa \"%s\"%s%s%s"
+#~ msgid "E474: No container to close: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1460
-msgid " info"
-msgstr " info"
+#, c-format
+#~ msgid "E474: Closing list with curly bracket: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1461
-msgid " marks"
-msgstr " merkit"
+#, fuzzy, c-format
+#~ msgid "E474: Closing dictionary with square bracket: %.*s"
+#~ msgstr "E725: dict-funktio ilman sanakirjaa: %s"
-#: ../ex_cmds.c:1462
-msgid " oldfiles"
-msgstr " vanhaatiedostoa"
+#, fuzzy, c-format
+#~ msgid "E474: Trailing comma: %.*s"
+#~ msgstr "E488: Ylimääräisiä merkkejä perässä"
-#: ../ex_cmds.c:1463
-msgid " FAILED"
-msgstr " EPONNISTUI"
+#, c-format
+#~ msgid "E474: Expected value after colon: %.*s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected value: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
-#. avoid a wait_return for this message, it's annoying
-#: ../ex_cmds.c:1541
#, c-format
-msgid "E137: Viminfo file is not writable: %s"
-msgstr "E137: Viminfo-tiedostoon ei voitu kirjoittaa: %s"
+#~ msgid "E474: Comma not inside container: %.*s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E474: Duplicate comma: %.*s"
+#~ msgstr "E721: Kaksi samaa avainta sanakirjassa: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Comma after colon: %.*s"
+#~ msgstr "E254: Väriä %s ei voi määritellä"
+
+#, fuzzy, c-format
+#~ msgid "E474: Using comma in place of colon: %.*s"
+#~ msgstr "E722: Sanakirjasta puuttuu pilkku: %s"
-#: ../ex_cmds.c:1626
#, c-format
-msgid "E138: Can't write viminfo file %s!"
-msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s"
+#~ msgid "E474: Leading comma: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1635
#, c-format
-msgid "Writing viminfo file \"%s\""
-msgstr "Kirjoitetaan viminfo-tiedostoa %s"
+#~ msgid "E474: Colon not inside container: %.*s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E474: Using colon not in dictionary: %.*s"
+#~ msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Unexpected colon: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
-#. Write the info:
-#: ../ex_cmds.c:1720
#, c-format
-msgid "# This viminfo file was generated by Vim %s.\n"
-msgstr "# Vimin %s generoima viminfo-tiedosto.\n"
+#~ msgid "E474: Colon after comma: %.*s"
+#~ msgstr ""
-#: ../ex_cmds.c:1722
-msgid ""
-"# You may edit it if you're careful!\n"
-"\n"
-msgstr ""
-"# Muokkaa varovasti!\n"
-"\n"
+#, fuzzy, c-format
+#~ msgid "E474: Duplicate colon: %.*s"
+#~ msgstr "E721: Kaksi samaa avainta sanakirjassa: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected null: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected true: %.*s"
+#~ msgstr "E270: odotuksenvastainen redo"
+
+#, fuzzy, c-format
+#~ msgid "E474: Expected false: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
-#: ../ex_cmds.c:1723
-msgid "# Value of 'encoding' when this file was written\n"
-msgstr "# encoding-muuttujan arvo tiedostoa kirjoitettaessa\n"
+#, fuzzy, c-format
+#~ msgid "E474: Unidentified byte: %.*s"
+#~ msgstr "E121: Määrittelemätön muuttuja: %s"
-#: ../ex_cmds.c:1800
-msgid "Illegal starting char"
-msgstr "Virheellinen aloitusmerkki"
+#, fuzzy, c-format
+#~ msgid "E474: Trailing characters: %.*s"
+#~ msgstr "E488: Ylimääräisiä merkkejä perässä"
+
+#, fuzzy, c-format
+#~ msgid "E474: Unexpected end of input: %.*s"
+#~ msgstr "E415: odotuksenvastainen =-merkki: %s"
+
+#, c-format
+#~ msgid "key %s"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "key %s at index %i from special map"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "index %i"
+#~ msgstr ""
+
+#~ msgid "partial"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "argument %i"
+#~ msgstr "-c-argumentti"
+
+#, fuzzy
+#~ msgid "partial self dictionary"
+#~ msgstr "ei voida muuttaa kiinnitettyä sanakirjaa"
+
+#~ msgid "itself"
+#~ msgstr ""
+
+#. Only give this message once for a recursive call to avoid
+#. flooding the user with errors.
+#~ msgid "E724: unable to correctly dump variable with self-referencing container"
+#~ msgstr ""
+
+#~ msgid "E474: Unable to represent NaN value in JSON"
+#~ msgstr ""
+
+#~ msgid "E474: Unable to represent infinity in JSON"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "E474: String \"%.*s\" contains byte that does not start any UTF-8 character"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "E474: UTF-8 string contains code point which belongs to a surrogate pair: "
+#~ "%.*s"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E474: Unable to convert EXT string to JSON"
+#~ msgstr "E620: Tulostuskoodaukseen %s muunto ei onnistu"
+
+#, c-format
+#~ msgid "E474: Error while dumping %s, %s: attempt to dump function reference"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E474: Invalid key in special dictionary"
+#~ msgstr "E736: Virheellinen toiminto sanakirjalle"
+
+#, c-format
+#~ msgid "E5004: Error while dumping %s, %s: attempt to dump function reference"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "E5005: Unable to dump %s: container references itself in %s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E684: list index out of range: %<PRId64>"
+#~ msgstr "E684: Indeksi %ld luettelon rajojen ulkopuolella"
+
+#~ msgid "E6000: Argument is not a function or function name"
+#~ msgstr ""
+
+#, c-format
+msgid "E737: Key already exists: %s"
+msgstr "E737: Avain on jo olemassa: %s"
+
+#, fuzzy
+#~ msgid "tv_clear() argument"
+#~ msgstr "filter()-argumentti"
+
+msgid "E743: variable nested too deep for (un)lock"
+msgstr "E743: muuttujassa liian monta tasoa lukituksen käsittelyyn"
+
+#, fuzzy, c-format
+#~ msgid "E741: Value is locked: %.*s"
+#~ msgstr "E741: Arvo on lukittu: %s"
+
+#, fuzzy, c-format
+#~ msgid "E742: Cannot change value of %.*s"
+#~ msgstr "E742: Ei voi muuttaa muuttujan %s arvoa"
+
+msgid "Unknown"
+msgstr "Tuntematon"
+
+#, fuzzy
+#~ msgid "E805: Expected a Number or a String, Float found"
+#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle"
+
+#~ msgid "E703: Expected a Number or a String, Funcref found"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E745: Expected a Number or a String, List found"
+#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle"
+
+#~ msgid "E728: Expected a Number or a String, Dictionary found"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "E5300: Expected a Number or a String"
+#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle"
+
+msgid "E745: Using a List as a Number"
+msgstr "E745: Lista ei käy Numberista"
+
+msgid "E728: Using a Dictionary as a Number"
+msgstr "E728: Sanakirja ei käy Numberista"
+
+msgid "E805: Using a Float as a Number"
+msgstr "E805: Float ei käy Numberista"
+
+#, fuzzy
+#~ msgid "E685: using an invalid value as a Number"
+#~ msgstr "E908: huono arvo merkkijonolle"
+
+msgid "E730: using List as a String"
+msgstr "E730: Lista ei käy merkkijonosta"
+
+msgid "E731: using Dictionary as a String"
+msgstr "E731: Sanakirja ei käy merkkijonosta"
+
+msgid "E908: using an invalid value as a String"
+msgstr "E908: huono arvo merkkijonolle"
+
+msgid "E891: Using a Funcref as a Float"
+msgstr "E891: Funcref ei käy Floatista"
+
+msgid "E892: Using a String as a Float"
+msgstr "E892: String ei käy Floatista"
+
+msgid "E893: Using a List as a Float"
+msgstr "E893: Lista ei käy Floatista"
+
+msgid "E894: Using a Dictionary as a Float"
+msgstr "E894: Sanakirja ei käy Floatista"
+
+msgid "E907: Using a special value as a Float"
+msgstr "E907: Käytettiin erikoisarvoa Floattina"
+
+msgid "E808: Number or Float required"
+msgstr "E808: Number tai Float vaaditaan"
+
+# puhutaan merkin ulkoasusta snprintf(..., c, c, c, c)
+#, c-format
+msgid "<%s>%s%s %d, Hex %02x, Octal %03o"
+msgstr "<%s>%s%s %d, heksana %02x, oktaalina %03o"
+
+#, c-format
+msgid "> %d, Hex %04x, Octal %o"
+msgstr "> %d, heksana %04x, oktaalina %o"
+
+#, c-format
+msgid "> %d, Hex %08x, Octal %o"
+msgstr "> %d, hekdana %08x, oktaalina %o"
+
+msgid "E134: Move lines into themselves"
+msgstr "E134: Rivien siirto itsejensä päälle"
+
+msgid "1 line moved"
+msgstr "1 rivi siirretty"
+
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines moved"
+#~ msgstr "%ld riviä siirretty"
+
+#, c-format
+msgid "E482: Can't create file %s"
+msgstr "E482: Tiedostoa %s ei voi luoda"
+
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines filtered"
+#~ msgstr "%ld riviä suodatettu"
+
+msgid "E135: *Filter* Autocommands must not change current buffer"
+msgstr "E135: *Filter*-autocommand ei voi vaihtaa puskuria"
+
+msgid "[No write since last change]\n"
+msgstr "[Viimeisintä muutosta ei ole kirjoitettu]\n"
-#: ../ex_cmds.c:2162
msgid "Write partial file?"
msgstr "Kirjoita osittainen tiedosto"
-#: ../ex_cmds.c:2166
msgid "E140: Use ! to write partial buffer"
-msgstr "E140: Kyt !-komentoa osittaisen puskurin kirjoittamiseen"
+msgstr "E140: Käytä !-komentoa osittaisen puskurin kirjoittamiseen"
-#: ../ex_cmds.c:2281
#, c-format
msgid "Overwrite existing file \"%s\"?"
msgstr "Ylikirjoitetaanko olemassaoleva tiedosto %s?"
-#: ../ex_cmds.c:2317
#, c-format
msgid "Swap file \"%s\" exists, overwrite anyway?"
msgstr "Swap-tiedosto %s on olemassa, ylikirjoitetaanko?"
-#: ../ex_cmds.c:2326
#, c-format
msgid "E768: Swap file exists: %s (:silent! overrides)"
msgstr "E768: Swap-tiedosto on jo olemassa: %s (komento :silent! ohittaa)"
-#: ../ex_cmds.c:2381
-#, c-format
-msgid "E141: No file name for buffer %<PRId64>"
-msgstr "E141: Ei tiedostonime puskurille %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "E141: No file name for buffer %<PRId64>"
+#~ msgstr "E141: Ei tiedostonimeä puskurille %ld"
-#: ../ex_cmds.c:2412
msgid "E142: File not written: Writing is disabled by 'write' option"
msgstr ""
-"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen kytst"
+"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen käytöstä"
-#: ../ex_cmds.c:2434
#, c-format
msgid ""
"'readonly' option is set for \"%s\".\n"
@@ -1201,7 +1489,6 @@ msgstr ""
"readonly asetettu tiedostolle \"%s\".\n"
"Kirjoitetaanko?"
-#: ../ex_cmds.c:2439
#, c-format
msgid ""
"File permissions of \"%s\" are read-only.\n"
@@ -1210,799 +1497,599 @@ msgid ""
msgstr ""
"Tiedosto %s on kirjoitussuojattu.\n"
"Siihen saattaa voida silti kirjoittaa.\n"
-"Yritetnk?"
+"Yritetäänkö?"
-#: ../ex_cmds.c:2451
#, c-format
msgid "E505: \"%s\" is read-only (add ! to override)"
-msgstr "E505: %s on kirjoitussuojattu (lis komentoon ! ohittaaksesi)"
+msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)"
-#: ../ex_cmds.c:3120
#, c-format
msgid "E143: Autocommands unexpectedly deleted new buffer %s"
msgstr "E143: Autocommand poisti uuden puskurin odotuksen vastaisesti %s"
-#: ../ex_cmds.c:3313
msgid "E144: non-numeric argument to :z"
msgstr "E144: :z:n argumentti ei ole numero"
-#: ../ex_cmds.c:3404
-msgid "E145: Shell commands not allowed in rvim"
-msgstr "E145: Kuoren komennot eivt toimi rvimiss"
+#, fuzzy
+#~ msgid "E145: Shell commands not allowed in restricted mode"
+#~ msgstr "E145: Kuoren komennot eivät toimi rvimissä"
-#: ../ex_cmds.c:3498
msgid "E146: Regular expressions can't be delimited by letters"
-msgstr "E146: Snnllist ilmausta ei voi rajata kirjaimilla"
+msgstr "E146: Säännöllistä ilmausta ei voi rajata kirjaimilla"
-#: ../ex_cmds.c:3964
#, c-format
msgid "replace with %s (y/n/a/q/l/^E/^Y)?"
msgstr "korvaa kohteella %s (y/n/a/q/l/^E/^Y)?"
-#: ../ex_cmds.c:4379
msgid "(Interrupted) "
msgstr "(Keskeytetty)"
-#: ../ex_cmds.c:4384
msgid "1 match"
-msgstr "1 tsmys"
+msgstr "1 täsmäys"
-#: ../ex_cmds.c:4384
msgid "1 substitution"
msgstr "1 korvaus"
-#: ../ex_cmds.c:4387
-#, c-format
-msgid "%<PRId64> matches"
-msgstr "%<PRId64> tsmyst"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> matches"
+#~ msgstr "%ld täsmäystä"
-#: ../ex_cmds.c:4388
-#, c-format
-msgid "%<PRId64> substitutions"
-msgstr "%<PRId64> korvausta"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> substitutions"
+#~ msgstr "%ld korvausta"
-#: ../ex_cmds.c:4392
msgid " on 1 line"
-msgstr " 1 rivill"
+msgstr " 1 rivillä"
-#: ../ex_cmds.c:4395
-#, c-format
-msgid " on %<PRId64> lines"
-msgstr " %<PRId64> rivill"
+#, fuzzy, c-format
+#~ msgid " on %<PRId64> lines"
+#~ msgstr " %ld rivillä"
-#: ../ex_cmds.c:4438
msgid "E147: Cannot do :global recursive"
msgstr "E147: :globalia ei voi suorittaa rekursiivisesti"
-#: ../ex_cmds.c:4467
msgid "E148: Regular expression missing from global"
-msgstr "E148: Snnllinen ilmaus puuttuu globaalista"
+msgstr "E148: Säännöllinen ilmaus puuttuu globaalista"
-#: ../ex_cmds.c:4508
#, c-format
msgid "Pattern found in every line: %s"
-msgstr "Kuvio lytyi joka rivilt: %s"
+msgstr "Kuvio löytyi joka riviltä: %s"
-#: ../ex_cmds.c:4510
-#, fuzzy, c-format
+#, c-format
msgid "Pattern not found: %s"
-msgstr "Kuviota ei lydy"
-
-#: ../ex_cmds.c:4587
-msgid ""
-"\n"
-"# Last Substitute String:\n"
-"$"
-msgstr ""
-"\n"
-"# Viimeisin korvausmerkkijono:\n"
-"$"
+msgstr "Kuviota ei löydy: %s"
-#: ../ex_cmds.c:4679
msgid "E478: Don't panic!"
-msgstr "E478: l panikoi."
+msgstr "E478: Älä panikoi."
-#: ../ex_cmds.c:4717
#, c-format
msgid "E661: Sorry, no '%s' help for %s"
-msgstr "E661: Sori, ei lydy %s-ohjetta kohteelle %s"
+msgstr "E661: ei löydy %s-ohjetta kohteelle %s"
-#: ../ex_cmds.c:4719
#, c-format
msgid "E149: Sorry, no help for %s"
-msgstr "E149: Sori, ei lydy ohjetta kohteelle %s"
+msgstr "E149: ei löydy ohjetta kohteelle %s"
-#: ../ex_cmds.c:4751
#, c-format
msgid "Sorry, help file \"%s\" not found"
-msgstr "Sori, ohjetiedostoa %s ei lydy"
+msgstr "ohjetiedostoa %s ei löydy"
-#: ../ex_cmds.c:5323
-#, c-format
-msgid "E150: Not a directory: %s"
-msgstr "E150: Ei ole hakemisto: %s"
-
-#: ../ex_cmds.c:5446
#, c-format
msgid "E152: Cannot open %s for writing"
msgstr "E152: Ei voi avata tiedostoa %s kirjoittamista varten"
-#: ../ex_cmds.c:5471
#, c-format
msgid "E153: Unable to open %s for reading"
msgstr "E153: Ei voi avata tiedostoa %s lukemista varten"
-#: ../ex_cmds.c:5500
#, c-format
msgid "E670: Mix of help file encodings within a language: %s"
-msgstr "E670: Monia ohjetiedostokoodauksia kieless: %s"
+msgstr "E670: Monia ohjetiedostokoodauksia kielessä: %s"
-#: ../ex_cmds.c:5565
#, c-format
msgid "E154: Duplicate tag \"%s\" in file %s/%s"
-msgstr "E154: Kaksoiskappale tgist %s tiedostossa %s/%s"
+msgstr "E154: Kaksoiskappale tägistä %s tiedostossa %s/%s"
+
+#, c-format
+msgid "E150: Not a directory: %s"
+msgstr "E150: Ei ole hakemisto: %s"
-#: ../ex_cmds.c:5687
#, c-format
msgid "E160: Unknown sign command: %s"
msgstr "E160: Tuntematon merkkikomento: %s"
-#: ../ex_cmds.c:5704
msgid "E156: Missing sign name"
msgstr "E156: Merkki puuttuu"
-#: ../ex_cmds.c:5746
msgid "E612: Too many signs defined"
-msgstr "E612: Liikaa merkkej mritelty"
+msgstr "E612: Liikaa merkkejä määritelty"
-#: ../ex_cmds.c:5813
#, c-format
msgid "E239: Invalid sign text: %s"
msgstr "E239: Virheellinen merkkiteksti: %s"
-#: ../ex_cmds.c:5844 ../ex_cmds.c:6035
#, c-format
msgid "E155: Unknown sign: %s"
msgstr "E155: Tuntematon merkki: %s"
-#: ../ex_cmds.c:5877
msgid "E159: Missing sign number"
msgstr "E159: Merkin numero puuttuu"
-#: ../ex_cmds.c:5971
#, c-format
msgid "E158: Invalid buffer name: %s"
msgstr "E158: Virheellinen puskurin nimi: %s"
-#: ../ex_cmds.c:6008
+msgid "E934: Cannot jump to a buffer that does not have a name"
+msgstr "E934: Ei voida hypätä puskuriin jolla ei ole nimeä"
+
+#, fuzzy, c-format
+#~ msgid "E157: Invalid sign ID: %<PRId64>"
+#~ msgstr "E157: Virheellinen merkin tunnus: %ld"
+
#, c-format
-msgid "E157: Invalid sign ID: %<PRId64>"
-msgstr "E157: Virheellinen merkin tunnus: %<PRId64>"
+msgid "E885: Not possible to change sign %s"
+msgstr "E885: Ei voida muuttaa merkkiä %s"
-#: ../ex_cmds.c:6066
msgid " (not supported)"
msgstr " (ei tuettu)"
-#: ../ex_cmds.c:6169
msgid "[Deleted]"
msgstr "[Poistettu]"
-#: ../ex_cmds2.c:139
msgid "Entering Debug mode. Type \"cont\" to continue."
-msgstr "Siirrytn vianetsinttilaan, kirjoita cont jatkaaksesi."
+msgstr "Siirrytään vianetsintätilaan, kirjoita cont jatkaaksesi."
-#: ../ex_cmds2.c:143 ../ex_docmd.c:759
-#, c-format
-msgid "line %<PRId64>: %s"
-msgstr "rivi %<PRId64>: %s"
+#, fuzzy, c-format
+#~ msgid "line %<PRId64>: %s"
+#~ msgstr "rivi %ld: %s"
-#: ../ex_cmds2.c:145
#, c-format
msgid "cmd: %s"
msgstr "kmnt: %s"
-#: ../ex_cmds2.c:322
+msgid "frame is zero"
+msgstr "kehys on nolla"
+
#, c-format
-msgid "Breakpoint in \"%s%s\" line %<PRId64>"
-msgstr "Katkaisukohta %s%s rivill %<PRId64>"
+msgid "frame at highest level: %d"
+msgstr "kehys ylimmällä tasolla: %d"
+
+#, fuzzy, c-format
+#~ msgid "Breakpoint in \"%s%s\" line %<PRId64>"
+#~ msgstr "Katkaisukohta %s%s rivillä %ld"
-#: ../ex_cmds2.c:581
#, c-format
msgid "E161: Breakpoint not found: %s"
msgstr "E161: Katkaisukohta puuttuu: %s"
-#: ../ex_cmds2.c:611
msgid "No breakpoints defined"
msgstr "Ei katkaisukohtia"
-#: ../ex_cmds2.c:617
-#, c-format
-msgid "%3d %s %s line %<PRId64>"
-msgstr "%3d %s %s rivi %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "%3d %s %s line %<PRId64>"
+#~ msgstr "%3d %s %s rivi %ld"
-#: ../ex_cmds2.c:942
msgid "E750: First use \":profile start {fname}\""
-msgstr "E750: Aloita kskyll :profile start {fname}"
+msgstr "E750: Aloita käskyllä :profile start {fname}"
-#: ../ex_cmds2.c:1269
#, c-format
msgid "Save changes to \"%s\"?"
msgstr "Tallennetaanko muutokset tiedostoon %s?"
-#: ../ex_cmds2.c:1271 ../ex_docmd.c:8851
msgid "Untitled"
-msgstr "Nimetn"
+msgstr "Nimetön"
-#: ../ex_cmds2.c:1421
#, c-format
msgid "E162: No write since last change for buffer \"%s\""
-msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jlkeen"
+msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jälkeen"
-#: ../ex_cmds2.c:1480
msgid "Warning: Entered other buffer unexpectedly (check autocommands)"
msgstr "Varoitus: Puskuri vaihtui odottamatta (tarkista autocommands)"
-#: ../ex_cmds2.c:1826
msgid "E163: There is only one file to edit"
msgstr "E163: Vain yksi tiedosto muokattavana"
-#: ../ex_cmds2.c:1828
msgid "E164: Cannot go before first file"
-msgstr "E164: Ensimmisen tiedoston ohi ei voi menn"
+msgstr "E164: Ensimmäisen tiedoston ohi ei voi mennä"
-#: ../ex_cmds2.c:1830
msgid "E165: Cannot go beyond last file"
-msgstr "E165: Viimeisen tiedoston ohi ei voi menn"
+msgstr "E165: Viimeisen tiedoston ohi ei voi mennä"
-#: ../ex_cmds2.c:2175
#, c-format
msgid "E666: compiler not supported: %s"
-msgstr "E666: kntj ei tueta: %s"
+msgstr "E666: kääntäjää ei tueta: %s"
-#: ../ex_cmds2.c:2257
#, c-format
msgid "Searching for \"%s\" in \"%s\""
-msgstr "Etsitn ilmausta %s kohteesta %s"
+msgstr "Etsitään ilmausta %s kohteesta %s"
-#: ../ex_cmds2.c:2284
#, c-format
msgid "Searching for \"%s\""
-msgstr "Etsitn ilmausta %s"
+msgstr "Etsitään ilmausta %s"
-#: ../ex_cmds2.c:2307
#, c-format
-msgid "not found in 'runtimepath': \"%s\""
-msgstr "ei lydy runtimepathista: %s"
+msgid "not found in '%s': \"%s\""
+msgstr "'%s' ei löydy kohteesta: %s"
-#: ../ex_cmds2.c:2472
#, c-format
msgid "Cannot source a directory: \"%s\""
msgstr "Hakemistoa ei voi ladata: %s"
-#: ../ex_cmds2.c:2518
#, c-format
msgid "could not source \"%s\""
msgstr "ei voitu ladata %s"
-#: ../ex_cmds2.c:2520
-#, c-format
-msgid "line %<PRId64>: could not source \"%s\""
-msgstr "rivi %<PRId64>: ei voitu ladata %s"
+#, fuzzy, c-format
+#~ msgid "line %<PRId64>: could not source \"%s\""
+#~ msgstr "rivi %ld: ei voitu ladata %s"
-#: ../ex_cmds2.c:2535
#, c-format
msgid "sourcing \"%s\""
msgstr "ladataan %s"
-#: ../ex_cmds2.c:2537
-#, c-format
-msgid "line %<PRId64>: sourcing \"%s\""
-msgstr "rivi %<PRId64>: ladataan %s"
+#, fuzzy, c-format
+#~ msgid "line %<PRId64>: sourcing \"%s\""
+#~ msgstr "rivi %ld: ladataan %s"
-#: ../ex_cmds2.c:2693
#, c-format
msgid "finished sourcing %s"
msgstr "ladattu %s"
-#: ../ex_cmds2.c:2765
msgid "modeline"
msgstr "mode-rivi"
-#: ../ex_cmds2.c:2767
msgid "--cmd argument"
msgstr "--cmd-argumentti"
-#: ../ex_cmds2.c:2769
msgid "-c argument"
msgstr "-c-argumentti"
-#: ../ex_cmds2.c:2771
msgid "environment variable"
-msgstr "ympristmuuttuja"
+msgstr "ympäristömuuttuja"
-#: ../ex_cmds2.c:2773
msgid "error handler"
-msgstr "virheksittelin"
+msgstr "virhekäsittelin"
-#: ../ex_cmds2.c:3020
msgid "W15: Warning: Wrong line separator, ^M may be missing"
-msgstr "W15: Varoitus: Vr rivierotin, ^M saattaa puuttua"
+msgstr "W15: Varoitus: Väärä rivierotin, ^M saattaa puuttua"
-#: ../ex_cmds2.c:3139
msgid "E167: :scriptencoding used outside of a sourced file"
msgstr "E167: :scriptencoding ladatun tiedoston ulkopuolella"
-#: ../ex_cmds2.c:3166
msgid "E168: :finish used outside of a sourced file"
msgstr "E168: :finish ladatun tiedoston ulkopuolella"
-#: ../ex_cmds2.c:3389
#, c-format
msgid "Current %slanguage: \"%s\""
-msgstr "Kytss oleva %skieli: %s"
+msgstr "Käytössä oleva %skieli: %s"
-#: ../ex_cmds2.c:3404
#, c-format
msgid "E197: Cannot set language to \"%s\""
-msgstr "E197: Kieleksi ei voitu asettaa kielt %s"
+msgstr "E197: Kieleksi ei voitu asettaa kieltä %s"
#. don't redisplay the window
#. don't wait for return
-#: ../ex_docmd.c:387
msgid "Entering Ex mode. Type \"visual\" to go to Normal mode."
-msgstr "Siirrytn Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan."
+msgstr "Siirrytään Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan."
-#: ../ex_docmd.c:428
msgid "E501: At end-of-file"
msgstr "E501: Tiedoston lopussa"
-#: ../ex_docmd.c:513
msgid "E169: Command too recursive"
msgstr "E169: Liian rekursiivinen komento"
-#: ../ex_docmd.c:1006
+#, fuzzy
+#~ msgid "line %"
+#~ msgstr "rivi %ld"
+
#, c-format
msgid "E605: Exception not caught: %s"
msgstr "E605: Kiinniottamaton poikkeus: %s"
-#: ../ex_docmd.c:1085
msgid "End of sourced file"
msgstr "Ladatun tiedoston loppu"
-#: ../ex_docmd.c:1086
msgid "End of function"
msgstr "Funktion loppu"
-#: ../ex_docmd.c:1628
msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: Kyttjn mrittelemn komennon monimerkityksinen kytt"
+msgstr "E464: Käyttäjän määrittelemän komennon monimerkityksinen käyttö"
-#: ../ex_docmd.c:1638
msgid "E492: Not an editor command"
msgstr "E492: Ei ole editorikomento"
-#: ../ex_docmd.c:1729
msgid "E493: Backwards range given"
msgstr "E493: Takaperoinen arvoalue annettu"
-#: ../ex_docmd.c:1733
msgid "Backwards range given, OK to swap"
-msgstr "Takaperoinen arvoalue annettu, OK knt"
+msgstr "Takaperoinen arvoalue annettu, OK kääntää"
#. append
#. typed wrong
-#: ../ex_docmd.c:1787
msgid "E494: Use w or w>>"
-msgstr "E494: Kyt w:t tai w>>:aa"
-
-#: ../ex_docmd.c:3454
-msgid "E319: The command is not available in this version"
-msgstr "E319: Komento ei ole kytettviss tss versiossa"
+msgstr "E494: Käytä w:tä tai w>>:aa"
-#: ../ex_docmd.c:3752
-msgid "E172: Only one file name allowed"
-msgstr "E172: Vain yksi tiedostonimi sallitaan"
+#, fuzzy
+#~ msgid "E319: The command is not available in this version"
+#~ msgstr "E319: Komento ei ole käytettävissä tässä versiossa"
-#: ../ex_docmd.c:4238
msgid "1 more file to edit. Quit anyway?"
-msgstr "viel 1 tiedosto muokattavana, lopetaanko silti?"
+msgstr "vielä 1 tiedosto muokattavana, lopetaanko silti?"
-#: ../ex_docmd.c:4242
#, c-format
msgid "%d more files to edit. Quit anyway?"
-msgstr "viel %d tiedostoa muokattavana, lopetetaanko silti?"
+msgstr "vielä %d tiedostoa muokattavana, lopetetaanko silti?"
-#: ../ex_docmd.c:4248
msgid "E173: 1 more file to edit"
-msgstr "E173: viel 1 tiedosto muokattavana"
+msgstr "E173: vielä 1 tiedosto muokattavana"
-#: ../ex_docmd.c:4250
-#, c-format
-msgid "E173: %<PRId64> more files to edit"
-msgstr "E173: viel %<PRId64> tiedostoa muokattavana"
+#, fuzzy, c-format
+#~ msgid "E173: %<PRId64> more files to edit"
+#~ msgstr "E173: vielä %ld tiedostoa muokattavana"
-#: ../ex_docmd.c:4320
msgid "E174: Command already exists: add ! to replace it"
-msgstr "E174: Komento on jo olemassa, kyt !: korvataksesi"
+msgstr "E174: Komento on jo olemassa, käytä !:ä korvataksesi"
-#: ../ex_docmd.c:4432
msgid ""
"\n"
-" Name Args Range Complete Definition"
+" Name Args Address Complete Definition"
msgstr ""
"\n"
-" Nimi Arg Arvot Valmis Mritelm"
+" Nimi Argumentit Osoite Valmis Määritelmä"
-#: ../ex_docmd.c:4516
msgid "No user-defined commands found"
-msgstr "Ei kyttjn mrittelemi komentoja"
+msgstr "Ei käyttäjän määrittelemiä komentoja"
-#: ../ex_docmd.c:4538
msgid "E175: No attribute specified"
-msgstr "E175: Ei attribuutteja mriteltyn"
+msgstr "E175: Ei attribuutteja määriteltynä"
-#: ../ex_docmd.c:4583
msgid "E176: Invalid number of arguments"
-msgstr "E176: Vr mr attribuutteja"
+msgstr "E176: Väärä määrä attribuutteja"
-#: ../ex_docmd.c:4594
msgid "E177: Count cannot be specified twice"
-msgstr "E177: Lukumr ei voi mritell kahdesti"
+msgstr "E177: Lukumäärää ei voi määritellä kahdesti"
-#: ../ex_docmd.c:4603
msgid "E178: Invalid default value for count"
-msgstr "E178: Lukumrn oletusarvo on vr"
+msgstr "E178: Lukumäärän oletusarvo on väärä"
-#: ../ex_docmd.c:4625
msgid "E179: argument required for -complete"
msgstr "E179: -complete vaatii argumentin"
-#: ../ex_docmd.c:4635
+msgid "E179: argument required for -addr"
+msgstr "E179: -addr vaatii argumentin"
+
#, c-format
msgid "E181: Invalid attribute: %s"
msgstr "E181: Virheellinen attribuutti: %s"
-#: ../ex_docmd.c:4678
msgid "E182: Invalid command name"
msgstr "E182: Virheellinen komennon nimi"
-#: ../ex_docmd.c:4691
msgid "E183: User defined commands must start with an uppercase letter"
-msgstr "E183: Kyttjn mrittelemn komennon pit alkaa suuraakkosella"
+msgstr "E183: Käyttäjän määrittelemän komennon pitää alkaa suuraakkosella"
-#: ../ex_docmd.c:4696
-#, fuzzy
msgid "E841: Reserved name, cannot be used for user defined command"
-msgstr "E464: Kyttjn mrittelemn komennon monimerkityksinen kytt"
+msgstr "E841: Varattua nimeä ei voi käyttää käyttäjän määrittelemänä komentona"
-#: ../ex_docmd.c:4751
#, c-format
msgid "E184: No such user-defined command: %s"
-msgstr "E184: Kyttjn komentoa ei ole olemassa: %s"
+msgstr "E184: Käyttäjän komentoa ei ole olemassa: %s"
+
+#, c-format
+msgid "E180: Invalid address type value: %s"
+msgstr "E180: Virheellinen osoitetyyppiarvo: %s"
-#: ../ex_docmd.c:5219
#, c-format
msgid "E180: Invalid complete value: %s"
-msgstr "E180: Virheellinen tydennysarvo: %s"
+msgstr "E180: Virheellinen täydennysarvo: %s"
-#: ../ex_docmd.c:5225
msgid "E468: Completion argument only allowed for custom completion"
-msgstr "E468: Tydennysargumentti sopii vain itse mriteltyyn tydennykseen"
+msgstr "E468: Täydennysargumentti sopii vain itse määriteltyyn täydennykseen"
-#: ../ex_docmd.c:5231
msgid "E467: Custom completion requires a function argument"
-msgstr "E467: Itse mritelty tydennys vaatii funktioargumentin"
+msgstr "E467: Itse määritelty täydennys vaatii funktioargumentin"
-#: ../ex_docmd.c:5257
-#, fuzzy, c-format
+#, c-format
msgid "E185: Cannot find color scheme '%s'"
-msgstr "E185: Vriteemaa %s ei lydy"
+msgstr "E185: Väriteemaa %s ei löydy"
-#: ../ex_docmd.c:5263
msgid "Greetings, Vim user!"
-msgstr "Tervehdys, Vimin kyttj."
+msgstr "Tervehdys, Vimin käyttäjä."
-#: ../ex_docmd.c:5431
msgid "E784: Cannot close last tab page"
-msgstr "E784: Viimeist vlilehte ei voi sulkea"
+msgstr "E784: Viimeistä välilehteä ei voi sulkea"
-#: ../ex_docmd.c:5462
msgid "Already only one tab page"
-msgstr "Vain yksi vlilehti jljell en"
+msgstr "Vain yksi välilehti jäljellä enää"
-#: ../ex_docmd.c:6004
#, c-format
msgid "Tab page %d"
msgstr "Tabisivu %d"
-#: ../ex_docmd.c:6295
msgid "No swap file"
msgstr "Ei swap-tiedostoa"
-#: ../ex_docmd.c:6478
-msgid "E747: Cannot change directory, buffer is modified (add ! to override)"
-msgstr ""
-"E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lis komentoon ! "
-"ohittaaksesi"
-
-#: ../ex_docmd.c:6485
msgid "E186: No previous directory"
-msgstr "E186: Ei edellist hakemistoa"
+msgstr "E186: Ei edellistä hakemistoa"
-#: ../ex_docmd.c:6530
msgid "E187: Unknown"
msgstr "E187: Tuntematon"
-#: ../ex_docmd.c:6610
msgid "E465: :winsize requires two number arguments"
msgstr "E465: :winsize vaatii kaksi numeroargumenttia"
-#: ../ex_docmd.c:6655
-msgid "E188: Obtaining window position not implemented for this platform"
-msgstr "E188: Ikkunan sijainnin selvitys ei toimi tll alustalla"
-
-#: ../ex_docmd.c:6662
-msgid "E466: :winpos requires two number arguments"
-msgstr "E466: :winpos vaatii kaksi lukuargumenttia"
-
-#: ../ex_docmd.c:7241
-#, c-format
-msgid "E739: Cannot create directory: %s"
-msgstr "E739: hakemistoa ei voi luoda: %s"
-
-#: ../ex_docmd.c:7268
#, c-format
msgid "E189: \"%s\" exists (add ! to override)"
-msgstr "E189: %s on jo olemassa (lis komentoon ! ohittaaksesi)"
+msgstr "E189: %s on jo olemassa (lisää komentoon ! ohittaaksesi)"
-#: ../ex_docmd.c:7273
#, c-format
msgid "E190: Cannot open \"%s\" for writing"
msgstr "E190: Tiedostoa %s ei voitu avata kirjoittamista varten"
#. set mark
-#: ../ex_docmd.c:7294
msgid "E191: Argument must be a letter or forward/backward quote"
-msgstr "E191: Argumentin eteen- tai taaksepin lainaukseen pit olla kirjain"
+msgstr "E191: Argumentin eteen- tai taaksepäin lainaukseen pitää olla kirjain"
-#: ../ex_docmd.c:7333
msgid "E192: Recursive use of :normal too deep"
-msgstr "E192: :normalin liian syv rekursio"
+msgstr "E192: :normalin liian syvä rekursio"
-#: ../ex_docmd.c:7807
msgid "E194: No alternate file name to substitute for '#'"
-msgstr "E194: Ei vaihtoehtoista tiedostonime #:lle"
+msgstr "E194: Ei vaihtoehtoista tiedostonimeä #:lle"
-#: ../ex_docmd.c:7841
msgid "E495: no autocommand file name to substitute for \"<afile>\""
msgstr "E495: ei autocommand-tiedostoa kohteelle <afile>"
-#: ../ex_docmd.c:7850
msgid "E496: no autocommand buffer number to substitute for \"<abuf>\""
msgstr "E496: ei autocommand-puskurinumeroa kohteelle <abuf>"
-#: ../ex_docmd.c:7861
msgid "E497: no autocommand match name to substitute for \"<amatch>\""
-msgstr "E497: ei autocommand-tsmysnime kohteella <amatch>"
+msgstr "E497: ei autocommand-täsmäysnimeä kohteella <amatch>"
-#: ../ex_docmd.c:7870
msgid "E498: no :source file name to substitute for \"<sfile>\""
-msgstr "E498: ei :source-tiedostonime kohteelle <sfile>"
+msgstr "E498: ei :source-tiedostonimeä kohteelle <sfile>"
-#: ../ex_docmd.c:7876
-#, fuzzy
msgid "E842: no line number to use for \"<slnum>\""
-msgstr "E498: ei :source-tiedostonime kohteelle <sfile>"
+msgstr "E842: ei rivinumeroa kohteelle <slnum>"
-#: ../ex_docmd.c:7903
#, fuzzy, c-format
-msgid "E499: Empty file name for '%' or '#', only works with \":p:h\""
-msgstr "E499: Tyhj tiedostonimi kohteissa % tai # toimii vain :p:h"
+#~ msgid "E499: Empty file name for '%' or '#', only works with \":p:h\""
+#~ msgstr "E499: Tyhjä tiedostonimi kohteissa % tai # toimii vain :p:h"
-#: ../ex_docmd.c:7905
msgid "E500: Evaluates to an empty string"
-msgstr "E500: Loppuarvo on tyhj merkkijono"
-
-#: ../ex_docmd.c:8838
-msgid "E195: Cannot open viminfo file for reading"
-msgstr "E195: Viminfoa ei voi avata lukemista varten"
+msgstr "E500: Loppuarvo on tyhjä merkkijono"
-#: ../ex_eval.c:464
msgid "E608: Cannot :throw exceptions with 'Vim' prefix"
-msgstr "E608: Vim-alkuisia poikkeuksia ei voi heitt :throw-komennolla"
+msgstr "E608: Vim-alkuisia poikkeuksia ei voi heittää :throw-komennolla"
#. always scroll up, don't overwrite
-#: ../ex_eval.c:496
#, c-format
msgid "Exception thrown: %s"
msgstr "Poikkeus heitetty: %s"
-#: ../ex_eval.c:545
+#. always scroll up, don't overwrite
#, c-format
msgid "Exception finished: %s"
msgstr "Poikkeus lopeteltu: %s"
-#: ../ex_eval.c:546
#, c-format
msgid "Exception discarded: %s"
msgstr "Poikkeus poistettu: %s"
-#: ../ex_eval.c:588 ../ex_eval.c:634
-#, c-format
-msgid "%s, line %<PRId64>"
-msgstr "%s, rivi %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "%s, line %<PRId64>"
+#~ msgstr "%s, rivi %ld"
#. always scroll up, don't overwrite
-#: ../ex_eval.c:608
#, c-format
msgid "Exception caught: %s"
msgstr "Poikkeus otettu kiinni: %s"
-#: ../ex_eval.c:676
#, c-format
msgid "%s made pending"
msgstr "%s odotutettu"
-#: ../ex_eval.c:679
#, c-format
msgid "%s resumed"
msgstr "%s palautettu"
-#: ../ex_eval.c:683
#, c-format
msgid "%s discarded"
msgstr "%s poistettu"
-#: ../ex_eval.c:708
msgid "Exception"
msgstr "Poikkeus"
-#: ../ex_eval.c:713
msgid "Error and interrupt"
msgstr "Virhe ja keskeytys"
-#: ../ex_eval.c:715
msgid "Error"
msgstr "Virhe"
#. if (pending & CSTP_INTERRUPT)
-#: ../ex_eval.c:717
msgid "Interrupt"
msgstr "Keskeytys"
-#: ../ex_eval.c:795
msgid "E579: :if nesting too deep"
msgstr "E579: liian monta kerrosta :if-komennossa"
-#: ../ex_eval.c:830
msgid "E580: :endif without :if"
msgstr "E580: :endif ilman komentoa :if"
-#: ../ex_eval.c:873
msgid "E581: :else without :if"
msgstr "E581: :else ilman komentoa :if"
-#: ../ex_eval.c:876
msgid "E582: :elseif without :if"
msgstr "E582: :elseif ilman komentoa :if"
-#: ../ex_eval.c:880
msgid "E583: multiple :else"
msgstr "E583: :else monta kertaa"
-#: ../ex_eval.c:883
msgid "E584: :elseif after :else"
-msgstr "E584: :elseif komennon :else jlkeen"
+msgstr "E584: :elseif komennon :else jälkeen"
-#: ../ex_eval.c:941
msgid "E585: :while/:for nesting too deep"
msgstr "E585: liian monta tasoa :while- tai :for-komennoissa"
-#: ../ex_eval.c:1028
msgid "E586: :continue without :while or :for"
msgstr "E586: :continue ilman komentoa :while tai :for"
-#: ../ex_eval.c:1061
msgid "E587: :break without :while or :for"
msgstr "E587: :break ilman komentoa :while tai :for"
-#: ../ex_eval.c:1102
msgid "E732: Using :endfor with :while"
msgstr "E732: :endfor ilman komentoa :while"
-#: ../ex_eval.c:1104
msgid "E733: Using :endwhile with :for"
msgstr "E733: :endwhile ilman komentoa :for"
-#: ../ex_eval.c:1247
msgid "E601: :try nesting too deep"
msgstr "E601: liian monta tasoa :try-komennossa"
-#: ../ex_eval.c:1317
msgid "E603: :catch without :try"
msgstr "E603: :catch ilman komentoa :try"
#. Give up for a ":catch" after ":finally" and ignore it.
#. * Just parse.
-#: ../ex_eval.c:1332
msgid "E604: :catch after :finally"
msgstr "E604: :catch ilman komentoa :finally"
-#: ../ex_eval.c:1451
msgid "E606: :finally without :try"
msgstr "E606: :finally ilman komentoa :try"
#. Give up for a multiple ":finally" and ignore it.
-#: ../ex_eval.c:1467
msgid "E607: multiple :finally"
msgstr "E607: :finally monta kertaa"
-#: ../ex_eval.c:1571
msgid "E602: :endtry without :try"
msgstr "E602: :endtry ilman komentoa :try"
-#: ../ex_eval.c:2026
msgid "E193: :endfunction not inside a function"
msgstr "E193: :endfunction funktion ulkopuolella"
-#: ../ex_getln.c:1643
msgid "E788: Not allowed to edit another buffer now"
msgstr "E788: Puskuria ei voi muokata nyt"
-#: ../ex_getln.c:1656
msgid "E811: Not allowed to change buffer information now"
msgstr "E811: Puskuria ei voi vaihtaa nyt"
-#: ../ex_getln.c:3178
msgid "tagname"
-msgstr "tginimi"
+msgstr "täginimi"
-#: ../ex_getln.c:3181
msgid " kind file\n"
msgstr " -tiedostotyyppi\n"
-#: ../ex_getln.c:4799
msgid "'history' option is zero"
msgstr "history-asetus on nolla"
-#: ../ex_getln.c:5046
-#, c-format
-msgid ""
-"\n"
-"# %s History (newest to oldest):\n"
-msgstr ""
-"\n"
-"# %s Historia (uusimmasta alkaen):\n"
-
-#: ../ex_getln.c:5047
-msgid "Command Line"
-msgstr "Komentorivi"
-
-#: ../ex_getln.c:5048
-msgid "Search String"
-msgstr "Hakujono"
-
-#: ../ex_getln.c:5049
-msgid "Expression"
-msgstr "Ilmaus"
-
-#: ../ex_getln.c:5050
-msgid "Input Line"
-msgstr "Syterivi"
-
-#: ../ex_getln.c:5117
msgid "E198: cmd_pchar beyond the command length"
msgstr "E198: cmd_pchar komennon pituuden ulkopuolella"
-#: ../ex_getln.c:5279
msgid "E199: Active window or buffer deleted"
msgstr "E199: Aktiivinen ikkuna tai puskuri poistettu"
-#: ../file_search.c:203
msgid "E854: path too long for completion"
-msgstr ""
+msgstr "E854: polku on liian pitkä täydennykseen"
-#: ../file_search.c:446
#, c-format
msgid ""
"E343: Invalid path: '**[number]' must be at the end of the path or be "
@@ -2011,376 +2098,296 @@ msgstr ""
"E343: Virheellinen polku: '**[numero]' kuuluu polun loppuun tai ennen kohtaa "
"%s."
-#: ../file_search.c:1505
#, c-format
msgid "E344: Can't find directory \"%s\" in cdpath"
-msgstr "E344: Hakemistoa %s ei lydy cdpathista"
+msgstr "E344: Hakemistoa %s ei löydy cdpathista"
-#: ../file_search.c:1508
#, c-format
msgid "E345: Can't find file \"%s\" in path"
-msgstr "E345: Tiedostoa %s ei lydy polulta"
+msgstr "E345: Tiedostoa %s ei löydy polulta"
-#: ../file_search.c:1512
#, c-format
msgid "E346: No more directory \"%s\" found in cdpath"
-msgstr "E346: Hakemisto %s ei ole en cdpathissa"
+msgstr "E346: Hakemisto %s ei ole enää cdpathissa"
-#: ../file_search.c:1515
#, c-format
msgid "E347: No more file \"%s\" found in path"
-msgstr "E347: Tiedosto %s ei ole en polulla"
+msgstr "E347: Tiedosto %s ei ole enää polulla"
-#: ../fileio.c:137
msgid "E812: Autocommands changed buffer or buffer name"
msgstr "E812: Autocommands muutti puskurin tai sen nimen"
-#: ../fileio.c:368
msgid "Illegal file name"
msgstr "Virheellinen tiedostonimi"
-#: ../fileio.c:395 ../fileio.c:476 ../fileio.c:2543 ../fileio.c:2578
msgid "is a directory"
msgstr "on hakemisto"
-#: ../fileio.c:397
msgid "is not a file"
msgstr "ei ole tiedosto"
-#: ../fileio.c:508 ../fileio.c:3522
msgid "[New File]"
msgstr "[Uusi tiedosto]"
-#: ../fileio.c:511
msgid "[New DIRECTORY]"
msgstr "[uusi HAKEMISTO]"
-#: ../fileio.c:529 ../fileio.c:532
+#. libuv only returns -errno in Unix and in Windows open() does not
+#. set EOVERFLOW
msgid "[File too big]"
msgstr "[Liian iso tiedosto]"
-#: ../fileio.c:534
msgid "[Permission Denied]"
msgstr "[Lupa kielletty]"
-#: ../fileio.c:653
msgid "E200: *ReadPre autocommands made the file unreadable"
msgstr ""
-"E200: *ReadPre-autocommand-komennot tekivt tiedostosta lukukelvottoman"
+"E200: *ReadPre-autocommand-komennot tekivät tiedostosta lukukelvottoman"
-#: ../fileio.c:655
msgid "E201: *ReadPre autocommands must not change current buffer"
-msgstr "E201: *ReadPre-autocommand-komennot eivt saa muuttaa puskuria"
-
-#: ../fileio.c:672
-msgid "Nvim: Reading from stdin...\n"
-msgstr "Vim: Luetaan vakiosytteest...\n"
+msgstr "E201: *ReadPre-autocommand-komennot eivät saa muuttaa puskuria"
#. Re-opening the original file failed!
-#: ../fileio.c:909
msgid "E202: Conversion made file unreadable!"
msgstr "E202: Muunnos teki tiedostosta lukukelvottoman."
#. fifo or socket
-#: ../fileio.c:1782
msgid "[fifo/socket]"
msgstr "[fifo t. soketti]"
#. fifo
-#: ../fileio.c:1788
msgid "[fifo]"
msgstr "[fifo]"
#. or socket
-#: ../fileio.c:1794
msgid "[socket]"
msgstr "[soketti]"
#. or character special
-#: ../fileio.c:1801
msgid "[character special]"
msgstr "[merkki erikoinen]"
-# Carriage Return elikk rivinvaihtomerkin ers muoto/osa (vrt. LF)
-#: ../fileio.c:1815
+# Carriage Return elikkä rivinvaihtomerkin eräs muoto/osa (vrt. LF)
msgid "[CR missing]"
msgstr "[CR puuttuu]"
-#: ../fileio.c:1819
msgid "[long lines split]"
-msgstr "[pitkt rivit hajotettu]"
+msgstr "[pitkät rivit hajotettu]"
-#: ../fileio.c:1823 ../fileio.c:3512
msgid "[NOT converted]"
msgstr "[EI muunnettu]"
-#: ../fileio.c:1826 ../fileio.c:3515
msgid "[converted]"
msgstr "[muunnettu]"
-#: ../fileio.c:1831
-#, c-format
-msgid "[CONVERSION ERROR in line %<PRId64>]"
-msgstr "[MUUNNOSVIRHE rivill %<PRId64>]"
+#, fuzzy, c-format
+#~ msgid "[CONVERSION ERROR in line %<PRId64>]"
+#~ msgstr "[MUUNNOSVIRHE rivillä %ld]"
-#: ../fileio.c:1835
-#, c-format
-msgid "[ILLEGAL BYTE in line %<PRId64>]"
-msgstr "[VIRHEELLINEN OKTETTI rivill %<PRId64>]"
+#, fuzzy, c-format
+#~ msgid "[ILLEGAL BYTE in line %<PRId64>]"
+#~ msgstr "[VIRHEELLINEN OKTETTI rivillä %ld]"
-#: ../fileio.c:1838
msgid "[READ ERRORS]"
-msgstr "[LUKUVIRHEIT]"
+msgstr "[LUKUVIRHEITÄ]"
-#: ../fileio.c:2104
msgid "Can't find temp file for conversion"
-msgstr "Ei voi lyt vliaikaistiedstoa muuntamiseksi"
+msgstr "Ei voi löytää väliaikaistiedstoa muuntamiseksi"
-#: ../fileio.c:2110
msgid "Conversion with 'charconvert' failed"
-msgstr "Muunnos charconvert eponnistui"
+msgstr "Muunnos charconvert epäonnistui"
-#: ../fileio.c:2113
msgid "can't read output of 'charconvert'"
msgstr "charconvertin tulostetta ei voida lukea"
-#: ../fileio.c:2437
msgid "E676: No matching autocommands for acwrite buffer"
msgstr "E676: Ei autocommand-komentoa acwrite-puskurille"
-#: ../fileio.c:2466
msgid "E203: Autocommands deleted or unloaded buffer to be written"
msgstr ""
"E203: Autocommand-komennot poistivat tai vapauttivat puskurin, johon piti "
"kirjoittaa"
-#: ../fileio.c:2486
msgid "E204: Autocommand changed number of lines in unexpected way"
-msgstr "E204: Autocommand-komento muutti rivien mr odottamatta"
+msgstr "E204: Autocommand-komento muutti rivien määrä odottamatta"
-#: ../fileio.c:2548 ../fileio.c:2565
msgid "is not a file or writable device"
msgstr "ei ole tiedosto tai kirjoitettava laite"
-#: ../fileio.c:2601
msgid "is read-only (add ! to override)"
-msgstr "on kirjoitussuojattu (lis komentoon ! ohittaaksesi)"
+msgstr "on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)"
-#: ../fileio.c:2886
msgid "E506: Can't write to backup file (add ! to override)"
msgstr ""
-"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lis komentoon ! "
+"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lisää komentoon ! "
"ohittaaksesi)"
-#: ../fileio.c:2898
-msgid "E507: Close error for backup file (add ! to override)"
-msgstr ""
-"E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lis komentoon ! "
-"ohittaaksesi)"
+#, fuzzy, c-format
+#~ msgid "E507: Close error for backup file (add ! to override): %s"
+#~ msgstr ""
+#~ "E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lisää komentoon ! "
+#~ "ohittaaksesi)"
-#: ../fileio.c:2901
msgid "E508: Can't read file for backup (add ! to override)"
msgstr ""
-"E508: Varmuuskopiotiedostoa ei voi lukea (lis komentoon ! ohittaaksesi)"
+"E508: Varmuuskopiotiedostoa ei voi lukea (lisää komentoon ! ohittaaksesi)"
-#: ../fileio.c:2923
msgid "E509: Cannot create backup file (add ! to override)"
msgstr ""
-"E509: Ei voi luoda varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)"
+"E509: Ei voi luoda varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)"
-#: ../fileio.c:3008
msgid "E510: Can't make backup file (add ! to override)"
msgstr ""
-"E510: Ei voi tehd varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)"
+"E510: Ei voi tehdä varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)"
#. Can't write without a tempfile!
-#: ../fileio.c:3121
msgid "E214: Can't find temp file for writing"
-msgstr "E214: Ei voi lyt vliaikaistiedostoa kirjoitettavaksi"
+msgstr "E214: Ei voi löytää väliaikaistiedostoa kirjoitettavaksi"
-#: ../fileio.c:3134
msgid "E213: Cannot convert (add ! to write without conversion)"
msgstr ""
-"E213: Muunnos ei onnistu (lis komentoon ! kirjoittaaksesi muuntamatta)"
+"E213: Muunnos ei onnistu (lisää komentoon ! kirjoittaaksesi muuntamatta)"
-#: ../fileio.c:3169
msgid "E166: Can't open linked file for writing"
msgstr "E166: Linkitetyn tiedoston avaus kirjoittamista varten ei onnistu"
-#: ../fileio.c:3173
-msgid "E212: Can't open file for writing"
-msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu"
+#, fuzzy, c-format
+#~ msgid "E212: Can't open file for writing: %s"
+#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu"
-#: ../fileio.c:3363
-msgid "E667: Fsync failed"
-msgstr "E667: Fsync ei onnistunut"
+#, fuzzy, c-format
+#~ msgid "E667: Fsync failed: %s"
+#~ msgstr "E667: Fsync ei onnistunut"
-#: ../fileio.c:3398
-msgid "E512: Close failed"
-msgstr "E512: Sulkeminen ei onnistunut"
+#, fuzzy, c-format
+#~ msgid "E512: Close failed: %s"
+#~ msgstr "E512: Sulkeminen ei onnistunut"
-#: ../fileio.c:3436
msgid "E513: write error, conversion failed (make 'fenc' empty to override)"
-msgstr "E513: kirjoitusvirhe, muunnos eponnistui (tyhj fenc ohittaaksesi)"
+msgstr "E513: kirjoitusvirhe, muunnos epäonnistui (tyhjää fenc ohittaaksesi)"
-#: ../fileio.c:3441
-#, c-format
-msgid ""
-"E513: write error, conversion failed in line %<PRId64> (make 'fenc' empty to "
-"override)"
-msgstr ""
-"E513: kirjoitusvirhe, muunnos eponnistui rivill %<PRId64>(tyhj fenc "
-"ohittaaksesi)"
+#, fuzzy
+#~ msgid "E513: write error, conversion failed in line %"
+#~ msgstr ""
+#~ "E513: kirjoitusvirhe, muunnos epäonnistui rivillä %ld(tyhjää fenc "
+#~ "ohittaaksesi)"
-#: ../fileio.c:3448
msgid "E514: write error (file system full?)"
-msgstr "E514: kirjoitusvirhe (tiedostojrjestelm tysi)"
+msgstr "E514: kirjoitusvirhe (tiedostojärjestelmä täysi)"
-#: ../fileio.c:3506
msgid " CONVERSION ERROR"
msgstr " MUUNNOSVIRHE"
-#: ../fileio.c:3509
-#, c-format
-msgid " in line %<PRId64>;"
-msgstr " rivill %<PRId64>"
+#, fuzzy, c-format
+#~ msgid " in line %<PRId64>;"
+#~ msgstr " rivillä %ld"
-#: ../fileio.c:3519
msgid "[Device]"
msgstr "[Laite]"
-#: ../fileio.c:3522
msgid "[New]"
msgstr "[Uusi]"
-#: ../fileio.c:3535
msgid " [a]"
msgstr " [a]"
-#: ../fileio.c:3535
msgid " appended"
-msgstr " listty"
+msgstr " lisätty"
-#: ../fileio.c:3537
msgid " [w]"
msgstr " [w]"
-#: ../fileio.c:3537
msgid " written"
msgstr " kirjoitettu"
-#: ../fileio.c:3579
msgid "E205: Patchmode: can't save original file"
-msgstr "E205: Patch-tilassa ei voi tallentaa alkuperistiedostoa"
+msgstr "E205: Patch-tilassa ei voi tallentaa alkuperäistiedostoa"
-#: ../fileio.c:3602
msgid "E206: patchmode: can't touch empty original file"
-msgstr "E206: patch-tilassa ei voi muuttaa tyhj alkuperistiedostoa"
+msgstr "E206: patch-tilassa ei voi muuttaa tyhjää alkuperäistiedostoa"
-#: ../fileio.c:3616
msgid "E207: Can't delete backup file"
msgstr "E207: Ei voi poistaa varmuuskopiota"
-#: ../fileio.c:3672
+#. Set highlight for error messages.
msgid ""
"\n"
"WARNING: Original file may be lost or damaged\n"
msgstr ""
"\n"
-"VAROITUS: Alkuperistiedosto voi hvit tai vahingoittua\n"
+"VAROITUS: Alkuperäistiedosto voi hävitä tai vahingoittua\n"
-#: ../fileio.c:3675
msgid "don't quit the editor until the file is successfully written!"
-msgstr "l lopeta editoria kesken tallentamisen."
+msgstr "älä lopeta editoria kesken tallentamisen."
-#: ../fileio.c:3795
-msgid "[dos]"
-msgstr "[dos]"
-
-#: ../fileio.c:3795
msgid "[dos format]"
msgstr "[dos-muoto]"
-#: ../fileio.c:3801
-msgid "[mac]"
-msgstr "[mac]"
+msgid "[dos]"
+msgstr "[dos]"
-#: ../fileio.c:3801
msgid "[mac format]"
msgstr "[mac-muoto]"
-#: ../fileio.c:3807
-msgid "[unix]"
-msgstr "[unix]"
+msgid "[mac]"
+msgstr "[mac]"
-#: ../fileio.c:3807
msgid "[unix format]"
msgstr "[unix-muoto]"
-#: ../fileio.c:3831
+msgid "[unix]"
+msgstr "[unix]"
+
msgid "1 line, "
msgstr "1 rivi, "
-#: ../fileio.c:3833
-#, c-format
-msgid "%<PRId64> lines, "
-msgstr "%<PRId64> rivi, "
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines, "
+#~ msgstr "%ld riviä, "
-#: ../fileio.c:3836
msgid "1 character"
msgstr "1 merkki"
-#: ../fileio.c:3838
-#, c-format
-msgid "%<PRId64> characters"
-msgstr "%<PRId64> merkki"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> characters"
+#~ msgstr "%lld merkkiä"
+
+msgid "[Incomplete last line]"
+msgstr "[Vajaa viimeinen rivi]"
# ei rivinvaihtoja
-#: ../fileio.c:3849
msgid "[noeol]"
msgstr "[eiriviv.]"
-#: ../fileio.c:3849
-msgid "[Incomplete last line]"
-msgstr "[Vajaa viimeinen rivi]"
-
-# Jos aukiolevaa tiedostoa srkkii toisella ohjelmalla
-#. don't overwrite messages here
-#. must give this prompt
-#. don't use emsg() here, don't want to flush the buffers
-#: ../fileio.c:3865
+# Jos aukiolevaa tiedostoa sörkkii toisella ohjelmalla
+#. Don't overwrite messages here.
+#. Must give this prompt.
+#. Don't use emsg() here, don't want to flush the buffers.
msgid "WARNING: The file has been changed since reading it!!!"
-msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jlkeen!"
+msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jälkeen!"
-#: ../fileio.c:3867
msgid "Do you really want to write to it"
msgstr "Kirjoitetaanko"
-#: ../fileio.c:4648
#, c-format
msgid "E208: Error writing to \"%s\""
msgstr "E208: Virhe kirjoitettaessa tiedostoon %s"
-#: ../fileio.c:4655
#, c-format
msgid "E209: Error closing \"%s\""
msgstr "E209: Virhe suljettaessa tiedostoa %s"
-#: ../fileio.c:4657
#, c-format
msgid "E210: Error reading \"%s\""
msgstr "E210: Virhe luettaessa tiedostoa %s"
-#: ../fileio.c:4883
msgid "E246: FileChangedShell autocommand deleted buffer"
msgstr "E246: FileChangedShell-autocommand poisti puskurin"
-#: ../fileio.c:4894
#, c-format
msgid "E211: File \"%s\" no longer available"
-msgstr "E211: Tiedostoa %s ei ole en"
+msgstr "E211: Tiedostoa %s ei ole enää"
-#: ../fileio.c:4906
#, c-format
msgid ""
"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as "
@@ -2389,41 +2396,33 @@ msgstr ""
"W12: Varoitus: Tiedostoa %s on muutettu ja Vimin puskurissa on muutoksia "
"tiedostoon"
-#: ../fileio.c:4907
msgid "See \":help W12\" for more info."
-msgstr ":help W12 kertoo listietoja."
+msgstr ":help W12 kertoo lisätietoja."
-#: ../fileio.c:4910
#, c-format
msgid "W11: Warning: File \"%s\" has changed since editing started"
-msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jlkeen"
+msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jälkeen"
-#: ../fileio.c:4911
msgid "See \":help W11\" for more info."
-msgstr ":help W11 kertoo listietoja."
+msgstr ":help W11 kertoo lisätietoja."
-#: ../fileio.c:4914
#, c-format
msgid "W16: Warning: Mode of file \"%s\" has changed since editing started"
msgstr ""
"W16: Varoitus: Tiedoston %s oikeuksia on muutettu muokkauksen aloituksen "
-"jlkeen"
+"jälkeen"
-#: ../fileio.c:4915
msgid "See \":help W16\" for more info."
-msgstr ":help W16 kertoo listietoja."
+msgstr ":help W16 kertoo lisätietoja."
-#: ../fileio.c:4927
#, c-format
msgid "W13: Warning: File \"%s\" has been created after editing started"
-msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jlkeen"
+msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jälkeen"
-#: ../fileio.c:4947
msgid "Warning"
msgstr "Varoitus"
-# yll olevien varoitusten ratkaisut
-#: ../fileio.c:4948
+# yllä olevien varoitusten ratkaisut
msgid ""
"&OK\n"
"&Load File"
@@ -2431,48 +2430,46 @@ msgstr ""
"&OK\n"
"&Avaa tiedosto uudelleen"
-#: ../fileio.c:5065
#, c-format
msgid "E462: Could not prepare for reloading \"%s\""
msgstr "E462: Ei voitu valmistella uudelleen avausta %s"
-#: ../fileio.c:5078
#, c-format
msgid "E321: Could not reload \"%s\""
msgstr "E321: Ei voitu uudelleenavata %s"
-#: ../fileio.c:5601
msgid "--Deleted--"
msgstr "--Poistettu--"
-#: ../fileio.c:5732
#, c-format
msgid "auto-removing autocommand: %s <buffer=%d>"
msgstr "poistetaan autocommand automaattisesti: %s <puskuri=%d>"
#. the group doesn't exist
-#: ../fileio.c:5772
#, c-format
msgid "E367: No such group: \"%s\""
-msgstr "E367: Ryhm ei ole: %s"
+msgstr "E367: Ryhmää ei ole: %s"
+
+#, fuzzy
+#~ msgid "E936: Cannot delete the current group"
+#~ msgstr "E351: Taitosta ei voi poistaa tällä foldmethodilla"
+
+msgid "W19: Deleting augroup that is still in use"
+msgstr "W19: käytössä oleva augroup poistetaan"
-#: ../fileio.c:5897
#, c-format
msgid "E215: Illegal character after *: %s"
-msgstr "E215: Virheellinen merkki *:n jlkeen: %s"
+msgstr "E215: Virheellinen merkki *:n jälkeen: %s"
-#: ../fileio.c:5905
#, c-format
msgid "E216: No such event: %s"
-msgstr "E216: Eventti ei ole: %s"
+msgstr "E216: Eventtiä ei ole: %s"
-#: ../fileio.c:5907
#, c-format
msgid "E216: No such group or event: %s"
-msgstr "E216: Ryhm tai eventti ei ole: %s"
+msgstr "E216: Ryhmää tai eventtiä ei ole: %s"
#. Highlight title
-#: ../fileio.c:6090
msgid ""
"\n"
"--- Auto-Commands ---"
@@ -2480,762 +2477,611 @@ msgstr ""
"\n"
"--- Autocommandit ---"
-#: ../fileio.c:6293
#, c-format
msgid "E680: <buffer=%d>: invalid buffer number "
msgstr "E680: <puskuri=%d>: virheellinen puskurinumero"
-#: ../fileio.c:6370
msgid "E217: Can't execute autocommands for ALL events"
msgstr "E217: Ei voi suorittaa autocommandsia kaikille eventeille"
-#: ../fileio.c:6393
msgid "No matching autocommands"
-msgstr "Ei tsmvi autocommandsia"
+msgstr "Ei täsmääviä autocommandsia"
-#: ../fileio.c:6831
msgid "E218: autocommand nesting too deep"
msgstr "E218: liian monta tasoa autocommandissa"
-#: ../fileio.c:7143
#, c-format
msgid "%s Auto commands for \"%s\""
msgstr "%s Autocommands kohteelle %s"
-#: ../fileio.c:7149
#, c-format
msgid "Executing %s"
msgstr "Suoritetaan %s"
-#: ../fileio.c:7211
#, c-format
msgid "autocommand %s"
msgstr "autocommand %s"
-#: ../fileio.c:7795
msgid "E219: Missing {."
msgstr "E219: { puuttuu."
-#: ../fileio.c:7797
msgid "E220: Missing }."
msgstr "E220: } puuttuu."
-#: ../fold.c:93
msgid "E490: No fold found"
msgstr "E490: taitos puuttuu"
-#: ../fold.c:544
msgid "E350: Cannot create fold with current 'foldmethod'"
-msgstr "E350: Taitoksia ei voi tehd tll foldmethodilla"
+msgstr "E350: Taitoksia ei voi tehdä tällä foldmethodilla"
-#: ../fold.c:546
msgid "E351: Cannot delete fold with current 'foldmethod'"
-msgstr "E351: Taitosta ei voi poistaa tll foldmethodilla"
+msgstr "E351: Taitosta ei voi poistaa tällä foldmethodilla"
-#: ../fold.c:1784
-#, c-format
-msgid "+--%3ld lines folded "
-msgstr "+--%3ld rivi taitettu pois "
+#, fuzzy, c-format
+#~ msgid "+--%3ld lines folded "
+#~ msgstr "+--%3ld rivi taitettu pois "
#. buffer has already been read
-#: ../getchar.c:273
msgid "E222: Add to read buffer"
-msgstr "E222: Lis lukupuskuriin"
+msgstr "E222: Lisää lukupuskuriin"
-#: ../getchar.c:2040
msgid "E223: recursive mapping"
msgstr "E223: rekursiivinen kuvaus"
-#: ../getchar.c:2849
#, c-format
msgid "E224: global abbreviation already exists for %s"
-msgstr "E224: globaali lyhenne merkinnlle %s on jo olemassa"
+msgstr "E224: globaali lyhenne merkinnälle %s on jo olemassa"
-#: ../getchar.c:2852
#, c-format
msgid "E225: global mapping already exists for %s"
-msgstr "E225: globaali kuvaus merkinnlle %s on jo olemassa"
+msgstr "E225: globaali kuvaus merkinnälle %s on jo olemassa"
-#: ../getchar.c:2952
#, c-format
msgid "E226: abbreviation already exists for %s"
msgstr "E226: lyhenne on jo olemassa %s"
-#: ../getchar.c:2955
#, c-format
msgid "E227: mapping already exists for %s"
msgstr "E227: kuvaus on jo olemassa %s"
-#: ../getchar.c:3008
msgid "No abbreviation found"
-msgstr "Lyhennett ei lydy"
+msgstr "Lyhennettä ei löydy"
-#: ../getchar.c:3010
msgid "No mapping found"
-msgstr "Kuvausta ei lydy"
+msgstr "Kuvausta ei löydy"
-#: ../getchar.c:3974
msgid "E228: makemap: Illegal mode"
msgstr "E228: makemap: Virheellinen tila"
#. key value of 'cedit' option
#. type of cmdline window or 0
#. result of cmdline window or 0
-#: ../globals.h:924
msgid "--No lines in buffer--"
-msgstr "--Ei rivej puskurissa--"
+msgstr "--Ei rivejä puskurissa--"
#.
#. * The error messages that can be shared are included here.
#. * Excluded are errors that are only used once and debugging messages.
#.
-#: ../globals.h:996
msgid "E470: Command aborted"
msgstr "E470: Komento peruttu"
-#: ../globals.h:997
+#, fuzzy
+#~ msgid "E905: Cannot set this option after startup"
+#~ msgstr "E529: Termiä ei voi asettaa tyhjäksi merkkijonoksi"
+
+#, fuzzy
+#~ msgid "E903: Could not spawn API job"
+#~ msgstr "E623: Cscope-prosessin luonti epäonnistui"
+
msgid "E471: Argument required"
msgstr "E471: Argumentti puuttuu"
-#: ../globals.h:998
msgid "E10: \\ should be followed by /, ? or &"
-msgstr "E10: \\:n jlkeen pit tulla /, ? tai &"
+msgstr "E10: \\:n jälkeen pitää tulla /, ? tai &"
-#: ../globals.h:1000
msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"
msgstr "E11: Virheellinen komentorivi-ikkuna, <CR> suorittaa, Ctrl C lopettaa"
-#: ../globals.h:1002
msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search"
msgstr ""
-"E12: Komentoa ei tueta exrc:ss tai vimrc:ss tss hakemistossa tai "
-"tgihaussa"
+"E12: Komentoa ei tueta exrc:ssä tai vimrc:ssä tässä hakemistossa tai "
+"tägihaussa"
-#: ../globals.h:1003
msgid "E171: Missing :endif"
msgstr "E171: :endif puuttuu"
-#: ../globals.h:1004
msgid "E600: Missing :endtry"
msgstr "E600: :endtry puuttuu"
-#: ../globals.h:1005
msgid "E170: Missing :endwhile"
msgstr "E170: :endwhile puuttuu"
-#: ../globals.h:1006
msgid "E170: Missing :endfor"
msgstr "E170: :endfor puuttuu"
-#: ../globals.h:1007
msgid "E588: :endwhile without :while"
msgstr "E588: :endwhile ilman komentoa :while"
-#: ../globals.h:1008
msgid "E588: :endfor without :for"
msgstr "E588: :endfor ilman komentoa :for"
-#: ../globals.h:1009
msgid "E13: File exists (add ! to override)"
-msgstr "E13: Tiedosto on jo olemassa (lis ! ohittaaksesi)"
+msgstr "E13: Tiedosto on jo olemassa (lisää ! ohittaaksesi)"
-#: ../globals.h:1010
msgid "E472: Command failed"
-msgstr "E472: Komento eponnistui"
+msgstr "E472: Komento epäonnistui"
-#: ../globals.h:1011
msgid "E473: Internal error"
-msgstr "E473: Sisinen virhe"
+msgstr "E473: Sisäinen virhe"
-#: ../globals.h:1012
msgid "Interrupted"
msgstr "Keskeytetty"
-#: ../globals.h:1013
msgid "E14: Invalid address"
msgstr "E14: Virheellinen osoite"
-#: ../globals.h:1014
msgid "E474: Invalid argument"
msgstr "E474: Virheellinen argumentti"
-#: ../globals.h:1015
#, c-format
msgid "E475: Invalid argument: %s"
msgstr "E475: Virheellinen argumentti: %s"
-#: ../globals.h:1016
#, c-format
msgid "E15: Invalid expression: %s"
msgstr "E15: Virheellinen ilmaus: %s"
-#: ../globals.h:1017
msgid "E16: Invalid range"
msgstr "E16: Virheellinen arvoalue"
-#: ../globals.h:1018
msgid "E476: Invalid command"
msgstr "E476: Virheellinen komento"
-#: ../globals.h:1019
#, c-format
msgid "E17: \"%s\" is a directory"
msgstr "E17: %s on hakemisto"
-#: ../globals.h:1020
#, fuzzy
-msgid "E900: Invalid job id"
-msgstr "E49: Virheellinen vierityskoko"
+#~ msgid "E900: Invalid job id"
+#~ msgstr "E916: ei ole job"
-#: ../globals.h:1021
-msgid "E901: Job table is full"
-msgstr ""
+#~ msgid "E901: Job table is full"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "E903: Process failed to start: %s: \"%s\""
+#~ msgstr "E852: Lapsiprosesi ei voinut käynnistää käyttöliittymää"
+
+#, fuzzy
+#~ msgid "E904: Job is not connected to a pty"
+#~ msgstr "E902: Ei voi yhdistää porttiin"
-#: ../globals.h:1024
#, c-format
msgid "E364: Library call failed for \"%s()\""
-msgstr "E364: Kirjastukutsu %s() eponnistui"
+msgstr "E364: Kirjastukutsu %s() epäonnistui"
+
+#, fuzzy, c-format
+#~ msgid "E739: Cannot create directory %s: %s"
+#~ msgstr "E739: hakemistoa ei voi luoda: %s"
-#: ../globals.h:1026
msgid "E19: Mark has invalid line number"
-msgstr "E19: Merkill on virheellinen rivinumero"
+msgstr "E19: Merkillä on virheellinen rivinumero"
-#: ../globals.h:1027
msgid "E20: Mark not set"
-msgstr "E20: Merkki ei asetettu"
+msgstr "E20: Merkkiä ei asetettu"
-#: ../globals.h:1029
msgid "E21: Cannot make changes, 'modifiable' is off"
-msgstr "E21: Ei voi tehd muutoksia, modifiable on pois plt"
+msgstr "E21: Ei voi tehdä muutoksia, modifiable on pois päältä"
-#: ../globals.h:1030
msgid "E22: Scripts nested too deep"
-msgstr "E22: Liian monta tasoa skripteiss"
+msgstr "E22: Liian monta tasoa skripteissä"
-#: ../globals.h:1031
msgid "E23: No alternate file"
msgstr "E23: Eo vaihtoehtoista tiedostoa"
-#: ../globals.h:1032
msgid "E24: No such abbreviation"
-msgstr "E24: Lyhennett ei ole"
+msgstr "E24: Lyhennettä ei ole"
-#: ../globals.h:1033
msgid "E477: No ! allowed"
msgstr "E477: ! ei sallittu"
-#: ../globals.h:1035
-msgid "E25: Nvim does not have a built-in GUI"
-msgstr "E25: GUIta ei voi kytt, koska sit ei knnetty mukaan"
+#~ msgid "E25: Nvim does not have a built-in GUI"
+#~ msgstr ""
-#: ../globals.h:1036
#, c-format
msgid "E28: No such highlight group name: %s"
-msgstr "E28: Korostusryhm ei ole nimell: %s"
+msgstr "E28: Korostusryhmää ei ole nimellä: %s"
-#: ../globals.h:1037
msgid "E29: No inserted text yet"
-msgstr "E29: Teksti ei ole sytetty viel"
+msgstr "E29: Tekstiä ei ole syötetty vielä"
-#: ../globals.h:1038
msgid "E30: No previous command line"
-msgstr "E30: Ei edellist komentorivi"
+msgstr "E30: Ei edellistä komentoriviä"
-#: ../globals.h:1039
msgid "E31: No such mapping"
msgstr "E31: Kuvausta ei ole"
-#: ../globals.h:1040
msgid "E479: No match"
-msgstr "E479: Ei tsm"
+msgstr "E479: Ei täsmää"
-#: ../globals.h:1041
#, c-format
msgid "E480: No match: %s"
-msgstr "E480: Ei tsm: %s"
+msgstr "E480: Ei tsämää: %s"
-#: ../globals.h:1042
msgid "E32: No file name"
-msgstr "E32: Ei tiedostonime"
+msgstr "E32: Ei tiedostonimeä"
-#: ../globals.h:1044
msgid "E33: No previous substitute regular expression"
-msgstr "E33: Ei edellist korvausta snnlliselle ilmaukselle"
+msgstr "E33: Ei edellistä korvausta säännölliselle ilmaukselle"
-#: ../globals.h:1045
msgid "E34: No previous command"
-msgstr "E34: Ei edellist komentoa"
+msgstr "E34: Ei edellistä komentoa"
-#: ../globals.h:1046
msgid "E35: No previous regular expression"
-msgstr "E35: Ei edellist snnllist ilmausta"
+msgstr "E35: Ei edellistä säännöllistä ilmausta"
-#: ../globals.h:1047
msgid "E481: No range allowed"
msgstr "E481: Arvoalue ei sallittu"
-#: ../globals.h:1048
msgid "E36: Not enough room"
-msgstr "E36: Tila ei riit"
+msgstr "E36: Tila ei riitä"
-#: ../globals.h:1049
-#, c-format
-msgid "E482: Can't create file %s"
-msgstr "E482: Tiedostoa %s ei voi luoda"
-
-#: ../globals.h:1050
msgid "E483: Can't get temp file name"
-msgstr "E483: vliaikaistiedoston nime ei saada selville"
+msgstr "E483: väliaikaistiedoston nimeä ei saada selville"
-#: ../globals.h:1051
#, c-format
msgid "E484: Can't open file %s"
msgstr "E484: Ei voi avata tiedostoa %s"
-#: ../globals.h:1052
#, c-format
msgid "E485: Can't read file %s"
msgstr "E485: Ei voi lukea tiedostoa %s"
-#: ../globals.h:1054
msgid "E37: No write since last change (add ! to override)"
msgstr ""
-"E37: Viimeisen muutoksen jlkeen ei ole kirjoitettu (lis ! ohittaaksesi)"
+"E37: Viimeisen muutoksen jälkeen ei ole kirjoitettu (lisää ! ohittaaksesi)"
-#: ../globals.h:1055
-#, fuzzy
msgid "E37: No write since last change"
-msgstr "[Viimeisint muutosta ei ole kirjoitettu]\n"
+msgstr "E37: Viimeisimmän muutoksen jälkeen ei ole kirjoitettu mitään"
-#: ../globals.h:1056
msgid "E38: Null argument"
msgstr "E38: Null-argumentti"
-#: ../globals.h:1057
msgid "E39: Number expected"
-msgstr "E39: Pit olla numero"
+msgstr "E39: Pitää olla numero"
-#: ../globals.h:1058
#, c-format
msgid "E40: Can't open errorfile %s"
msgstr "E40: virhetiedostoa %s ei voi avata"
-#: ../globals.h:1059
msgid "E41: Out of memory!"
msgstr "E41: Muisti loppui"
-#: ../globals.h:1060
msgid "Pattern not found"
-msgstr "Kuviota ei lydy"
+msgstr "Kuviota ei löydy"
-#: ../globals.h:1061
#, c-format
msgid "E486: Pattern not found: %s"
-msgstr "E486: Kuviota ei lydy: %s"
+msgstr "E486: Kuviota ei löydy: %s"
-#: ../globals.h:1062
msgid "E487: Argument must be positive"
-msgstr "E487: Argumentin pit olla positiivinen"
+msgstr "E487: Argumentin pitää olla positiivinen"
-#: ../globals.h:1064
msgid "E459: Cannot go back to previous directory"
-msgstr "E459: Ei voi siirty edelliseen hakemistoon"
+msgstr "E459: Ei voi siirtyä edelliseen hakemistoon"
# ;-)
-#: ../globals.h:1066
msgid "E42: No Errors"
-msgstr "E42: Ei virheit"
+msgstr "E42: Ei virheitä"
-#: ../globals.h:1067
msgid "E776: No location list"
msgstr "E776: Ei sijaintilistaa"
-#: ../globals.h:1068
msgid "E43: Damaged match string"
-msgstr "E43: Viallinen tsmysmerkkijono"
+msgstr "E43: Viallinen täsmäysmerkkijono"
-#: ../globals.h:1069
msgid "E44: Corrupted regexp program"
msgstr "E44: Viallinen regexp-ohjelma"
-#: ../globals.h:1071
msgid "E45: 'readonly' option is set (add ! to override)"
-msgstr "E45: readonly asetettu (lis ! ohittaaksesi)"
-
-#: ../globals.h:1073
-#, c-format
-msgid "E46: Cannot change read-only variable \"%s\""
-msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa"
-
-#: ../globals.h:1075
-#, c-format
-msgid "E794: Cannot set variable in the sandbox: \"%s\""
-msgstr "E794: Muuttujaa ei voi asettaa hiekkalaatikossa: %s"
+msgstr "E45: readonly asetettu (lisää ! ohittaaksesi)"
-#: ../globals.h:1076
msgid "E47: Error while reading errorfile"
msgstr "E47: Virhe virhetiedostoa luettaessa"
-#: ../globals.h:1078
msgid "E48: Not allowed in sandbox"
msgstr "E48: Ei sallittu hiekkalaatikossa"
-#: ../globals.h:1080
msgid "E523: Not allowed here"
-msgstr "E523: Ei sallittu tll"
+msgstr "E523: Ei sallittu täällä"
-#: ../globals.h:1082
msgid "E359: Screen mode setting not supported"
-msgstr "E359: Nytttila-asetus ei tuettu"
+msgstr "E359: Näyttötila-asetus ei tuettu"
-#: ../globals.h:1083
msgid "E49: Invalid scroll size"
msgstr "E49: Virheellinen vierityskoko"
-#: ../globals.h:1084
msgid "E91: 'shell' option is empty"
-msgstr "E91: shell-asetus on tyhj"
+msgstr "E91: shell-asetus on tyhjä"
-#: ../globals.h:1085
msgid "E255: Couldn't read in sign data!"
msgstr "E255: Merkkidatan luku ei onnistu"
-#: ../globals.h:1086
msgid "E72: Close error on swap file"
msgstr "E72: Swap-tiedoston sulkemisvirhe"
-#: ../globals.h:1087
msgid "E73: tag stack empty"
-msgstr "E73: tgipino tyhj"
+msgstr "E73: tägipino tyhjä"
-#: ../globals.h:1088
msgid "E74: Command too complex"
msgstr "E74: Liian monimutkainen komento"
-#: ../globals.h:1089
msgid "E75: Name too long"
-msgstr "E75: Liian pitk nimi"
+msgstr "E75: Liian pitkä nimi"
-#: ../globals.h:1090
msgid "E76: Too many ["
msgstr "E76: Liian monta [:a"
-#: ../globals.h:1091
msgid "E77: Too many file names"
-msgstr "E77: Liikaa tiedostonimi"
+msgstr "E77: Liikaa tiedostonimiä"
-#: ../globals.h:1092
msgid "E488: Trailing characters"
-msgstr "E488: Ylimrisi merkkej perss"
+msgstr "E488: Ylimääräisiä merkkejä perässä"
-#: ../globals.h:1093
msgid "E78: Unknown mark"
msgstr "E78: Tuntematon merkki"
-#: ../globals.h:1094
msgid "E79: Cannot expand wildcards"
msgstr "E79: Jokerimerkkien avaus ei onnistu"
-#: ../globals.h:1096
msgid "E591: 'winheight' cannot be smaller than 'winminheight'"
msgstr "E591: winheight ei voi olla pienempi kuin winminheight"
-#: ../globals.h:1098
msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'"
msgstr "E592: winwidth ei voi olla pienempi kuin winminwidth"
-#: ../globals.h:1099
msgid "E80: Error while writing"
msgstr "E80: Kirjoitusvirhe"
-#: ../globals.h:1100
msgid "Zero count"
msgstr "Nollalaskuri"
-#: ../globals.h:1101
msgid "E81: Using <SID> not in a script context"
msgstr "E81: <SID> skriptin ulkopuolella"
-#: ../globals.h:1102
#, c-format
msgid "E685: Internal error: %s"
-msgstr "E685: Sisinen virhe: %s"
+msgstr "E685: Sisäinen virhe: %s"
-#: ../globals.h:1104
msgid "E363: pattern uses more memory than 'maxmempattern'"
-msgstr "E363: kuvio kytt enemmn muistia kuin maxmempattern on"
+msgstr "E363: kuvio käyttää enemmän muistia kuin maxmempattern on"
-#: ../globals.h:1105
msgid "E749: empty buffer"
-msgstr "E749: tyhj puskuri"
+msgstr "E749: tyhjä puskuri"
+
+#, fuzzy, c-format
+#~ msgid "E86: Buffer %<PRId64> does not exist"
+#~ msgstr "E86: Puskuria %ld ei ole"
-#: ../globals.h:1108
msgid "E682: Invalid search pattern or delimiter"
msgstr "E682: Virheellinen hakulauseke tai erotin"
-#: ../globals.h:1109
msgid "E139: File is loaded in another buffer"
msgstr "E139: Tiedosto on ladattu toiseen puskuriin"
-#: ../globals.h:1110
#, c-format
msgid "E764: Option '%s' is not set"
msgstr "E764: Asetus %s on asettamatta"
-#: ../globals.h:1111
-#, fuzzy
msgid "E850: Invalid register name"
-msgstr "E354: Virheellinen rekisterin nimi: %s"
+msgstr "E850: Virheellinen rekisterin nimi"
+
+#, c-format
+msgid "E919: Directory not found in '%s': \"%s\""
+msgstr "E919: Hakemisto puuttuu kohteesta %s: %s"
+
+msgid "E519: Option not supported"
+msgstr "E519: Asetusta ei tueta"
+
+#, fuzzy
+#~ msgid "E856: Filename too long"
+#~ msgstr "E75: Liian pitkä nimi"
+
+msgid "E806: using Float as a String"
+msgstr "E806: Float ei käy merkkijonosta"
-#: ../globals.h:1114
msgid "search hit TOP, continuing at BOTTOM"
-msgstr "haku psi ALKUUN, jatketaan LOPUSTA"
+msgstr "haku pääsi ALKUUN, jatketaan LOPUSTA"
-#: ../globals.h:1115
msgid "search hit BOTTOM, continuing at TOP"
-msgstr "haku psi LOPPUUN, jatketaan ALUSTA"
+msgstr "haku pääsi LOPPUUN, jatketaan ALUSTA"
-#: ../hardcopy.c:240
msgid "E550: Missing colon"
msgstr "E550: kaksoispiste puuttuu"
-#: ../hardcopy.c:252
msgid "E551: Illegal component"
msgstr "E551: Virheellinen komponentti"
-#: ../hardcopy.c:259
msgid "E552: digit expected"
-msgstr "E552: pitisi olla numero"
+msgstr "E552: pitäisi olla numero"
-#: ../hardcopy.c:473
#, c-format
msgid "Page %d"
msgstr "Sivu %d"
-#: ../hardcopy.c:597
msgid "No text to be printed"
-msgstr "Ei teksti tulostettavaksi"
+msgstr "Ei tekstiä tulostettavaksi"
-#: ../hardcopy.c:668
-#, c-format
-msgid "Printing page %d (%d%%)"
-msgstr "Tulostetaan sivua %d (%d %%)"
+#, fuzzy, c-format
+#~ msgid "Printing page %d (%zu%%)"
+#~ msgstr "Tulostetaan sivua %d (%d %%)"
-#: ../hardcopy.c:680
#, c-format
msgid " Copy %d of %d"
msgstr " Kopio %d/%d"
-#: ../hardcopy.c:733
#, c-format
msgid "Printed: %s"
msgstr "Tulostettu: %s"
-#: ../hardcopy.c:740
msgid "Printing aborted"
msgstr "Tulostus peruttu"
-#: ../hardcopy.c:1365
msgid "E455: Error writing to PostScript output file"
-msgstr "E455: Virhe kirjoitettaessa PostScripti tiedostoon"
+msgstr "E455: Virhe kirjoitettaessa PostScriptiä tiedostoon"
-#: ../hardcopy.c:1747
#, c-format
msgid "E624: Can't open file \"%s\""
msgstr "E624: Ei voi avata tiedostoa %s"
-#: ../hardcopy.c:1756 ../hardcopy.c:2470
#, c-format
msgid "E457: Can't read PostScript resource file \"%s\""
msgstr "E457: Ei voi lukea PostScript-resurssitiedostoa %s"
-#: ../hardcopy.c:1772
#, c-format
msgid "E618: file \"%s\" is not a PostScript resource file"
msgstr "E618: tiedosto %s ei ole PostScript-resurssitiedosto"
-#: ../hardcopy.c:1788 ../hardcopy.c:1805 ../hardcopy.c:1844
#, c-format
msgid "E619: file \"%s\" is not a supported PostScript resource file"
msgstr "E619: tiedosto %s ei ole tuettu PostScript-resurssitiedosto"
-#: ../hardcopy.c:1856
#, c-format
msgid "E621: \"%s\" resource file has wrong version"
-msgstr "E621: resurssitiedoston %s versio on vr"
+msgstr "E621: resurssitiedoston %s versio on väärä"
-#: ../hardcopy.c:2225
msgid "E673: Incompatible multi-byte encoding and character set."
-msgstr "E673: Tukematon monitvauinen merkistkoodaus ja merkist."
+msgstr "E673: Tukematon monitvauinen merkistökoodaus ja merkistö."
-#: ../hardcopy.c:2238
msgid "E674: printmbcharset cannot be empty with multi-byte encoding."
-msgstr "E674: printmbcharset ei voi olla tyhj monitavuiselle koodaukselle."
+msgstr "E674: printmbcharset ei voi olla tyhjä monitavuiselle koodaukselle."
-#: ../hardcopy.c:2254
msgid "E675: No default font specified for multi-byte printing."
msgstr "E675: Ei oletusfonttia monitavuiseen tulostukseen"
-#: ../hardcopy.c:2426
msgid "E324: Can't open PostScript output file"
msgstr "E324: PostScript-tulostetiedoston avaus ei onnistu"
-#: ../hardcopy.c:2458
#, c-format
msgid "E456: Can't open file \"%s\""
msgstr "E456: Tiedoston %s avaus ei onnistu"
-#: ../hardcopy.c:2583
msgid "E456: Can't find PostScript resource file \"prolog.ps\""
-msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei lydy"
+msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei löydy"
-#: ../hardcopy.c:2593
msgid "E456: Can't find PostScript resource file \"cidfont.ps\""
-msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei lydy"
+msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei löydy"
-#: ../hardcopy.c:2622 ../hardcopy.c:2639 ../hardcopy.c:2665
#, c-format
msgid "E456: Can't find PostScript resource file \"%s.ps\""
-msgstr "E456: Postscript-resurssitiedosta %s.ps ei lydy"
+msgstr "E456: Postscript-resurssitiedosta %s.ps ei löydy"
-#: ../hardcopy.c:2654
#, c-format
msgid "E620: Unable to convert to print encoding \"%s\""
msgstr "E620: Tulostuskoodaukseen %s muunto ei onnistu"
-#: ../hardcopy.c:2877
msgid "Sending to printer..."
-msgstr "Lhetetn tulostimelle..."
+msgstr "Lähetetään tulostimelle..."
-#: ../hardcopy.c:2881
msgid "E365: Failed to print PostScript file"
-msgstr "E365: PostScript-tiedoston tulostus eponnistui"
+msgstr "E365: PostScript-tiedoston tulostus epäonnistui"
-#: ../hardcopy.c:2883
msgid "Print job sent."
-msgstr "Tulostusty lhetetty."
+msgstr "Tulostustyö lähetetty."
-#: ../if_cscope.c:85
msgid "Add a new database"
-msgstr "Lis uusi tietokanta"
+msgstr "Lisää uusi tietokanta"
-#: ../if_cscope.c:87
msgid "Query for a pattern"
msgstr "Hae kuviota"
-#: ../if_cscope.c:89
msgid "Show this message"
-msgstr "Nyt tm viesti"
+msgstr "Näytä tämä viesti"
-#: ../if_cscope.c:91
msgid "Kill a connection"
msgstr "Tapa yhteys"
-#: ../if_cscope.c:93
msgid "Reinit all connections"
msgstr "Alusta uudelleen yhteydet"
-#: ../if_cscope.c:95
msgid "Show connections"
-msgstr "Nyt yhteydet"
+msgstr "Näytä yhteydet"
-#: ../if_cscope.c:101
#, c-format
msgid "E560: Usage: cs[cope] %s"
-msgstr "E560: Kytt: cs[cope] %s"
+msgstr "E560: Käyttö: cs[cope] %s"
-#: ../if_cscope.c:225
msgid "This cscope command does not support splitting the window.\n"
-msgstr "Tm cscope-komento ei tue ikkunan jakamista.\n"
+msgstr "Tämä cscope-komento ei tue ikkunan jakamista.\n"
-#: ../if_cscope.c:266
msgid "E562: Usage: cstag <ident>"
-msgstr "E562: Kytt: cstag <ident>"
+msgstr "E562: Käyttö: cstag <ident>"
-#: ../if_cscope.c:313
msgid "E257: cstag: tag not found"
-msgstr "E257: cstag: tgia ei lydy"
+msgstr "E257: cstag: tägia ei löydy"
-#: ../if_cscope.c:461
#, c-format
msgid "E563: stat(%s) error: %d"
msgstr "E563: stat(%s)-virhe: %d"
-#: ../if_cscope.c:551
#, c-format
msgid "E564: %s is not a directory or a valid cscope database"
-msgstr "E564: %s ei ole hakemisto eik cscope-tietokanta"
+msgstr "E564: %s ei ole hakemisto eikä cscope-tietokanta"
-#: ../if_cscope.c:566
#, c-format
msgid "Added cscope database %s"
-msgstr "Listty cscope-tietokanta %s"
+msgstr "Lisätty cscope-tietokanta %s"
-#: ../if_cscope.c:616
-#, c-format
-msgid "E262: error reading cscope connection %<PRId64>"
-msgstr "E262: Virhe luettaessa cscope-yhteytt %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "E262: error reading cscope connection %<PRIu64>"
+#~ msgstr "E262: Virhe luettaessa cscope-yhteyttä %ld"
-#: ../if_cscope.c:711
msgid "E561: unknown cscope search type"
msgstr "E561: tuntematon cscope-hakutyyppi"
-#: ../if_cscope.c:752 ../if_cscope.c:789
msgid "E566: Could not create cscope pipes"
msgstr "E566: Ei voitu luoda cscope-putkia"
-#: ../if_cscope.c:767
msgid "E622: Could not fork for cscope"
msgstr "E622: Ei voitu haarauttaa cscopea"
-#: ../if_cscope.c:849
-#, fuzzy
msgid "cs_create_connection setpgid failed"
-msgstr "cs_create_connection eponnistui"
+msgstr "cs_create_connection setpgid epäonnistui"
-#: ../if_cscope.c:853 ../if_cscope.c:889
msgid "cs_create_connection exec failed"
-msgstr "cs_create_connection eponnistui"
+msgstr "cs_create_connection epäonnistui"
-#: ../if_cscope.c:863 ../if_cscope.c:902
msgid "cs_create_connection: fdopen for to_fp failed"
-msgstr "cs_create_connection: fdopen to_fp eponnistui"
+msgstr "cs_create_connection: fdopen to_fp epäonnistui"
-#: ../if_cscope.c:865 ../if_cscope.c:906
msgid "cs_create_connection: fdopen for fr_fp failed"
-msgstr "cs_create_connection: fdopen fr_fp eponnistui"
+msgstr "cs_create_connection: fdopen fr_fp epäonnistui"
-#: ../if_cscope.c:890
msgid "E623: Could not spawn cscope process"
-msgstr "E623: Cscope-prosessin luonti eponnistui"
+msgstr "E623: Cscope-prosessin luonti epäonnistui"
-#: ../if_cscope.c:932
msgid "E567: no cscope connections"
-msgstr "E567: ei cscope-yhteyksi"
+msgstr "E567: ei cscope-yhteyksiä"
-#: ../if_cscope.c:1009
#, c-format
msgid "E469: invalid cscopequickfix flag %c for %c"
msgstr "E469: virheellinen cscopequickfix-asetus %c kohteelle %c"
-#: ../if_cscope.c:1058
#, c-format
msgid "E259: no matches found for cscope query %s of %s"
-msgstr "E259: ei tsmyksi cscope-hakuun %s/%s"
+msgstr "E259: ei täsmäyksiä cscope-hakuun %s/%s"
-#: ../if_cscope.c:1142
msgid "cscope commands:\n"
msgstr "cscope-komennot:\n"
-#: ../if_cscope.c:1150
#, c-format
msgid "%-5s: %s%*s (Usage: %s)"
-msgstr "%-5s: %s%*s (Kytt: %s)"
+msgstr "%-5s: %s%*s (Käyttö: %s)"
-#: ../if_cscope.c:1155
-#, fuzzy
msgid ""
"\n"
+" a: Find assignments to this symbol\n"
" c: Find functions calling this function\n"
" d: Find functions called by this function\n"
" e: Find this egrep pattern\n"
@@ -3246,40 +3092,36 @@ msgid ""
" t: Find this text string\n"
msgstr ""
"\n"
-" c: Etsi tt funktiota kutsuvat funktiot\n"
-" d: Etsi tmn funktion kutsumat funktiot\n"
-" e: Etsi tm egrep-lauseke\n"
-" f: Find tm tiedosto\n"
-" g: Etsi tm mritys\n"
-" i: Etsi tiedostoja jotka #inkluudaavat tmn\n"
-" s: Etsi tm C-symboli\n"
+" a: Etsi sijotukset tähän symboliin\n"
+" c: Etsi tätä funktiota kutsuvat funktiot\n"
+" d: Etsi tämän funktion kutsumat funktiot\n"
+" e: Etsi tämä egrep-lauseke\n"
+" f: Etsi tämä tiedosto\n"
+" g: Etsi tämä määritys\n"
+" i: Etsi tiedostoja jotka #inkluudaavat tämän\n"
+" s: Etsi tämä C-symboli\n"
" t: Etsi sijoitukset muuttujaan \n"
-#: ../if_cscope.c:1226
msgid "E568: duplicate cscope database not added"
-msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei listty"
+msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei lisätty"
-#: ../if_cscope.c:1335
#, c-format
msgid "E261: cscope connection %s not found"
msgstr "E261: cscope-yhteys %s puuttuu"
-#: ../if_cscope.c:1364
#, c-format
msgid "cscope connection %s closed"
msgstr "cscope-yhteys %s on katkaistu"
#. should not reach here
-#: ../if_cscope.c:1486
msgid "E570: fatal error in cs_manage_matches"
msgstr "E570: kriittinen virhe cs_manage_matches-funktiossa"
-#: ../if_cscope.c:1693
#, c-format
msgid "Cscope tag: %s"
-msgstr "Cscope-tgi: %s"
+msgstr "Cscope-tägi: %s"
-#: ../if_cscope.c:1711
+#. Column headers for match number, line number and filename.
msgid ""
"\n"
" # line"
@@ -3287,326 +3129,272 @@ msgstr ""
"\n"
" # rivi"
-#: ../if_cscope.c:1713
msgid "filename / context / line\n"
msgstr "tiedosto / konteksti / rivi\n"
-#: ../if_cscope.c:1809
#, c-format
msgid "E609: Cscope error: %s"
msgstr "E609: Cscope-virhe: %s"
-#: ../if_cscope.c:2053
msgid "All cscope databases reset"
msgstr "Kaikki cscope-tietokannat nollattu"
-#: ../if_cscope.c:2123
msgid "no cscope connections\n"
-msgstr "ei cscope-yhteyksi\n"
+msgstr "ei cscope-yhteyksiä\n"
-#: ../if_cscope.c:2126
msgid " # pid database name prepend path\n"
-msgstr " # pid tietokanta lisyspolku\n"
+msgstr " # pid tietokanta lisäyspolku\n"
+
+#. Error messages
+msgid "Argument missing after"
+msgstr "Argumentti puuttuu kohdasta"
+
+msgid "Garbage after option argument"
+msgstr "Roskaa argumentin perässä"
-#: ../main.c:144
msgid "Unknown option argument"
msgstr "Tuntematon asetusargumentti"
-#: ../main.c:146
msgid "Too many edit arguments"
msgstr "Liikaa muokkausargumentteja"
-#: ../main.c:148
-msgid "Argument missing after"
-msgstr "Argumentti puuttuu kohdasta"
-
-#: ../main.c:150
-msgid "Garbage after option argument"
-msgstr "Roskaa argumentin perss"
-
-#: ../main.c:152
msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments"
msgstr "Liikaa +komentoja, -c-komentoja tai --cmd-komentoja"
-#: ../main.c:154
-msgid "Invalid argument for"
-msgstr "Vr argumentti valitsimelle"
-
-#: ../main.c:294
-#, c-format
-msgid "%d files to edit\n"
-msgstr "%d tiedostoa muokattavana\n"
-
-#: ../main.c:1342
msgid "Attempt to open script file again: \""
msgstr "Yritettiin avata skriptitiedostoa uudestaan:"
-#: ../main.c:1350
msgid "Cannot open for reading: \""
msgstr "Ei voi avata luettavaksi: "
-#: ../main.c:1393
msgid "Cannot open for script output: \""
msgstr "Ei voi avata skriptin tulostetta varten: "
-#: ../main.c:1622
msgid "Vim: Warning: Output is not to a terminal\n"
msgstr "Vim: Varoitus: Tuloste ei mene terminaalille\n"
-#: ../main.c:1624
msgid "Vim: Warning: Input is not from a terminal\n"
-msgstr "Vim: Varoitus: Syte ei tule terminaalilta\n"
+msgstr "Vim: Varoitus: Syöte ei tule terminaalilta\n"
#. just in case..
-#: ../main.c:1891
msgid "pre-vimrc command line"
msgstr "esi-vimrc-komentorivi"
-#: ../main.c:1964
#, c-format
msgid "E282: Cannot read from \"%s\""
msgstr "E282: Ei voida lukea kohteesta %s"
-#: ../main.c:2149
+#, fuzzy
msgid ""
"\n"
-"More info with: \"vim -h\"\n"
+"More info with \""
msgstr ""
"\n"
-"Listietoja: \"vim -h\"\n"
-
-#: ../main.c:2178
-msgid "[file ..] edit specified file(s)"
-msgstr "[tiedosto ..] muokkaa tiedostoja"
-
-#: ../main.c:2179
-msgid "- read text from stdin"
-msgstr "- lue vakiosytteest"
+"Lisätietoja: \"vim -h\"\n"
-#: ../main.c:2180
-msgid "-t tag edit file where tag is defined"
-msgstr "-t tgi muokkaa tiedostoa tgist"
+#. kill us with CTRL-C here, if you like
+#, fuzzy
+#~ msgid "Usage:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "\n"
+#~ "käyttö:"
-#: ../main.c:2181
-msgid "-q [errorfile] edit file with first error"
-msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmisest virheest"
+#, fuzzy
+#~ msgid " nvim [arguments] [file ...] Edit specified file(s)\n"
+#~ msgstr "[tiedosto ..] muokkaa tiedostoja"
-#: ../main.c:2187
-msgid ""
-"\n"
-"\n"
-"usage:"
-msgstr ""
-"\n"
-"\n"
-"kytt:"
+#, fuzzy
+#~ msgid " nvim [arguments] - Read text from stdin\n"
+#~ msgstr "- lue vakiosyötteestä"
-#: ../main.c:2189
-msgid " vim [arguments] "
-msgstr " vim [argumentit] "
+#, fuzzy
+#~ msgid " nvim [arguments] -t <tag> Edit file where tag is defined\n"
+#~ msgstr "-t tägi muokkaa tiedostoa tägistä"
-#: ../main.c:2193
-msgid ""
-"\n"
-" or:"
-msgstr ""
-"\n"
-" tai:"
+#, fuzzy
+#~ msgid " nvim [arguments] -q [errorfile] Edit file with first error\n"
+#~ msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmäisestä virheestä"
-#: ../main.c:2196
+#, fuzzy
msgid ""
"\n"
-"\n"
"Arguments:\n"
msgstr ""
"\n"
"\n"
"Argumentit:\n"
-#: ../main.c:2197
-msgid "--\t\t\tOnly file names after this"
-msgstr "--\t\t\tvain tiedostonimi tmn jlkeen"
-
-#: ../main.c:2199
-msgid "--literal\t\tDon't expand wildcards"
-msgstr "--literal\t\tl ksittele jokerimerkkej "
-
-#: ../main.c:2201
-msgid "-v\t\t\tVi mode (like \"vi\")"
-msgstr "-v\t\t\tVi-tila (kuten vill)"
+#, fuzzy
+#~ msgid " -- Only file names after this\n"
+#~ msgstr "--\t\t\tvain tiedostonimiä tämän jälkeen"
-#: ../main.c:2202
-msgid "-e\t\t\tEx mode (like \"ex\")"
-msgstr "-e\t\t\tEx-tila (kute exill)"
+#, fuzzy
+#~ msgid " --literal Don't expand wildcards\n"
+#~ msgstr "--literal\t\tÄlä käsittele jokerimerkkejä "
-#: ../main.c:2203
-msgid "-E\t\t\tImproved Ex mode"
-msgstr ""
+#, fuzzy
+#~ msgid " -e Ex mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2204
-msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")"
-msgstr "-s\t\t\tHiljainen (erajo)tila (vain exill)"
+#, fuzzy
+#~ msgid " -E Improved Ex mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2205
-msgid "-d\t\t\tDiff mode (like \"vimdiff\")"
-msgstr "-d\t\t\tDiff-tila (kuten vimdiffill)"
+#, fuzzy
+#~ msgid " -s Silent (batch) mode (only for ex mode)\n"
+#~ msgstr "-s\t\t\tHiljainen (eräajo)tila (vain exillä)"
-#: ../main.c:2206
-msgid "-y\t\t\tEasy mode (like \"evim\", modeless)"
-msgstr "-y\t\t\tHelppokytttila (kuten evimiss, ilman tiloja)"
+#, fuzzy
+#~ msgid " -d Diff mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2207
-msgid "-R\t\t\tReadonly mode (like \"view\")"
-msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)"
+#, fuzzy
+#~ msgid " -R Read-only mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tRajoitettu tila (kuten rvimill)"
+#, fuzzy
+#~ msgid " -Z Restricted mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2209
-msgid "-m\t\t\tModifications (writing files) not allowed"
-msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois kytst"
+#, fuzzy
+#~ msgid " -m Modifications (writing files) not allowed\n"
+#~ msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois käytöstä"
-#: ../main.c:2210
-msgid "-M\t\t\tModifications in text not allowed"
-msgstr "-M\t\t\tTekstin muokkaus pois kytst"
+#, fuzzy
+#~ msgid " -M Modifications in text not allowed\n"
+#~ msgstr "-M\t\t\tTekstin muokkaus pois käytöstä"
-#: ../main.c:2211
-msgid "-b\t\t\tBinary mode"
-msgstr "-b\t\t\tBinritila"
+#, fuzzy
+#~ msgid " -b Binary mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2212
-msgid "-l\t\t\tLisp mode"
-msgstr "-l\t\t\tLisp-tila"
+#, fuzzy
+#~ msgid " -l Lisp mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2213
-msgid "-C\t\t\tCompatible with Vi: 'compatible'"
-msgstr "-C\t\t\tVi-yhteensopivuustila: compatible"
+#, fuzzy
+#~ msgid " -A Arabic mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2214
-msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'"
-msgstr "-N\t\t\tEi Vi-yhteensopivuutta: nocompatible"
+#, fuzzy
+#~ msgid " -F Farsi mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2215
-msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]"
-msgstr ""
-"-V[N][tnimi]\t\tMonisanainen tuloste [Taso N] [kirjoita tuloste tnimeen] "
+#, fuzzy
+#~ msgid " -H Hebrew mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2216
-msgid "-D\t\t\tDebugging mode"
-msgstr "-D\t\t\tVianetsinttila"
+#, fuzzy
+#~ msgid " -V[N][file] Be verbose [level N][log messages to file]\n"
+#~ msgstr ""
+#~ "-V[N][tnimi]\t\tMonisanainen tuloste [Taso N] [kirjoita tuloste tnimeen] "
-#: ../main.c:2217
-msgid "-n\t\t\tNo swap file, use memory only"
-msgstr "-n\t\t\tEi swap-tiedostoja, kyt muistia"
+#, fuzzy
+#~ msgid " -D Debugging mode\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2218
-msgid "-r\t\t\tList swap files and exit"
-msgstr "-r\t\t\tLuetteloi swap-tiedostot ja poistu"
+#, fuzzy
+#~ msgid " -n No swap file, use memory only\n"
+#~ msgstr "-n\t\t\tEi swap-tiedostoja, käytä muistia"
-#: ../main.c:2219
-msgid "-r (with file name)\tRecover crashed session"
-msgstr "-r (tiedostonimi)\tPalauta kaatunut sessio"
+#, fuzzy
+#~ msgid " -r, -L List swap files and exit\n"
+#~ msgstr "-r\t\t\tLuetteloi swap-tiedostot ja poistu"
-#: ../main.c:2220
-msgid "-L\t\t\tSame as -r"
-msgstr "-L\t\t\tkuten -r"
+#, fuzzy
+#~ msgid " -r <file> Recover crashed session\n"
+#~ msgstr "-r (tiedostonimi)\tPalauta kaatunut sessio"
-#: ../main.c:2221
-msgid "-A\t\t\tstart in Arabic mode"
-msgstr "-A\t\t\tkynnist arabia-tilassa"
+#, fuzzy
+#~ msgid " -u <vimrc> Use <vimrc> instead of the default\n"
+#~ msgstr "-u <vimrc>\t\tKäytä <vimrc>-tiedostoa .vimrc:iden sijasta"
-#: ../main.c:2222
-msgid "-H\t\t\tStart in Hebrew mode"
-msgstr "-H\t\t\tkynnist heprea-tilassa"
+#~ msgid " -i <shada> Use <shada> instead of the default\n"
+#~ msgstr ""
-#: ../main.c:2223
-msgid "-F\t\t\tStart in Farsi mode"
-msgstr "-F\t\t\tkynnist farsi-tilassa"
+#, fuzzy
+#~ msgid " --noplugin Don't load plugin scripts\n"
+#~ msgstr "--noplugin\t\tÄlä lataa liitännäisiä"
-#: ../main.c:2224
-msgid "-T <terminal>\tSet terminal type to <terminal>"
-msgstr "-T <terminaali>\tAseta terminaalin tyypiksi <terminaali>"
+#, fuzzy
+#~ msgid " -o[N] Open N windows (default: one for each file)\n"
+#~ msgstr "-o[N]\t\tAvaa N ikkunaa (oletus: yksi per tiedosto)"
-#: ../main.c:2225
-msgid "-u <vimrc>\t\tUse <vimrc> instead of any .vimrc"
-msgstr "-u <vimrc>\t\tKyt <vimrc>-tiedostoa .vimrc:iden sijasta"
+#, fuzzy
+#~ msgid " -O[N] Like -o but split vertically\n"
+#~ msgstr "-O[N]\t\tKuten -o, mutta jaa pystysuunnassa"
-#: ../main.c:2226
-msgid "--noplugin\t\tDon't load plugin scripts"
-msgstr "--noplugin\t\tl lataa liitnnisi"
+#, fuzzy
+#~ msgid " -p[N] Open N tab pages (default: one for each file)\n"
+#~ msgstr "-p[N]\t\tAvaa N välilehteä (oletus: yksi per tiedosto)"
-#: ../main.c:2227
-msgid "-p[N]\t\tOpen N tab pages (default: one for each file)"
-msgstr "-p[N]\t\tAvaa N vlilehte (oletus: yksi per tiedosto)"
+#, fuzzy
+#~ msgid " + Start at end of file\n"
+#~ msgstr " kahta tilaa varten "
-#: ../main.c:2228
-msgid "-o[N]\t\tOpen N windows (default: one for each file)"
-msgstr "-o[N]\t\tAvaa N ikkunaa (oletus: yksi per tiedosto)"
+#, fuzzy
+#~ msgid " +<linenum> Start at line <linenum>\n"
+#~ msgstr "+<rivi>\t\t\tAloita riviltä <rivi>"
-#: ../main.c:2229
-msgid "-O[N]\t\tLike -o but split vertically"
-msgstr "-O[N]\t\tKuten -o, mutta jaa pystysuunnassa"
+#~ msgid " +/<pattern> Start at first occurrence of <pattern>\n"
+#~ msgstr ""
-#: ../main.c:2230
-msgid "+\t\t\tStart at end of file"
-msgstr "+\t\t\tAloita tiedoston lopusta"
+#, fuzzy
+#~ msgid " --cmd <command> Execute <command> before loading any vimrc\n"
+#~ msgstr "--cmd <komento>\tSuorita <komento> ennen vimrc:iden latausta"
-#: ../main.c:2231
-msgid "+<lnum>\t\tStart at line <lnum>"
-msgstr "+<rivi>\t\t\tAloita rivilt <rivi>"
+#, fuzzy
+msgid ""
+" -c <command> Execute <command> after loading the first file\n"
+msgstr "-c <komento>\t\tSuorita <komento> ensimmäisen tiedoston latauduttua"
-#: ../main.c:2232
-msgid "--cmd <command>\tExecute <command> before loading any vimrc file"
-msgstr "--cmd <komento>\tSuorita <komento> ennen vimrc:iden latausta"
+#, fuzzy
+#~ msgid " -S <session> Source <session> after loading the first file\n"
+#~ msgstr "-S <sessio>\t\tLataa <sessio> ensimmäisen tiedoston latauduttua"
-#: ../main.c:2233
-msgid "-c <command>\t\tExecute <command> after loading the first file"
-msgstr "-c <komento>\t\tSuorita <komento> ensimmisen tiedoston latauduttua"
+#, fuzzy
+#~ msgid " -s <scriptin> Read Normal mode commands from <scriptin>\n"
+#~ msgstr "-s <skripti>\tLue normaalitilan komentoja <skripti>-tiedostosta"
-#: ../main.c:2235
-msgid "-S <session>\t\tSource file <session> after loading the first file"
-msgstr "-S <sessio>\t\tLataa <sessio> ensimmisen tiedoston latauduttua"
+#, fuzzy
+#~ msgid " -w <scriptout> Append all typed characters to <scriptout>\n"
+#~ msgstr "-w <skripti>\tLisää kirjoitetut komennot <skripti>-tiedostoon"
-#: ../main.c:2236
-msgid "-s <scriptin>\tRead Normal mode commands from file <scriptin>"
-msgstr "-s <skripti>\tLue normaalitilan komentoja <skripti>-tiedostosta"
+#, fuzzy
+#~ msgid " -W <scriptout> Write all typed characters to <scriptout>\n"
+#~ msgstr "-W <skripti>\tKirjoita komennot <skripti>-tiedostoon"
-#: ../main.c:2237
-msgid "-w <scriptout>\tAppend all typed commands to file <scriptout>"
-msgstr "-w <skripti>\tLis kirjoitetut komennot <skripti>-tiedostoon"
+#, fuzzy
+#~ msgid " --startuptime <file> Write startup timing messages to <file>\n"
+#~ msgstr "--startuptime <file>\tKirjoita käynnistysaikaviestit tiedostoon <file>"
-#: ../main.c:2238
-msgid "-W <scriptout>\tWrite all typed commands to file <scriptout>"
-msgstr "-W <skripti>\tKirjoita komennot <skripti>-tiedostoon"
+#~ msgid ""
+#~ " --api-info Dump API metadata serialized to msgpack and exit\n"
+#~ msgstr ""
-#: ../main.c:2240
-msgid "--startuptime <file>\tWrite startup timing messages to <file>"
-msgstr "--startuptime <file>\tKirjoita kynnistysaikaviestit tiedostoon <file>"
+#~ msgid " --embed Use stdin/stdout as a msgpack-rpc channel\n"
+#~ msgstr ""
-#: ../main.c:2242
-msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo"
-msgstr "-i <viminfo>\t\tKyt <viminfo>-tiedostoa .viminfon sijaan"
+#~ msgid " --headless Don't start a user interface\n"
+#~ msgstr ""
-#: ../main.c:2243
-msgid "-h or --help\tPrint Help (this message) and exit"
-msgstr "-h tai --help\tTulosta ohje (tm viesti) ja lopeta"
+#, fuzzy
+#~ msgid " -v, --version Print version information and exit\n"
+#~ msgstr "--version\t\t\tTulosta versiotiedot ja lopeta"
-#: ../main.c:2244
-msgid "--version\t\tPrint version information and exit"
-msgstr "--version\t\t\tTulosta versiotiedot ja lopeta"
+#, fuzzy
+#~ msgid " -h, --help Print this help message and exit\n"
+#~ msgstr "-h tai --help\tTulosta ohje (tämä viesti) ja lopeta"
-#: ../mark.c:676
msgid "No marks set"
-msgstr "Ei asetettuja merkkej"
+msgstr "Ei asetettuja merkkejä"
-#: ../mark.c:678
#, c-format
msgid "E283: No marks matching \"%s\""
-msgstr "E283: Mikn merkki ei tsm ilmaukseen \"%s\""
+msgstr "E283: Mikään merkki ei täsmää ilmaukseen \"%s\""
#. Highlight title
-#: ../mark.c:687
msgid ""
"\n"
"mark line col file/text"
@@ -3615,7 +3403,6 @@ msgstr ""
"merkki rivi sarake tiedosto/teksti"
#. Highlight title
-#: ../mark.c:789
msgid ""
"\n"
" jump line col file/text"
@@ -3624,7 +3411,6 @@ msgstr ""
"hyppy rivi sarake tiedosto/teksti"
#. Highlight title
-#: ../mark.c:831
msgid ""
"\n"
"change line col text"
@@ -3632,138 +3418,85 @@ msgstr ""
"\n"
"muutos rivi sarake teksti"
-#: ../mark.c:1238
-msgid ""
-"\n"
-"# File marks:\n"
-msgstr ""
-"\n"
-"# Tiedoston merkit:\n"
-
-#. Write the jumplist with -'
-#: ../mark.c:1271
-msgid ""
-"\n"
-"# Jumplist (newest first):\n"
-msgstr ""
-"\n"
-"# Hyppylista (uusin ensiksi):\n"
-
-#: ../mark.c:1352
-msgid ""
-"\n"
-"# History of marks within files (newest to oldest):\n"
-msgstr ""
-"\n"
-"# Tiedostojen merkkien historia (uusimmasta vanhimpaan):\n"
-
-#: ../mark.c:1431
-msgid "Missing '>'"
-msgstr "> puuttuu"
-
-#: ../memfile.c:426
msgid "E293: block was not locked"
msgstr "E293: lohkoa ei ole lukittu"
-#: ../memfile.c:799
msgid "E294: Seek error in swap file read"
msgstr "E294: Hakuvirhe swap-tiedostoa luettaessa"
-#: ../memfile.c:803
msgid "E295: Read error in swap file"
msgstr "E295: Lukuvirhe swap-tiedostossa"
-#: ../memfile.c:849
msgid "E296: Seek error in swap file write"
msgstr "E296: Hakuvirhe swap-tiedostoa kirjoitettaessa"
-#: ../memfile.c:865
msgid "E297: Write error in swap file"
msgstr "E297: Kirjoitusvirhe swap-tiedostossa"
-#: ../memfile.c:1036
msgid "E300: Swap file already exists (symlink attack?)"
-msgstr "E300: Swaptiedosto on jo olemassa (symlink-hykkys?)"
+msgstr "E300: Swaptiedosto on jo olemassa (symlink-hyökkäys?)"
-#: ../memline.c:318
msgid "E298: Didn't get block nr 0?"
msgstr "E298: Lohko 0:aa ei saatu?"
-#: ../memline.c:361
msgid "E298: Didn't get block nr 1?"
-msgstr "E298: Lohko 1:t ei saatu?"
+msgstr "E298: Lohko 1:tä ei saatu?"
-#: ../memline.c:377
msgid "E298: Didn't get block nr 2?"
msgstr "E298: Lohko 2:ta ei saatu?"
#. could not (re)open the swap file, what can we do????
-#: ../memline.c:465
msgid "E301: Oops, lost the swap file!!!"
-msgstr "E301: Hups, swap-tiedosto hvisi!"
+msgstr "E301: Hups, swap-tiedosto hävisi!"
-#: ../memline.c:477
msgid "E302: Could not rename swap file"
msgstr "E302: Swap-tiedoston uudellennimeys ei onnistu"
-#: ../memline.c:554
#, c-format
msgid "E303: Unable to open swap file for \"%s\", recovery impossible"
msgstr "E303: Swap-tiedostoa %s ei voi avata, palautus ei onnistu"
-#: ../memline.c:666
msgid "E304: ml_upd_block0(): Didn't get block 0??"
msgstr "E304: ml_upd_block0(): Lohko 0:aa ei saatu?"
#. no swap files found
-#: ../memline.c:830
#, c-format
msgid "E305: No swap file found for %s"
msgstr "E305: Ei swap-tiedostoa tiedostolle %s"
-#: ../memline.c:839
msgid "Enter number of swap file to use (0 to quit): "
msgstr "Anna swap-tiedoston numero tai 0 lopettaaksesi: "
-#: ../memline.c:879
#, c-format
msgid "E306: Cannot open %s"
msgstr "E306: Ei voi avata tiedostoa %s"
-#: ../memline.c:897
msgid "Unable to read block 0 from "
msgstr "Ei voi lukea lohkoa 0 kohteesta "
-#: ../memline.c:900
msgid ""
"\n"
"Maybe no changes were made or Vim did not update the swap file."
msgstr ""
"\n"
-"Muutoksia ei tehty, tai Vim ei pivittnyt swap-tiedostoa."
+"Muutoksia ei tehty, tai Vim ei päivittänyt swap-tiedostoa."
-#: ../memline.c:909
msgid " cannot be used with this version of Vim.\n"
-msgstr " ei toimi tmn version Vimin kanssa.\n"
+msgstr " ei toimi tämän version Vimin kanssa.\n"
-#: ../memline.c:911
msgid "Use Vim version 3.0.\n"
-msgstr "Kyt Vimin versiota 3.0\n"
+msgstr "Käytä Vimin versiota 3.0\n"
-#: ../memline.c:916
#, c-format
msgid "E307: %s does not look like a Vim swap file"
msgstr "E307: %s ei ole Vimin swap-tiedosto"
-#: ../memline.c:922
msgid " cannot be used on this computer.\n"
-msgstr " ei toimi tll koneella.\n"
+msgstr " ei toimi tällä koneella.\n"
-#: ../memline.c:924
msgid "The file was created on "
msgstr "Tiedosto luotiin "
-#: ../memline.c:928
msgid ""
",\n"
"or the file has been damaged."
@@ -3771,100 +3504,78 @@ msgstr ""
",\n"
"tai tiedosto on vahingoittunut."
-#: ../memline.c:945
msgid " has been damaged (page size is smaller than minimum value).\n"
-msgstr " on vioittunut (sivun koko on vhimmisarvoa pienempi).\n"
+msgstr " on vioittunut (sivun koko on vähimmäisarvoa pienempi).\n"
-#: ../memline.c:974
#, c-format
msgid "Using swap file \"%s\""
-msgstr "Kytetn swap-tiedostoa %s"
+msgstr "Käytetään swap-tiedostoa %s"
-#: ../memline.c:980
#, c-format
msgid "Original file \"%s\""
-msgstr "Alkuperinen tiedosto %s"
+msgstr "Alkuperäinen tiedosto %s"
-#: ../memline.c:995
msgid "E308: Warning: Original file may have been changed"
-msgstr "E308: Varoitus: Alkuperist tiedostoa saattaa olla muutettu"
+msgstr "E308: Varoitus: Alkuperäistä tiedostoa saattaa olla muutettu"
-#: ../memline.c:1061
#, c-format
msgid "E309: Unable to read block 1 from %s"
msgstr "E309: Ei voitu lukea lohkoa 1 tiedostosta %s"
-#: ../memline.c:1065
msgid "???MANY LINES MISSING"
-msgstr "???PALJON RIVEJ PUUTTUU"
+msgstr "???PALJON RIVEJÄ PUUTTUU"
-#: ../memline.c:1076
msgid "???LINE COUNT WRONG"
-msgstr "???RIVIMR PIELESS"
+msgstr "???RIVIMÄÄRÄ PIELESSÄ"
-#: ../memline.c:1082
msgid "???EMPTY BLOCK"
-msgstr "???TYHJ LOHKO"
+msgstr "???TYHJÄ LOHKO"
-#: ../memline.c:1103
msgid "???LINES MISSING"
-msgstr "???RIVEJ PUUTTUU"
+msgstr "???RIVEJÄ PUUTTUU"
-#: ../memline.c:1128
#, c-format
msgid "E310: Block 1 ID wrong (%s not a .swp file?)"
-msgstr "E310: Lohon 1 tunniste vr (%s ei ole .swp-tiedosto?)"
+msgstr "E310: Lohon 1 tunniste väärä (%s ei ole .swp-tiedosto?)"
-#: ../memline.c:1133
msgid "???BLOCK MISSING"
msgstr "???LOHKO PUUTTUU"
-#: ../memline.c:1147
msgid "??? from here until ???END lines may be messed up"
-msgstr "??? tst kohtaan ???LOPPU rivej sekaisin"
+msgstr "??? tästä kohtaan ???LOPPU rivejä sekaisin"
-#: ../memline.c:1164
msgid "??? from here until ???END lines may have been inserted/deleted"
-msgstr "??? tst kohtaan ???LOPPU rivej saattaa olla listty tai poistettu"
+msgstr "??? tästä kohtaan ???LOPPU rivejä saattaa olla lisätty tai poistettu"
-#: ../memline.c:1181
msgid "???END"
msgstr "???LOPPU"
-#: ../memline.c:1238
msgid "E311: Recovery Interrupted"
msgstr "E311: Palautus keskeytetty"
-#: ../memline.c:1243
msgid ""
"E312: Errors detected while recovering; look for lines starting with ???"
-msgstr "E312: Palautuksessa oli virheit, etsi rivej, jotka alkavat ???"
+msgstr "E312: Palautuksessa oli virheitä, etsi rivejä, jotka alkavat ???"
-#: ../memline.c:1245
msgid "See \":help E312\" for more information."
-msgstr ":help E312 kertoo listietoja"
+msgstr ":help E312 kertoo lisätietoja"
-#: ../memline.c:1249
msgid "Recovery completed. You should check if everything is OK."
-msgstr "Palautus onnistui. Tarkista, ett kaikki on kunnossa."
+msgstr "Palautus onnistui. Tarkista, että kaikki on kunnossa."
-#: ../memline.c:1251
msgid ""
"\n"
"(You might want to write out this file under another name\n"
msgstr ""
"\n"
-"(Saattaa kannattaa kirjoittaa tm tiedosto toisella nimell\n"
+"(Saattaa kannattaa kirjoittaa tämä tiedosto toisella nimellä\n"
-#: ../memline.c:1252
msgid "and run diff with the original file to check for changes)"
-msgstr "ja katso diffill muutokset alkuperiseen tiedostoon)"
+msgstr "ja katso diffillä muutokset alkuperäiseen tiedostoon)"
-#: ../memline.c:1254
msgid "Recovery completed. Buffer contents equals file contents."
-msgstr "Palautus onnistui. Puskurin ja tiedoston sisllt tsmvt."
+msgstr "Palautus onnistui. Puskurin ja tiedoston sisällöt täsmäävät."
-#: ../memline.c:1255
msgid ""
"\n"
"You may want to delete the .swp file now.\n"
@@ -3875,51 +3586,42 @@ msgstr ""
"\n"
#. use msg() to start the scrolling properly
-#: ../memline.c:1327
msgid "Swap files found:"
-msgstr "Swap-tiedostoja lytyi:"
+msgstr "Swap-tiedostoja löytyi:"
-#: ../memline.c:1446
msgid " In current directory:\n"
-msgstr " Tss hakemistossa:\n"
+msgstr " Tässä hakemistossa:\n"
-#: ../memline.c:1448
msgid " Using specified name:\n"
-msgstr " Mritellyll nimell:\n"
+msgstr " Määritellyllä nimellä:\n"
-#: ../memline.c:1450
msgid " In directory "
msgstr " Hakemistossa "
-#: ../memline.c:1465
msgid " -- none --\n"
-msgstr " -- ei mitn --\n"
+msgstr " -- ei mitään --\n"
-#: ../memline.c:1527
msgid " owned by: "
msgstr " omistaja: "
-#: ../memline.c:1529
msgid " dated: "
msgstr " ajalta: "
-#: ../memline.c:1532 ../memline.c:3231
msgid " dated: "
msgstr " ajalta:"
-#: ../memline.c:1548
msgid " [from Vim version 3.0]"
msgstr " [Vimin 3.0-versiosta]"
-#: ../memline.c:1550
msgid " [does not look like a Vim swap file]"
-msgstr " [ei nyt Vimin swap-tiedostolta]"
+msgstr " [ei näytä Vimin swap-tiedostolta]"
+
+#~ msgid " [garbled strings (not nul terminated)]"
+#~ msgstr ""
-#: ../memline.c:1552
msgid " file name: "
msgstr " tiedostonimi: "
-#: ../memline.c:1558
msgid ""
"\n"
" modified: "
@@ -3927,27 +3629,22 @@ msgstr ""
"\n"
" muokattu: "
-#: ../memline.c:1559
msgid "YES"
-msgstr "KYLL"
+msgstr "KYLLÄ"
-#: ../memline.c:1559
msgid "no"
msgstr "ei"
-#: ../memline.c:1562
msgid ""
"\n"
" user name: "
msgstr ""
"\n"
-" kyttjnimi: "
+" käyttäjänimi: "
-#: ../memline.c:1568
msgid " host name: "
msgstr " laitenimi: "
-#: ../memline.c:1570
msgid ""
"\n"
" host name: "
@@ -3955,7 +3652,6 @@ msgstr ""
"\n"
" laitenimi: "
-#: ../memline.c:1575
msgid ""
"\n"
" process ID: "
@@ -3963,190 +3659,143 @@ msgstr ""
"\n"
" prosessin tunniste: "
-#: ../memline.c:1579
msgid " (still running)"
-msgstr " (kynniss)"
+msgstr " (käynnissä)"
-#: ../memline.c:1586
msgid ""
"\n"
" [not usable on this computer]"
msgstr ""
"\n"
-" [ei toimi tll koneella]"
+" [ei toimi tällä koneella]"
-#: ../memline.c:1590
msgid " [cannot be read]"
msgstr " [ei voi lukea]"
-#: ../memline.c:1593
msgid " [cannot be opened]"
msgstr " [ei voi avata]"
-#: ../memline.c:1698
msgid "E313: Cannot preserve, there is no swap file"
-msgstr "E313: Ei voi silytt, swap-tiedostoa ei ole"
+msgstr "E313: Ei voi säilyttää, swap-tiedostoa ei ole"
-#: ../memline.c:1747
msgid "File preserved"
-msgstr "Tiedosto silytetty"
+msgstr "Tiedosto säilytetty"
-#: ../memline.c:1749
msgid "E314: Preserve failed"
-msgstr "E314: Silyttminen eponnistui"
+msgstr "E314: Säilyttäminen epäonnistui"
-#: ../memline.c:1819
-#, c-format
-msgid "E315: ml_get: invalid lnum: %<PRId64>"
-msgstr "E315: ml_get: virheellinen lnum: %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "E315: ml_get: invalid lnum: %<PRId64>"
+#~ msgstr "E315: ml_get: virheellinen lnum: %ld"
-#: ../memline.c:1851
-#, c-format
-msgid "E316: ml_get: cannot find line %<PRId64>"
-msgstr "E316: ml_get: rivi %<PRId64> ei lydy"
+#, fuzzy, c-format
+#~ msgid "E316: ml_get: cannot find line %<PRId64>"
+#~ msgstr "E316: ml_get: riviä %ld ei löydy"
-#: ../memline.c:2236
msgid "E317: pointer block id wrong 3"
-msgstr "E317: osoitinlohkon tunnus vr 3"
+msgstr "E317: osoitinlohkon tunnus väärä 3"
-#: ../memline.c:2311
msgid "stack_idx should be 0"
-msgstr "stack_idx pit olla 0"
+msgstr "stack_idx pitää olla 0"
-#: ../memline.c:2369
msgid "E318: Updated too many blocks?"
-msgstr "E318: Pivitetty liikaa lohkoja"
+msgstr "E318: Päivitetty liikaa lohkoja"
-#: ../memline.c:2511
msgid "E317: pointer block id wrong 4"
-msgstr "E317: osoitinlohkon tunnus vr 4"
+msgstr "E317: osoitinlohkon tunnus väärä 4"
-#: ../memline.c:2536
msgid "deleted block 1?"
msgstr "poistettu lohko 1?"
-#: ../memline.c:2707
-#, c-format
-msgid "E320: Cannot find line %<PRId64>"
-msgstr "E320: Rivi %<PRId64> ei lydy"
+#, fuzzy, c-format
+#~ msgid "E320: Cannot find line %<PRId64>"
+#~ msgstr "E320: Riviä %ld ei löydy"
-#: ../memline.c:2916
msgid "E317: pointer block id wrong"
-msgstr "E317: osoitinlohkon tunnus vr"
+msgstr "E317: osoitinlohkon tunnus väärä"
-#: ../memline.c:2930
msgid "pe_line_count is zero"
msgstr "pe_line_count on nolla"
-#: ../memline.c:2955
-#, c-format
-msgid "E322: line number out of range: %<PRId64> past the end"
-msgstr "E322: rivinumero arvoalueen ulkopuoleta: %<PRId64> on loppua suurempi"
+#, fuzzy, c-format
+#~ msgid "E322: line number out of range: %<PRId64> past the end"
+#~ msgstr "E322: rivinumero arvoalueen ulkopuoleta: %ld on loppua suurempi"
-#: ../memline.c:2959
-#, c-format
-msgid "E323: line count wrong in block %<PRId64>"
-msgstr "E323: rivimr vrin lohkossa %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "E323: line count wrong in block %<PRId64>"
+#~ msgstr "E323: rivimäärä väärin lohkossa %ld"
-#: ../memline.c:2999
msgid "Stack size increases"
msgstr "Pinon koko kasvaa"
-#: ../memline.c:3038
msgid "E317: pointer block id wrong 2"
-msgstr "E317: osoitinlohon tunnus vr 2"
+msgstr "E317: osoitinlohon tunnus väärä 2"
-#: ../memline.c:3070
#, c-format
msgid "E773: Symlink loop for \"%s\""
msgstr "E773: Symlinkkisilmukka kohteelle %s"
-#: ../memline.c:3221
msgid "E325: ATTENTION"
msgstr "E325: HUOMAA"
-#: ../memline.c:3222
msgid ""
"\n"
"Found a swap file by the name \""
msgstr ""
"\n"
-"Swap-tiedosto lytyi: \""
+"Swap-tiedosto löytyi: \""
-#: ../memline.c:3226
msgid "While opening file \""
msgstr "Avattaessa tiedostoa "
-#: ../memline.c:3239
msgid " NEWER than swap file!\n"
msgstr " joka on UUDEMPI kuin swap-tiedosto!\n"
-#: ../memline.c:3244
-#, fuzzy
+#. Some of these messages are long to allow translation to
+#. * other languages.
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) Toinen ohjelma saattaa kytt samaa tiedostoa.\n"
-" Jos nin on, varo, ettet muokkaa saman tiedoston\n"
-" kahta instanssia yht aikaa.\n"
-
-#: ../memline.c:3245
-#, fuzzy
-msgid " Quit, or continue with caution.\n"
-msgstr " Lopeta, tai jatka.\n"
+"(1) Toinen ohjelma saattaa käyttää samaa tiedostoa.\n"
+" Jos näin on, varo, ettet muokkaa saman tiedoston\n"
+" kahta instanssia yhtä aikaa. Lopeta tai jatka varoen.\n"
-#: ../memline.c:3246
-#, fuzzy
msgid "(2) An edit session for this file crashed.\n"
-msgstr ""
-"\n"
-"(2) Ohjelma on kaatunut muokatessa tiedostoa.\n"
+msgstr "(2) Tiedostonmuokkausistunto on kaatunut.\n"
-#: ../memline.c:3247
msgid " If this is the case, use \":recover\" or \"vim -r "
-msgstr " Jos nin on, kyt komentoa :recover tai vim -r "
+msgstr " Jos näin on, käytä komentoa :recover tai vim -r "
-#: ../memline.c:3249
msgid ""
"\"\n"
" to recover the changes (see \":help recovery\").\n"
msgstr ""
"\"\n"
-" palauttaaksesi muutokset (listietoja: \":help recovery\").\n"
+" palauttaaksesi muutokset (lisätietoja: \":help recovery\").\n"
-#: ../memline.c:3250
msgid " If you did this already, delete the swap file \""
-msgstr " Jos teit jo nin, poista swap-tiedosto "
+msgstr " Jos teit jo näin, poista swap-tiedosto "
-#: ../memline.c:3252
msgid ""
"\"\n"
" to avoid this message.\n"
msgstr ""
"\"\n"
-" vlttksesi tmn viestin.\n"
+" välttääksesi tämän viestin.\n"
-#: ../memline.c:3450 ../memline.c:3452
msgid "Swap file \""
msgstr "Swap-tiedosto "
-#: ../memline.c:3451 ../memline.c:3455
msgid "\" already exists!"
msgstr " on jo olemassa"
-#: ../memline.c:3457
msgid "VIM - ATTENTION"
msgstr "VIM - HUOMAUTUS"
-#: ../memline.c:3459
-msgid "Swap file already exists!"
-msgstr "Swap-tiedosto on jo olemassa"
-
-#: ../memline.c:3464
msgid ""
"&Open Read-Only\n"
"&Edit anyway\n"
@@ -4160,7 +3809,6 @@ msgstr ""
"&Lopeta\n"
"P&eru"
-#: ../memline.c:3467
msgid ""
"&Open Read-Only\n"
"&Edit anyway\n"
@@ -4184,48 +3832,48 @@ msgstr ""
#.
#. ".s?a"
#. ".saa": tried enough, give up
-#: ../memline.c:3528
msgid "E326: Too many swap files found"
msgstr "E326: Liian monta swap-tiedostoa"
-#: ../memory.c:227
-#, c-format
-msgid "E342: Out of memory! (allocating %<PRIu64> bytes)"
-msgstr "E342: Muisti loppui! (varattaessa %<PRIu64> tavua)"
+#, fuzzy, c-format
+msgid ""
+"E303: Unable to create directory \"%s\" for swap file, recovery impossible: "
+"%s"
+msgstr "E303: Swap-tiedostoa %s ei voi avata, palautus ei onnistu"
+
+#, fuzzy
+#~ msgid "Vim: Data too large to fit into virtual memory space\n"
+#~ msgstr "arvo on liian suuri mahtumaan C:n int-tyyppiin"
+
+#, fuzzy, c-format
+#~ msgid "E342: Out of memory! (allocating %<PRIu64> bytes)"
+#~ msgstr "E342: Muisti loppui! (varattaessa %lu tavua)"
-#: ../menu.c:62
msgid "E327: Part of menu-item path is not sub-menu"
msgstr "E327: Valikkokohtapolun osa ei ole alivalikko"
-#: ../menu.c:63
msgid "E328: Menu only exists in another mode"
msgstr "E328: Valikko on olemassa vain toisessa tilassa"
-#: ../menu.c:64
#, c-format
msgid "E329: No menu \"%s\""
msgstr "E329: Ei valikkoa %s"
#. Only a mnemonic or accelerator is not valid.
-#: ../menu.c:329
msgid "E792: Empty menu name"
-msgstr "E792: tyhj valikkonimi"
+msgstr "E792: tyhjä valikkonimi"
-#: ../menu.c:340
msgid "E330: Menu path must not lead to a sub-menu"
msgstr "E330: Valikkopolku ei saa johtaa alivalikkoon"
-#: ../menu.c:365
msgid "E331: Must not add menu items directly to menu bar"
-msgstr "E331: Valikkokohtia ei saa list suoraan valikkopalkkiin"
+msgstr "E331: Valikkokohtia ei saa lisätä suoraan valikkopalkkiin"
-#: ../menu.c:370
msgid "E332: Separator cannot be part of a menu path"
msgstr "E332: Erotin ei voi olla valikkopolun osa"
#. Now we have found the matching menu, and we list the mappings
#. Highlight title
-#: ../menu.c:762
msgid ""
"\n"
"--- Menus ---"
@@ -4233,87 +3881,64 @@ msgstr ""
"\n"
"--- Valikot ---"
-#: ../menu.c:1313
msgid "E333: Menu path must lead to a menu item"
msgstr "E333: Valikkopolun on johdettava valikkokohtaan"
-#: ../menu.c:1330
#, c-format
msgid "E334: Menu not found: %s"
-msgstr "E334: Valikkoa ei lydy: %s"
+msgstr "E334: Valikkoa ei löydy: %s"
-#: ../menu.c:1396
#, c-format
msgid "E335: Menu not defined for %s mode"
-msgstr "E335: Valikkoa ei ole mritelty %s-tilassa"
-
-#: ../menu.c:1426
-msgid "E336: Menu path must lead to a sub-menu"
-msgstr "E336: Valikkopolun pit johtaa alivalikkoon"
+msgstr "E335: Valikkoa ei ole määritelty %s-tilassa"
-#: ../menu.c:1447
-msgid "E337: Menu not found - check menu names"
-msgstr "E337: Valikkoa ei lytynyt - tarkista valikkojen nimet"
-
-#: ../message.c:423
#, c-format
msgid "Error detected while processing %s:"
msgstr "Virhe suoritettaessa komentoja %s:"
-#: ../message.c:445
#, c-format
msgid "line %4ld:"
msgstr "rivi %4ld:"
-#: ../message.c:617
#, c-format
msgid "E354: Invalid register name: '%s'"
msgstr "E354: Virheellinen rekisterin nimi: %s"
-#: ../message.c:986
msgid "Interrupt: "
msgstr "Keskeytys: "
-#: ../message.c:988
msgid "Press ENTER or type command to continue"
-msgstr "Paina enteri tai kirjoita komento aloittaaksesi "
+msgstr "Paina enteriä tai kirjoita komento aloittaaksesi "
-#: ../message.c:1843
-#, c-format
-msgid "%s line %<PRId64>"
-msgstr "%s rivi %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "%s line %<PRId64>"
+#~ msgstr "%s rivi %ld"
-#: ../message.c:2392
msgid "-- More --"
-msgstr "-- Lis --"
+msgstr "-- Lisää --"
-#: ../message.c:2398
msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "
-msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: yls, q: lopeta "
+msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: ylös, q: lopeta "
-#: ../message.c:3021 ../message.c:3031
msgid "Question"
msgstr "Kysymys"
-#: ../message.c:3023
msgid ""
"&Yes\n"
"&No"
msgstr ""
-"&Kyll\n"
+"&Kyllä\n"
"&Ei"
-#: ../message.c:3033
msgid ""
"&Yes\n"
"&No\n"
"&Cancel"
msgstr ""
-"&Kyll\n"
+"&Kyllä\n"
"&Ei\n"
"&Peru"
-#: ../message.c:3045
msgid ""
"&Yes\n"
"&No\n"
@@ -4321,180 +3946,165 @@ msgid ""
"&Discard All\n"
"&Cancel"
msgstr ""
-"&Kyll\n"
+"&Kyllä\n"
"&Ei\n"
"&Tallenna kaikki\n"
"T&uhoa kaikki\n"
"&Peru"
-#: ../message.c:3058
-msgid "E766: Insufficient arguments for printf()"
-msgstr "E766: printf():lle ei annettu tarpeeksi argumentteja"
-
-#: ../message.c:3119
-msgid "E807: Expected Float argument for printf()"
-msgstr "E807: Odotettiin Float-argumenttia printf():lle"
-
-#: ../message.c:3873
-msgid "E767: Too many arguments to printf()"
-msgstr "E767: printf():lle annettiin liikaa argumentteja"
-
-#: ../misc1.c:2256
msgid "W10: Warning: Changing a readonly file"
msgstr "W10: Varoitus: Muutetaan kirjoitussuojattua tiedostoa"
-#: ../misc1.c:2537
msgid "Type number and <Enter> or click with mouse (empty cancels): "
-msgstr "Kirjoita numero ja <Enter> tai valitse hiirell (tyhj peruu): "
+msgstr "Kirjoita numero ja <Enter> tai valitse hiirellä (tyhjä peruu): "
-#: ../misc1.c:2539
msgid "Type number and <Enter> (empty cancels): "
-msgstr "Valitse numero ja <Enter> (tyhj peruu): "
+msgstr "Valitse numero ja <Enter> (tyhjä peruu): "
-#: ../misc1.c:2585
msgid "1 more line"
-msgstr "1 rivi lis"
+msgstr "1 rivi lisää"
-#: ../misc1.c:2588
msgid "1 line less"
-msgstr "1 rivi vhemmn"
+msgstr "1 rivi vähemmän"
-#: ../misc1.c:2593
-#, c-format
-msgid "%<PRId64> more lines"
-msgstr "%<PRId64> rivi lis"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> more lines"
+#~ msgstr "%ld riviä lisää"
-#: ../misc1.c:2596
-#, c-format
-msgid "%<PRId64> fewer lines"
-msgstr "%<PRId64> rivi vhemmn"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> fewer lines"
+#~ msgstr "%ld riviä vähemmän"
-#: ../misc1.c:2599
msgid " (Interrupted)"
msgstr " (Keskeytetty)"
-#: ../misc1.c:2635
msgid "Beep!"
msgstr "Piip!"
-#: ../misc2.c:738
#, c-format
msgid "Calling shell to execute: \"%s\""
msgstr "Kutsutaan kuorta suorittamaan: %s"
-#: ../normal.c:183
+#, c-format
+#~ msgid "Invalid channel: %<PRIu64>"
+#~ msgstr ""
+
+#~ msgid "Message is not an array"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Message is empty"
+#~ msgstr "Viesti"
+
+#~ msgid "Message type must be an integer"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Unknown message type"
+#~ msgstr "E574: Tuntematon rekisterityyppi %d"
+
+#~ msgid "Request array size must be 4 (request) or 3 (notification)"
+#~ msgstr ""
+
+#~ msgid "ID must be a positive integer"
+#~ msgstr ""
+
+#~ msgid "Method must be a string"
+#~ msgstr ""
+
+#, fuzzy
+#~ msgid "Parameters must be an array"
+#~ msgstr "merkin nimen pitää olla yksi merkki"
+
+#.
+#. * nv_*(): functions called to handle Normal and Visual mode commands.
+#. * n_*(): functions called to handle Normal mode commands.
+#. * v_*(): functions called to handle Visual mode commands.
+#.
msgid "E349: No identifier under cursor"
msgstr "E349: Ei tunnistetta osoittimen alla"
-#: ../normal.c:1866
msgid "E774: 'operatorfunc' is empty"
-msgstr "E774: operatorfunc on tyhj"
+msgstr "E774: operatorfunc on tyhjä"
-#: ../normal.c:2637
msgid "Warning: terminal cannot highlight"
msgstr "Varoitus: terminaalista puuttuu korostus"
-#: ../normal.c:2807
msgid "E348: No string under cursor"
msgstr "E348: Ei merkkijonoa kursorin alla"
-#: ../normal.c:3937
msgid "E352: Cannot erase folds with current 'foldmethod'"
-msgstr "E352: taitoksia ei voi poistaa tll foldmethodilla"
+msgstr "E352: taitoksia ei voi poistaa tällä foldmethodilla"
-#: ../normal.c:5897
msgid "E664: changelist is empty"
-msgstr "E664: muutoslista on tyhj"
+msgstr "E664: muutoslista on tyhjä"
-#: ../normal.c:5899
msgid "E662: At start of changelist"
msgstr "E662: Muutoslistan alussa"
-#: ../normal.c:5901
msgid "E663: At end of changelist"
msgstr "E663: Muutoslistan lopussa"
-#: ../normal.c:7053
-msgid "Type :quit<Enter> to exit Nvim"
-msgstr "Komento :quit<Enter> lopettaa Vimin"
+#, fuzzy
+#~ msgid "Type :quit<Enter> to exit Nvim"
+#~ msgstr "Komento :quit<Enter> lopettaa Vimin"
-#: ../ops.c:248
#, c-format
msgid "1 line %sed 1 time"
-msgstr "1 rivi %s kerran"
+msgstr "1 riviä %s kerran"
-#: ../ops.c:250
#, c-format
msgid "1 line %sed %d times"
-msgstr "1 rivi %s %d kertaa"
+msgstr "1 riviä %s %d kertaa"
-#: ../ops.c:253
-#, c-format
-msgid "%<PRId64> lines %sed 1 time"
-msgstr "%<PRId64> rivi %s kerran"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines %sed 1 time"
+#~ msgstr "%ld riviä %s kerran"
-#: ../ops.c:256
-#, c-format
-msgid "%<PRId64> lines %sed %d times"
-msgstr "%<PRId64> rivi %s %d kertaa"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines %sed %d times"
+#~ msgstr "%ld riviä %s %d kertaa"
-#: ../ops.c:592
-#, c-format
-msgid "%<PRId64> lines to indent... "
-msgstr "%<PRId64> rivi sisennettvn..."
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines to indent... "
+#~ msgstr "%ld riviä sisennettävänä..."
-#: ../ops.c:634
msgid "1 line indented "
msgstr "1 rivi sisennetty "
-#: ../ops.c:636
-#, c-format
-msgid "%<PRId64> lines indented "
-msgstr "%<PRId64> rivi sisennetty "
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines indented "
+#~ msgstr "%ld riviä sisennetty "
-#: ../ops.c:938
msgid "E748: No previously used register"
-msgstr "E748: Ei aiemmin kytettyj rekisterej"
+msgstr "E748: Ei aiemmin käytettyjä rekisterejä"
-#. must display the prompt
-#: ../ops.c:1433
-msgid "cannot yank; delete anyway"
-msgstr "Ei voi kopioida; poista joka tapauksessa"
-
-#: ../ops.c:1929
msgid "1 line changed"
msgstr "1 rivi muuttui"
-#: ../ops.c:1931
-#, c-format
-msgid "%<PRId64> lines changed"
-msgstr "%<PRId64> rivi muuttui"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines changed"
+#~ msgstr "%ld riviä muuttui"
-#: ../ops.c:2521
msgid "block of 1 line yanked"
msgstr "1 rivin lohko kopioitu"
-#: ../ops.c:2523
msgid "1 line yanked"
msgstr "1 rivi kopioitu"
-#: ../ops.c:2525
-#, c-format
-msgid "block of %<PRId64> lines yanked"
-msgstr "lohko %<PRId64> rivilt kopioitu"
+#, fuzzy, c-format
+#~ msgid "block of %<PRId64> lines yanked"
+#~ msgstr "lohko %ld riviltä kopioitu"
-#: ../ops.c:2528
-#, c-format
-msgid "%<PRId64> lines yanked"
-msgstr "%<PRId64> rivi kopioitu"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> lines yanked"
+#~ msgstr "%ld riviä kopioitu"
-#: ../ops.c:2710
#, c-format
msgid "E353: Nothing in register %s"
-msgstr "E353: Rekisteriss %s ei ole mitn"
+msgstr "E353: Rekisterissä %s ei ole mitään"
#. Highlight title
-#: ../ops.c:3185
msgid ""
"\n"
"--- Registers ---"
@@ -4502,207 +4112,142 @@ msgstr ""
"\n"
"--- Rekisterit ---"
-#: ../ops.c:4455
-msgid "Illegal register name"
-msgstr "Virheellinen rekisterin nimi"
-
-#: ../ops.c:4533
msgid ""
-"\n"
-"# Registers:\n"
+"E883: search pattern and expression register may not contain two or more "
+"lines"
msgstr ""
-"\n"
-"# Rekisterit:\n"
+"E883: hakulauseke- ja -ilmausrekisteri ei voi sisältää kahta tai useampaa "
+"riviä"
-#: ../ops.c:4575
-#, c-format
-msgid "E574: Unknown register type %d"
-msgstr "E574: Tuntematon rekisterityyppi %d"
-
-#: ../ops.c:5089
-#, c-format
-msgid "%<PRId64> Cols; "
-msgstr "%<PRId64> saraketta, "
+#, fuzzy, c-format
+#~ msgid "%<PRId64> Cols; "
+#~ msgstr "%ld saraketta, "
-#: ../ops.c:5097
-#, c-format
+#, fuzzy, c-format
msgid ""
"Selected %s%<PRId64> of %<PRId64> Lines; %<PRId64> of %<PRId64> Words; "
"%<PRId64> of %<PRId64> Bytes"
-msgstr ""
-"Valittu %s%<PRId64>/%<PRId64> rivi, %<PRId64>/%<PRId64> sanaa, %<PRId64>/"
-"%<PRId64> tavua"
+msgstr "Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld tavua"
-#: ../ops.c:5105
-#, c-format
+#, fuzzy, c-format
msgid ""
"Selected %s%<PRId64> of %<PRId64> Lines; %<PRId64> of %<PRId64> Words; "
"%<PRId64> of %<PRId64> Chars; %<PRId64> of %<PRId64> Bytes"
msgstr ""
-"Valittu %s%<PRId64>/%<PRId64> rivi, %<PRId64>/%<PRId64> sanaa, %<PRId64>/"
-"%<PRId64> merkki, %<PRId64>/%<PRId64> tavua"
+"Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld merkkiä, %lld/%lld tavua"
-#: ../ops.c:5123
-#, c-format
+#, fuzzy, c-format
msgid ""
"Col %s of %s; Line %<PRId64> of %<PRId64>; Word %<PRId64> of %<PRId64>; Byte "
"%<PRId64> of %<PRId64>"
-msgstr ""
-"Sarake %s/%s, Rivi %<PRId64>/%<PRId64>, sana %<PRId64>/%<PRId64>, tavu "
-"%<PRId64>/%<PRId64>"
+msgstr "Sarake %s/%s, Rivi %ld/%ld, sana %lld/%lld, tavu %lld/%lld"
-#: ../ops.c:5133
-#, c-format
+#, fuzzy, c-format
msgid ""
"Col %s of %s; Line %<PRId64> of %<PRId64>; Word %<PRId64> of %<PRId64>; Char "
"%<PRId64> of %<PRId64>; Byte %<PRId64> of %<PRId64>"
msgstr ""
-"Sarake %s/%s, rivi %<PRId64>/%<PRId64>, sana %<PRId64>/%<PRId64>, merkki "
-"%<PRId64>/%<PRId64>, tavu %<PRId64>/%<PRId64>"
+"Sarake %s/%s, rivi %ld/%ld, sana %lld/%lld, merkki %lld/%lld, tavu %lld/%lld"
# Unicode Byte Order Mark
-#: ../ops.c:5146
-#, c-format
-msgid "(+%<PRId64> for BOM)"
-msgstr "(+%<PRId64> BOMista)"
-
-#: ../option.c:1238
-msgid "%<%f%h%m%=Page %N"
-msgstr "%<%f%h%m%=Sivu %N"
-
-#: ../option.c:1574
-msgid "Thanks for flying Vim"
-msgstr "Kiitos ett ajoit Vimi"
+#, fuzzy, c-format
+#~ msgid "(+%<PRId64> for BOM)"
+#~ msgstr "(+%ld BOMista)"
#. found a mismatch: skip
-#: ../option.c:2698
msgid "E518: Unknown option"
msgstr "E518: Tuntematon asetus"
-#: ../option.c:2709
-msgid "E519: Option not supported"
-msgstr "E519: Asetusta ei tueta"
-
-#: ../option.c:2740
msgid "E520: Not allowed in a modeline"
-msgstr "E520: Ei sallitu modeline-rivill"
+msgstr "E520: Ei sallitu modeline-rivillä"
-#: ../option.c:2815
msgid "E846: Key code not set"
-msgstr ""
+msgstr "E846: Avainkoodi puuttuu"
-#: ../option.c:2924
msgid "E521: Number required after ="
-msgstr "E521: =:n jlkeen tarvitaan luku"
-
-#: ../option.c:3226 ../option.c:3864
-msgid "E522: Not found in termcap"
-msgstr "E522: Puuttuu termcapista"
+msgstr "E521: =:n jälkeen tarvitaan luku"
-#: ../option.c:3335
#, c-format
msgid "E539: Illegal character <%s>"
msgstr "E539: Virheellinen merkki <%s>"
-#: ../option.c:3862
-msgid "E529: Cannot set 'term' to empty string"
-msgstr "E529: Termi ei voi asettaa tyhjksi merkkijonoksi"
+#, c-format
+msgid "For option %s"
+msgstr "Asetukselle %s"
-#: ../option.c:3885
msgid "E589: 'backupext' and 'patchmode' are equal"
msgstr "E589: backupext ja patchmod ovat samat"
-#: ../option.c:3964
msgid "E834: Conflicts with value of 'listchars'"
msgstr "E834: listcharsin arvoissa on ristiriitoja"
-#: ../option.c:3966
msgid "E835: Conflicts with value of 'fillchars'"
msgstr "E835: fillcharsin arvossa on ristiriitoja"
-#: ../option.c:4163
msgid "E524: Missing colon"
msgstr "E524: Kaksoispiste puuttuu"
-#: ../option.c:4165
msgid "E525: Zero length string"
msgstr "E525: Nollan pituinen merkkijono"
-#: ../option.c:4220
#, c-format
msgid "E526: Missing number after <%s>"
-msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jlkeen"
+msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen"
-#: ../option.c:4232
msgid "E527: Missing comma"
msgstr "E527: Pilkku puuttuu"
-#: ../option.c:4239
msgid "E528: Must specify a ' value"
-msgstr "E528: '-arvo pit antaa"
+msgstr "E528: '-arvo pitää antaa"
-#: ../option.c:4271
msgid "E595: contains unprintable or wide character"
-msgstr "E595: Sislt tulostumattomia tai leveit merkkej"
+msgstr "E595: Sisältää tulostumattomia tai leveitä merkkejä"
-#: ../option.c:4469
#, c-format
msgid "E535: Illegal character after <%c>"
-msgstr "E535: Virheellinen merkki merkin <%c> jlkeen"
+msgstr "E535: Virheellinen merkki merkin <%c> jälkeen"
-#: ../option.c:4534
msgid "E536: comma required"
msgstr "E536: pilkku puuttuu"
-#: ../option.c:4543
#, c-format
msgid "E537: 'commentstring' must be empty or contain %s"
-msgstr "E537: commentstringin pit olla tyhj tai sislt %s"
+msgstr "E537: commentstringin pitää olla tyhjä tai sisältää %s"
-#: ../option.c:4928
msgid "E540: Unclosed expression sequence"
msgstr "E540: Sulkematon lausekesarja"
-#: ../option.c:4932
msgid "E541: too many items"
msgstr "E541: liikaa kohteita"
-#: ../option.c:4934
msgid "E542: unbalanced groups"
-msgstr "E542: eptasapainoisia ryhmi"
+msgstr "E542: epätasapainoisia ryhmiä"
-#: ../option.c:5148
msgid "E590: A preview window already exists"
msgstr "E590: Esikatseluikkuna on jo olemassa"
-#: ../option.c:5311
msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'"
-msgstr "W17: Arabialle pit olla UTF-8:aa, aseta :set encoding=utf-8"
+msgstr "W17: Arabialle pitää olla UTF-8:aa, aseta :set encoding=utf-8"
-#: ../option.c:5623
#, c-format
msgid "E593: Need at least %d lines"
-msgstr "E593: Tarvitaan ainakin %d rivi"
+msgstr "E593: Tarvitaan ainakin %d riviä"
-#: ../option.c:5631
#, c-format
msgid "E594: Need at least %d columns"
msgstr "E594: Tarvitaan ainakin %d saraketta"
-#: ../option.c:6011
#, c-format
msgid "E355: Unknown option: %s"
msgstr "E355: Tuntematon asetus: %s"
#. There's another character after zeros or the string
-#. * is empty. In both cases, we are trying to set a
-#. * num option using a string.
-#: ../option.c:6037
+#. is empty. In both cases, we are trying to set a
+#. num option using a string.
#, c-format
msgid "E521: Number required: &%s = '%s'"
msgstr "E521: tarvitaan luku: &%s = '%s'"
-#: ../option.c:6149
msgid ""
"\n"
"--- Terminal codes ---"
@@ -4710,7 +4255,6 @@ msgstr ""
"\n"
"--- Terminaalikoodit ---"
-#: ../option.c:6151
msgid ""
"\n"
"--- Global option values ---"
@@ -4718,7 +4262,6 @@ msgstr ""
"\n"
"--- Globaalit asetukset ---"
-#: ../option.c:6153
msgid ""
"\n"
"--- Local option values ---"
@@ -4726,7 +4269,6 @@ msgstr ""
"\n"
"--- Paikalliset asetukset ---"
-#: ../option.c:6155
msgid ""
"\n"
"--- Options ---"
@@ -4734,29 +4276,24 @@ msgstr ""
"\n"
"--- Asetukset ---"
-#: ../option.c:6816
msgid "E356: get_varp ERROR"
msgstr "E356: get_varp-virhe"
-#: ../option.c:7696
#, c-format
msgid "E357: 'langmap': Matching character missing for %s"
-msgstr "E357: langmap: Merkkiin %s tsmv merkki puuttuu"
+msgstr "E357: langmap: Merkkiin %s täsmäävä merkki puuttuu"
-#: ../option.c:7715
#, c-format
msgid "E358: 'langmap': Extra characters after semicolon: %s"
-msgstr "E358: langmap: ylimrisi merkkej puolipisteen jlkeen: %s"
+msgstr "E358: langmap: ylimääräisiä merkkejä puolipisteen jälkeen: %s"
-#: ../os/shell.c:194
-msgid ""
-"\n"
-"Cannot execute shell "
-msgstr ""
-"\n"
-"Kuoren suoritus ei onnistu "
+#, c-format
+msgid "dlerror = \"%s\""
+msgstr "dlerror = %s"
+
+msgid "Vim: Error reading input, exiting...\n"
+msgstr "Vim: Virhe luettaessa syötettä, poistutaan...\n"
-#: ../os/shell.c:439
msgid ""
"\n"
"shell returned "
@@ -4764,8 +4301,18 @@ msgstr ""
"\n"
"kuoren palautusarvo "
-# mik security context?
-#: ../os_unix.c:465 ../os_unix.c:471
+#~ msgid ""
+#~ "\n"
+#~ "shell failed to start: "
+#~ msgstr ""
+
+#. Can happen if system() tries to send input to a shell command that was
+#. backgrounded (:call system("cat - &", "foo")). #3529 #5241
+#, fuzzy, c-format
+#~ msgid "E5677: Error writing input to shell-command: %s"
+#~ msgstr "E677: Väliaikaistiedostoon kirjoittaminen ei onnistunut"
+
+# mikä security context?
msgid ""
"\n"
"Could not get security context for "
@@ -4773,7 +4320,6 @@ msgstr ""
"\n"
"Ei saatu turvallisuuskontekstia kohteelle "
-#: ../os_unix.c:479
msgid ""
"\n"
"Could not set security context for "
@@ -4781,947 +4327,897 @@ msgstr ""
"\n"
"Ei voitu asettaa turvallisuuskontekstia kohteelle "
-#: ../os_unix.c:1558 ../os_unix.c:1647
-#, c-format
-msgid "dlerror = \"%s\""
-msgstr "dlerror = %s"
-
-#: ../path.c:1449
#, c-format
msgid "E447: Can't find file \"%s\" in path"
-msgstr "E447: Tiedosto %s ei lydy polulta"
+msgstr "E447: Tiedosto %s ei löydy polulta"
-#: ../quickfix.c:359
#, c-format
msgid "E372: Too many %%%c in format string"
msgstr "E372: Liikaa %%%c-juttuja muotoilumerkkijonossa"
-#: ../quickfix.c:371
#, c-format
msgid "E373: Unexpected %%%c in format string"
msgstr "E373: Odottamaton %%%c muotoilumerkkijonossa"
-#: ../quickfix.c:420
msgid "E374: Missing ] in format string"
msgstr "E374: ] puuttuu muotoilemerkkijonosta"
-#: ../quickfix.c:431
#, c-format
msgid "E375: Unsupported %%%c in format string"
msgstr "E375: Tukematon %%%c muotoilumerkkijonossa"
-#: ../quickfix.c:448
#, c-format
msgid "E376: Invalid %%%c in format string prefix"
msgstr "E376: Virheellinen %%%c muotoilumerkkijonon alussa"
-#: ../quickfix.c:454
#, c-format
msgid "E377: Invalid %%%c in format string"
msgstr "E377: Virheellinen %%%c muotoilumerkkijonossa"
#. nothing found
-#: ../quickfix.c:477
msgid "E378: 'errorformat' contains no pattern"
msgstr "E378: errorformatissa ei ole kuvioita"
-#: ../quickfix.c:695
msgid "E379: Missing or empty directory name"
-msgstr "E379: Puuttuva tai tyhj hakemiston nimi"
+msgstr "E379: Puuttuva tai tyhjä hakemiston nimi"
-#: ../quickfix.c:1305
msgid "E553: No more items"
-msgstr "E553: Ei en kohteita"
+msgstr "E553: Ei enää kohteita"
+
+msgid "E924: Current window was closed"
+msgstr "E924: Nykyinen ikkuna on suljettu"
+
+msgid "E925: Current quickfix was changed"
+msgstr "E925: Nykyinen quickfix on muuttunut"
+
+msgid "E926: Current location list was changed"
+msgstr "E926: Nykyinen sijaintiluettelo on muuttunut"
-#: ../quickfix.c:1674
#, c-format
msgid "(%d of %d)%s%s: "
msgstr "(%d/%d)%s%s: "
-#: ../quickfix.c:1676
msgid " (line deleted)"
msgstr " (rivi poistettu)"
-#: ../quickfix.c:1863
+#, c-format
+msgid "%serror list %d of %d; %d errors "
+msgstr "%svirhelista %d/%d, %d virhettä"
+
msgid "E380: At bottom of quickfix stack"
msgstr "E380: quickfix-pinon pohjalla"
-#: ../quickfix.c:1869
msgid "E381: At top of quickfix stack"
msgstr "E381: quickfix-pinon huipulla"
-#: ../quickfix.c:1880
-#, c-format
-msgid "error list %d of %d; %d errors"
-msgstr "virhelista %d/%d, %d virhett"
+msgid "No entries"
+msgstr "Ei kenttiä"
-#: ../quickfix.c:2427
msgid "E382: Cannot write, 'buftype' option is set"
msgstr "E382: Ei voi kirjoittaa, buftype asetettu"
-#: ../quickfix.c:2812
msgid "E683: File name missing or invalid pattern"
msgstr "E683: Tiedostonimi puuttuu tai kuvio on viallinen"
-#: ../quickfix.c:2911
#, c-format
msgid "Cannot open file \"%s\""
msgstr "Tiedostoa %s ei voi avata"
-#: ../quickfix.c:3429
msgid "E681: Buffer is not loaded"
msgstr "E681: Puskuria ei ole ladattu"
-#: ../quickfix.c:3487
msgid "E777: String or List expected"
-msgstr "E777: Pit olla merkkijono tai lista"
+msgstr "E777: Pitää olla merkkijono tai lista"
-#: ../regexp.c:359
#, c-format
msgid "E369: invalid item in %s%%[]"
msgstr "E369: virheellinen olio kohdassa %s%%[]"
-#: ../regexp.c:374
#, c-format
msgid "E769: Missing ] after %s["
-msgstr "E769: ] puuttuu merkinnn %s[ jljest"
+msgstr "E769: ] puuttuu merkinnän %s[ jäljestä"
-#: ../regexp.c:375
#, c-format
msgid "E53: Unmatched %s%%("
msgstr "E53: Pariton %s%%("
-#: ../regexp.c:376
#, c-format
msgid "E54: Unmatched %s("
msgstr "E54: Pariton %s("
-#: ../regexp.c:377
#, c-format
msgid "E55: Unmatched %s)"
msgstr "E55: Pariton %s)"
-#: ../regexp.c:378
msgid "E66: \\z( not allowed here"
-msgstr "E66: \\z( ei ole sallittu tss"
+msgstr "E66: \\z( ei ole sallittu tässä"
-#: ../regexp.c:379
msgid "E67: \\z1 et al. not allowed here"
-msgstr "E67: \\z1 jne. ei ole sallittu tss"
+msgstr "E67: \\z1 jne. ei ole sallittu tässä"
-#: ../regexp.c:380
#, c-format
msgid "E69: Missing ] after %s%%["
-msgstr "E69: ] puuttuu merkinnn %s%%[ jljest"
+msgstr "E69: ] puuttuu merkinnän %s%%[ jäljestä"
-#: ../regexp.c:381
#, c-format
msgid "E70: Empty %s%%[]"
-msgstr "E70: Tyhj %s%%[]"
+msgstr "E70: Tyhjä %s%%[]"
-#: ../regexp.c:1209 ../regexp.c:1224
msgid "E339: Pattern too long"
-msgstr "E339: Liian pitk kuvio"
+msgstr "E339: Liian pitkä kuvio"
-#: ../regexp.c:1371
msgid "E50: Too many \\z("
-msgstr "E50: Liikaa merkkej \\z("
+msgstr "E50: Liikaa merkkejä \\z("
-#: ../regexp.c:1378
#, c-format
msgid "E51: Too many %s("
-msgstr "E51: Liikaa merkkej %s("
+msgstr "E51: Liikaa merkkejä %s("
-#: ../regexp.c:1427
msgid "E52: Unmatched \\z("
msgstr "E52: Pariton \\z("
-#: ../regexp.c:1637
#, c-format
msgid "E59: invalid character after %s@"
-msgstr "E59: virheellinen merkki kohdan %s@ jlkeen"
+msgstr "E59: virheellinen merkki kohdan %s@ jälkeen"
-#: ../regexp.c:1672
#, c-format
msgid "E60: Too many complex %s{...}s"
msgstr "E60: Liikaa monimutkaisia ilmauksia %s{...}s"
-#: ../regexp.c:1687
#, c-format
msgid "E61: Nested %s*"
-msgstr "E61: Siskkistetty %s*"
+msgstr "E61: Sisäkkäistetty %s*"
-#: ../regexp.c:1690
#, c-format
msgid "E62: Nested %s%c"
-msgstr "E62: Siskkistetty %s%c"
+msgstr "E62: Sisäkkäistetty %s%c"
-#: ../regexp.c:1800
msgid "E63: invalid use of \\_"
-msgstr "E63: vrinkytetty \\_"
+msgstr "E63: väärinkäytetty \\_"
-#: ../regexp.c:1850
#, c-format
msgid "E64: %s%c follows nothing"
-msgstr "E64: %s%c jlkeen ei minkn"
+msgstr "E64: %s%c jälkeen ei minkään"
-#: ../regexp.c:1902
msgid "E65: Illegal back reference"
-msgstr "E65: Virheellinen tsmysviittaus"
+msgstr "E65: Virheellinen täsmäysviittaus"
-#: ../regexp.c:1943
msgid "E68: Invalid character after \\z"
-msgstr "E68: Virheellinen merkki ilmauksen \\z jlkeen"
+msgstr "E68: Virheellinen merkki ilmauksen \\z jälkeen"
-#: ../regexp.c:2049 ../regexp_nfa.c:1296
#, c-format
msgid "E678: Invalid character after %s%%[dxouU]"
-msgstr "E678: Virheellinen merkki merkinnn %s%%[dxouU] jljess"
+msgstr "E678: Virheellinen merkki merkinnän %s%%[dxouU] jäljessä"
-#: ../regexp.c:2107
#, c-format
msgid "E71: Invalid character after %s%%"
-msgstr "E71: Virheellinen merkki merkinnn %s%% jljess"
+msgstr "E71: Virheellinen merkki merkinnän %s%% jäljessä"
+
+#, c-format
+msgid "E888: (NFA regexp) cannot repeat %s"
+msgstr "E888: (NFA-säänn. ilmaus) ei voi toistaa kohdetta %s"
-#: ../regexp.c:3017
#, c-format
msgid "E554: Syntax error in %s{...}"
msgstr "E554: Syntaksivirhe ilmauksessa %s{...}"
-#: ../regexp.c:3805
msgid "External submatches:\n"
-msgstr "Ulkoisia alitsmyksi:\n"
+msgstr "Ulkoisia alitäsmäyksiä:\n"
-#: ../regexp.c:7022
msgid ""
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be "
"used "
msgstr ""
+"E864: \\%#=-merkkien perään voi tulla vain 0, 1 tai 2. Käytetään "
+"automaattista engineä "
-#: ../regexp_nfa.c:239
-msgid "E865: (NFA) Regexp end encountered prematurely"
-msgstr ""
-
-#: ../regexp_nfa.c:240
-#, c-format
-msgid "E866: (NFA regexp) Misplaced %c"
-msgstr ""
-
-#: ../regexp_nfa.c:242
-#, c-format
-msgid "E877: (NFA regexp) Invalid character class: %<PRId64>"
-msgstr ""
-
-#: ../regexp_nfa.c:1261
-#, c-format
-msgid "E867: (NFA) Unknown operator '\\z%c'"
-msgstr ""
-
-#: ../regexp_nfa.c:1387
-#, c-format
-msgid "E867: (NFA) Unknown operator '\\%%%c'"
-msgstr ""
-
-#: ../regexp_nfa.c:1802
-#, c-format
-msgid "E869: (NFA) Unknown operator '\\@%c'"
-msgstr ""
-
-#: ../regexp_nfa.c:1831
-msgid "E870: (NFA regexp) Error reading repetition limits"
-msgstr ""
-
-#. Can't have a multi follow a multi.
-#: ../regexp_nfa.c:1895
-msgid "E871: (NFA regexp) Can't have a multi follow a multi !"
-msgstr ""
-
-#. Too many `('
-#: ../regexp_nfa.c:2037
-msgid "E872: (NFA regexp) Too many '('"
-msgstr ""
-
-#: ../regexp_nfa.c:2042
-#, fuzzy
-msgid "E879: (NFA regexp) Too many \\z("
-msgstr "E50: Liikaa merkkej \\z("
-
-#: ../regexp_nfa.c:2066
-msgid "E873: (NFA regexp) proper termination error"
-msgstr ""
-
-#: ../regexp_nfa.c:2599
-msgid "E874: (NFA) Could not pop the stack !"
-msgstr ""
-
-#: ../regexp_nfa.c:3298
-msgid ""
-"E875: (NFA regexp) (While converting from postfix to NFA), too many states "
-"left on stack"
-msgstr ""
-
-#: ../regexp_nfa.c:3302
-msgid "E876: (NFA regexp) Not enough space to store the whole NFA "
-msgstr ""
-
-#: ../regexp_nfa.c:4571 ../regexp_nfa.c:4869
-msgid ""
-"Could not open temporary log file for writing, displaying on stderr ... "
-msgstr ""
+msgid "Switching to backtracking RE engine for pattern: "
+msgstr "Vaihdetaan käyttämään backtrackkaavaa RE-engineä ilmaukselle: "
-#: ../regexp_nfa.c:4840
-#, c-format
-msgid "(NFA) COULD NOT OPEN %s !"
-msgstr ""
-
-#: ../regexp_nfa.c:6049
-#, fuzzy
-msgid "Could not open temporary log file for writing "
-msgstr "E828: Kumoustiedoston avaus kirjoittamista varten ei onnistu: %s"
+#~ msgid " TERMINAL"
+#~ msgstr ""
# tiloja
-#: ../screen.c:7435
msgid " VREPLACE"
msgstr " VKORVAUS"
-#: ../screen.c:7437
msgid " REPLACE"
msgstr " KORVAUS"
-#: ../screen.c:7440
msgid " REVERSE"
-msgstr " KNTEIS"
+msgstr " KÄÄNTEIS"
-#: ../screen.c:7441
msgid " INSERT"
-msgstr " SYTT"
+msgstr " SYÖTTÖ"
-#: ../screen.c:7443
msgid " (insert)"
-msgstr " (sytt)"
+msgstr " (syöttö)"
-#: ../screen.c:7445
msgid " (replace)"
msgstr " (korvaus)"
-#: ../screen.c:7447
msgid " (vreplace)"
msgstr " (vkorvaus)"
-#: ../screen.c:7449
msgid " Hebrew"
msgstr " Heprea"
-#: ../screen.c:7454
msgid " Arabic"
msgstr " Arabia"
-#: ../screen.c:7456
-msgid " (lang)"
-msgstr " (kieli)"
-
-#: ../screen.c:7459
msgid " (paste)"
msgstr " (liitos)"
-#: ../screen.c:7469
msgid " VISUAL"
msgstr " VALINTA"
-#: ../screen.c:7470
msgid " VISUAL LINE"
msgstr " VALINTARIVI"
-#: ../screen.c:7471
msgid " VISUAL BLOCK"
msgstr " VALINTALOHKO"
-#: ../screen.c:7472
msgid " SELECT"
msgstr " WALINTA"
-#: ../screen.c:7473
msgid " SELECT LINE"
msgstr " WALINTARIVI"
-#: ../screen.c:7474
msgid " SELECT BLOCK"
msgstr " WALINTALOHKO"
-#: ../screen.c:7486 ../screen.c:7541
msgid "recording"
msgstr "tallennetaan"
-#: ../search.c:487
#, c-format
msgid "E383: Invalid search string: %s"
msgstr "E383: Viallinen hakujono: %s"
-#: ../search.c:832
#, c-format
msgid "E384: search hit TOP without match for: %s"
-msgstr "E384: Haku psi alkuun lytmtt jonoa: %s"
+msgstr "E384: Haku pääsi alkuun löytämättä jonoa: %s"
-#: ../search.c:835
#, c-format
msgid "E385: search hit BOTTOM without match for: %s"
-msgstr "E385: Haku psi loppuun lytmtt jonoa: %s"
+msgstr "E385: Haku pääsi loppuun löytämättä jonoa: %s"
-#: ../search.c:1200
msgid "E386: Expected '?' or '/' after ';'"
-msgstr "E386: ;:n jlkeen pit olla ? tai /"
+msgstr "E386: ;:n jälkeen pitää olla ? tai /"
-#: ../search.c:4085
msgid " (includes previously listed match)"
-msgstr " (sislt viimeksi luetellun tsmyksen)"
+msgstr " (sisältää viimeksi luetellun täsmäyksen)"
#. cursor at status line
-#: ../search.c:4104
msgid "--- Included files "
-msgstr "--- Sisllytetyt tiedostot "
+msgstr "--- Sisällytetyt tiedostot "
-#: ../search.c:4106
msgid "not found "
-msgstr "ei lytynyt "
+msgstr "ei löytynyt "
-#: ../search.c:4107
msgid "in path ---\n"
msgstr "polusta ---\n"
-#: ../search.c:4168
msgid " (Already listed)"
msgstr " (Jo lueteltu)"
-#: ../search.c:4170
msgid " NOT FOUND"
-msgstr " EI LYTYNYT"
+msgstr " EI LÖYTYNYT"
-#: ../search.c:4211
#, c-format
msgid "Scanning included file: %s"
-msgstr "Haku sislsi tiedoston: %s"
+msgstr "Haku sisälsi tiedoston: %s"
-#: ../search.c:4216
#, c-format
msgid "Searching included file %s"
-msgstr "Haku sislsi tiedoston %s"
+msgstr "Haku sisälsi tiedoston %s"
-#: ../search.c:4405
msgid "E387: Match is on current line"
-msgstr "E387: Tsmys tll rivill"
+msgstr "E387: Täsmäys tällä rivillä"
-#: ../search.c:4517
msgid "All included files were found"
-msgstr "Kaikki sisllytetyt rivit lytyivt"
+msgstr "Kaikki sisällytetyt rivit löytyivät"
-#: ../search.c:4519
msgid "No included files"
-msgstr "Ei sisllytettyj tiedostoja"
+msgstr "Ei sisällytettyjä tiedostoja"
-#: ../search.c:4527
msgid "E388: Couldn't find definition"
-msgstr "E388: Mritelm ei lydy"
+msgstr "E388: Määritelmä ei löydy"
-#: ../search.c:4529
msgid "E389: Couldn't find pattern"
-msgstr "E389: kuvio ei lydy"
+msgstr "E389: kuvio ei löydy"
+
+#~ msgid "too few bytes read"
+#~ msgstr ""
-#: ../search.c:4668
-msgid "Substitute "
-msgstr "Korvaa "
+#, fuzzy, c-format
+#~ msgid "System error while skipping in ShaDa file: %s"
+#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
-#: ../search.c:4681
#, c-format
-msgid ""
-"\n"
-"# Last %sSearch Pattern:\n"
-"~"
-msgstr ""
-"\n"
-"# Edellinen %sHakulauseke:\n"
-"~"
+#~ msgid ""
+#~ "Error while reading ShaDa file: last entry specified that it occupies "
+#~ "%<PRIu64> bytes, but file ended earlier"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "System error while closing ShaDa file: %s"
+#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
+
+#, fuzzy, c-format
+#~ msgid "System error while writing ShaDa file: %s"
+#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
+
+#, fuzzy, c-format
+#~ msgid "Reading ShaDa file \"%s\"%s%s%s"
+#~ msgstr "Luetaan viminfo-tiedostoa \"%s\"%s%s%s"
+
+msgid " info"
+msgstr " info"
+
+msgid " marks"
+msgstr " merkit"
+
+msgid " oldfiles"
+msgstr " vanhaatiedostoa"
+
+msgid " FAILED"
+msgstr " EPÄONNISTUI"
+
+#, c-format
+#~ msgid "System error while opening ShaDa file %s for reading: %s"
+#~ msgstr ""
+
+#~ msgid "additional elements of ShaDa "
+#~ msgstr ""
+
+#~ msgid "additional data of ShaDa "
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "Failed to write variable %s"
+#~ msgstr "ei voitu vaihtaa puskuriin %d"
+
+#, c-format
+#~ msgid ""
+#~ "Failed to parse ShaDa file due to a msgpack parser error at position "
+#~ "%<PRIu64>"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Failed to parse ShaDa file: incomplete msgpack string at position %<PRIu64>"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Failed to parse ShaDa file: extra bytes in msgpack string at position "
+#~ "%<PRIu64>"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "System error while opening ShaDa file %s for reading to merge before writing "
+#~ "it: %s"
+#~ msgstr ""
+
+#. Tried names from .tmp.a to .tmp.z, all failed. Something must be
+#. wrong then.
+#, c-format
+#~ msgid "E138: All %s.tmp.X files exist, cannot write ShaDa file!"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "System error while opening temporary ShaDa file %s for writing: %s"
+#~ msgstr "Väliaikaislokitiedoston avaus kirjoittamista varten ei onnistu"
+
+#, c-format
+#~ msgid "Failed to create directory %s for writing ShaDa file: %s"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "System error while opening ShaDa file %s for writing: %s"
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "Writing ShaDa file \"%s\""
+#~ msgstr "Kirjoitetaan viminfo-tiedostoa %s"
+
+#, fuzzy, c-format
+#~ msgid "Failed setting uid and gid for file %s: %s"
+#~ msgstr "Ladattu kumoustiedoto %s"
+
+#, fuzzy, c-format
+#~ msgid "E137: ShaDa file is not writable: %s"
+#~ msgstr "E137: Viminfo-tiedostoon ei voitu kirjoittaa: %s"
+
+#, fuzzy, c-format
+#~ msgid "Can't rename ShaDa file from %s to %s!"
+#~ msgstr "E886: Viminfo-tiedostoa ei voit uudelleennimetä nimelle %s"
+
+#, fuzzy, c-format
+#~ msgid "Did not rename %s because %s does not looks like a ShaDa file"
+#~ msgstr " [ei näytä Vimin swap-tiedostolta]"
+
+#, c-format
+#~ msgid "Did not rename %s to %s because there were errors during writing it"
+#~ msgstr ""
+
+#, c-format
+#~ msgid "Do not forget to remove %s or rename it manually to %s."
+#~ msgstr ""
+
+#, fuzzy, c-format
+#~ msgid "System error while reading ShaDa file: %s"
+#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
+
+#, fuzzy, c-format
+#~ msgid "System error while reading integer from ShaDa file: %s"
+#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
+
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: expected positive integer at position "
+#~ "%<PRIu64>, but got nothing"
+#~ msgstr ""
-#: ../spell.c:951
-msgid "E759: Format error in spell file"
-msgstr "E759: Muotoiluvirhe oikolukutiedostossa"
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: expected positive integer at position "
+#~ "%<PRIu64>"
+#~ msgstr ""
+
+#. kSDItemUnknown cannot possibly pass that far because it is -1 and that
+#. will fail in msgpack_read_uint64. But kSDItemMissing may and it will
+#. otherwise be skipped because (1 << 0) will never appear in flags.
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: there is an item at position %<PRIu64> that "
+#~ "must not be there: Missing items are for internal uses only"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: buffer list at position %<PRIu64> contains "
+#~ "entry that is not a dictionary"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: buffer list at position %<PRIu64> contains "
+#~ "entry with invalid line number"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: buffer list at position %<PRIu64> contains "
+#~ "entry with invalid column number"
+#~ msgstr ""
+
+#, c-format
+#~ msgid ""
+#~ "Error while reading ShaDa file: buffer list at position %<PRIu64> contains "
+#~ "entry that does not have a file name"
+#~ msgstr ""
+
+#. values for ts_isdiff
+#. no different byte (yet)
+#. different byte found
+#. inserting character
+#. values for ts_flags
+#. already checked that prefix is OK
+#. tried split at this point
+#. did a delete, "ts_delidx" has index
+#. special values ts_prefixdepth
+#. not using prefixes
+#. walking through the prefix tree
+#. highest value that's not special
+#. mode values for find_word
+#. find word case-folded
+#. find keep-case word
+#. find word after prefix
+#. find case-folded compound word
+#. find keep-case compound word
+#, fuzzy
+#~ msgid "E759: Format error in spell file"
+#~ msgstr "E297: Kirjoitusvirhe swap-tiedostossa"
+
+msgid "E756: Spell checking is not enabled"
+msgstr "E756: Oikaisuluku ei ole päällä"
+
+#, c-format
+msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""
+msgstr "Varoitus: Ei löydetty sanalistaa %s.%s.spl tai %s.ascii.spl"
+
+#. This is probably an error. Give a warning and
+#. accept the words anyway.
+#, c-format
+msgid "Warning: region %s not supported"
+msgstr "Varoitus: osaa %s ei tueta"
+
+msgid "Sorry, no suggestions"
+msgstr "ei ehdotuksia"
+
+#, fuzzy, c-format
+#~ msgid "Sorry, only %<PRId64> suggestions"
+#~ msgstr "vain %ld ehdotusta"
+
+#. for when 'cmdheight' > 1
+#. avoid more prompt
+#, c-format
+msgid "Change \"%.*s\" to:"
+msgstr "Muuta %.*s:"
+
+#, c-format
+msgid " < \"%.*s\""
+msgstr " < %.*s"
+
+msgid "E752: No previous spell replacement"
+msgstr "E752: Ei edellistä oikaisulukukorjausta"
+
+#, c-format
+msgid "E753: Not found: %s"
+msgstr "E753: Ei löytynyt: %s"
-#: ../spell.c:952
msgid "E758: Truncated spell file"
msgstr "E758: Oikolukutiedosto katkaistu"
-#: ../spell.c:953
#, c-format
msgid "Trailing text in %s line %d: %s"
-msgstr "Teksti rivin perss tiedostossa %s rivill %d: %s"
+msgstr "Tekstiä rivin perässä tiedostossa %s rivillä %d: %s"
-#: ../spell.c:954
#, c-format
msgid "Affix name too long in %s line %d: %s"
-msgstr "Affiksin nimi on liian pitk tiedostossa %s rivill %d: %s"
+msgstr "Affiksin nimi on liian pitkä tiedostossa %s rivillä %d: %s"
-#: ../spell.c:955
msgid "E761: Format error in affix file FOL, LOW or UPP"
msgstr "E761: Affiksitiedoston FOL-, LOW- tai UPP-muotovirhe "
-#: ../spell.c:957
msgid "E762: Character in FOL, LOW or UPP is out of range"
-msgstr "E762: Merkki FOL:ss, LOW:ss tai UPP:ss ei kuulu arvoalueeseen"
+msgstr "E762: Merkki FOL:ssä, LOW:ssä tai UPP:ssä ei kuulu arvoalueeseen"
-#: ../spell.c:958
msgid "Compressing word tree..."
-msgstr "Tiivistetn sanapuuta..."
-
-#: ../spell.c:1951
-msgid "E756: Spell checking is not enabled"
-msgstr "E756: Oikaisuluku ei ole pll"
-
-#: ../spell.c:2249
-#, c-format
-msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""
-msgstr "Varoitus: Ei lydetty sanalistaa %s.%s.spl tai %s.ascii.spl"
+msgstr "Tiivistetään sanapuuta..."
-#: ../spell.c:2473
#, c-format
msgid "Reading spell file \"%s\""
msgstr "Luetaan oikaisulukutiedosta %s"
-#: ../spell.c:2496
msgid "E757: This does not look like a spell file"
msgstr "E757: Ei vaikuta oikaisulukutiedostolta"
-#: ../spell.c:2501
+#, fuzzy, c-format
+#~ msgid "E5042: Failed to read spell file %s: %s"
+#~ msgstr "E482: Tiedostoa %s ei voi luoda"
+
msgid "E771: Old spell file, needs to be updated"
-msgstr "E771: Vanha oikaisulukutiedosto vaatii pivittmist"
+msgstr "E771: Vanha oikaisulukutiedosto vaatii päivittämistä"
-#: ../spell.c:2504
msgid "E772: Spell file is for newer version of Vim"
msgstr "E772: Oikaisulukutiedosto on uudemmalle Vimille"
-#: ../spell.c:2602
msgid "E770: Unsupported section in spell file"
msgstr "E770: Tukematon osio oikaisulukutiedostossa"
-#: ../spell.c:3762
#, c-format
-msgid "Warning: region %s not supported"
-msgstr "Varoitus: osaa %s ei tueta"
+msgid "E778: This does not look like a .sug file: %s"
+msgstr "E778: Ei vaikuta .sug-tiedostolta: %s"
+
+#, c-format
+msgid "E779: Old .sug file, needs to be updated: %s"
+msgstr "E779: Vanha .sug-tiedosto pitää päivittää: %s"
+
+#, c-format
+msgid "E780: .sug file is for newer version of Vim: %s"
+msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s"
+
+#, c-format
+msgid "E781: .sug file doesn't match .spl file: %s"
+msgstr "E781: .sug-tiedosto ei täsmää .spl-tiedostoon: %s"
+
+#, c-format
+msgid "E782: error while reading .sug file: %s"
+msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
-#: ../spell.c:4550
#, c-format
msgid "Reading affix file %s ..."
msgstr "Luetaan affiksitiedostoa %s..."
-#: ../spell.c:4589 ../spell.c:5635 ../spell.c:6140
#, c-format
msgid "Conversion failure for word in %s line %d: %s"
-msgstr "Muunnosvirhe sanalle %s rivill %d: %s"
+msgstr "Muunnosvirhe sanalle %s rivillä %d: %s"
-#: ../spell.c:4630 ../spell.c:6170
#, c-format
msgid "Conversion in %s not supported: from %s to %s"
msgstr "Muunnosta kohteessa %s ei tueta: kohteesta %s kohteeseen %s"
-#: ../spell.c:4642
#, c-format
msgid "Invalid value for FLAG in %s line %d: %s"
-msgstr "Tuntematon FLAG kohteessa %s rivill %d: %s"
+msgstr "Tuntematon FLAG kohteessa %s rivillä %d: %s"
-#: ../spell.c:4655
#, c-format
msgid "FLAG after using flags in %s line %d: %s"
-msgstr "FLAG kohteessa %s lippujen jlkeen rivill %d: %s"
+msgstr "FLAG kohteessa %s lippujen jälkeen rivillä %d: %s"
-#: ../spell.c:4723
#, c-format
msgid ""
"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line "
"%d"
msgstr ""
-"COMPOUNDFORBIDFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s "
-"rivill %d"
+"COMPOUNDFORBIDFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s "
+"rivillä %d"
-#: ../spell.c:4731
#, c-format
msgid ""
"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line "
"%d"
msgstr ""
-"COMPOUNDPERMITFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s "
-"rivill %d"
+"COMPOUNDPERMITFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s "
+"rivillä %d"
-#: ../spell.c:4747
#, c-format
msgid "Wrong COMPOUNDRULES value in %s line %d: %s"
-msgstr "Vr COMPOUNDRULES-arvo kohteessa %s rivill %d: %s"
+msgstr "Väärä COMPOUNDRULES-arvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:4771
#, c-format
msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s"
-msgstr "Vr COMPOUNDWORDMAX-arvo kohteessa %s rivill %d: %s"
+msgstr "Väärä COMPOUNDWORDMAX-arvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:4777
#, c-format
msgid "Wrong COMPOUNDMIN value in %s line %d: %s"
-msgstr "Vr COMPOUNDMIN-arvo kohteessa %s rivill %d: %s"
+msgstr "Väärä COMPOUNDMIN-arvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:4783
#, c-format
msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s"
-msgstr "Vr COMPOUNDSYLMAX-arvo kohteessa %s rivill %d: %s"
+msgstr "Väärä COMPOUNDSYLMAX-arvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:4795
#, c-format
msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"
-msgstr "Vr CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivill %d: %s"
+msgstr "Väärä CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:4847
#, c-format
msgid "Different combining flag in continued affix block in %s line %d: %s"
msgstr ""
-"Eri yhdistelmlippu jatketussa affiksilohkossa kohteessa %s rivill %d: %s"
+"Eri yhdistelmälippu jatketussa affiksilohkossa kohteessa %s rivillä %d: %s"
-#: ../spell.c:4850
#, c-format
msgid "Duplicate affix in %s line %d: %s"
-msgstr "Kaksoiskappale affiksista kohteessa %s rivill %d: %s"
+msgstr "Kaksoiskappale affiksista kohteessa %s rivillä %d: %s"
-#: ../spell.c:4871
-#, c-format
+#, fuzzy, c-format
msgid ""
-"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s "
+"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGESTin %s "
"line %d: %s"
msgstr ""
-"Affiksia kytetty mys BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai "
-"NOSUGGEST-arvossa kohteessa %s rivill %d: %s"
+"Affiksia käytetty myös BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai "
+"NOSUGGEST-arvossa kohteessa %s rivillä %d: %s"
-#: ../spell.c:4893
#, c-format
msgid "Expected Y or N in %s line %d: %s"
-msgstr "Odotettiin Y:t tai N: kohteessa %s rivill %d: %s"
+msgstr "Odotettiin Y:tä tai N:ää kohteessa %s rivillä %d: %s"
-#: ../spell.c:4968
#, c-format
msgid "Broken condition in %s line %d: %s"
-msgstr "Viallinen ehto kohteessa %s rivill %d: %s"
+msgstr "Viallinen ehto kohteessa %s rivillä %d: %s"
-#: ../spell.c:5091
#, c-format
msgid "Expected REP(SAL) count in %s line %d"
-msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivill %d"
+msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivillä %d"
-#: ../spell.c:5120
#, c-format
msgid "Expected MAP count in %s line %d"
-msgstr "Odotettiin MAP-arvoa kohteessa %s rivill %d"
+msgstr "Odotettiin MAP-arvoa kohteessa %s rivillä %d"
-#: ../spell.c:5132
#, c-format
msgid "Duplicate character in MAP in %s line %d"
-msgstr "Kaksoiskappale merkist MAP:ss kohteessa %s rivill %d"
+msgstr "Kaksoiskappale merkistä MAP:ssä kohteessa %s rivillä %d"
-#: ../spell.c:5176
#, c-format
msgid "Unrecognized or duplicate item in %s line %d: %s"
-msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivill %d: %s"
+msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivillä %d: %s"
-#: ../spell.c:5197
#, c-format
msgid "Missing FOL/LOW/UPP line in %s"
msgstr "Puuttuva FOL, LOW tai UPP rivi kohteessa %s"
-#: ../spell.c:5220
msgid "COMPOUNDSYLMAX used without SYLLABLE"
msgstr "COMPOUNDSYLMAX ilman SYLLABLEa"
-#: ../spell.c:5236
msgid "Too many postponed prefixes"
-msgstr "Liikaa jlkikteistettyj prefiksej"
+msgstr "Liikaa jälkikäteistettyjä prefiksejä"
-#: ../spell.c:5238
msgid "Too many compound flags"
msgstr "Liikaa yhdyssanalippuja"
-#: ../spell.c:5240
msgid "Too many postponed prefixes and/or compound flags"
-msgstr "Liikaa jlkikteistettyj prefiksej tai yhdyssanalippuja"
+msgstr "Liikaa jälkikäteistettyjä prefiksejä tai yhdyssanalippuja"
-#: ../spell.c:5250
#, c-format
msgid "Missing SOFO%s line in %s"
msgstr "Puuttuva SOFO%s-rivi kohteessa %s"
-#: ../spell.c:5253
#, c-format
msgid "Both SAL and SOFO lines in %s"
msgstr "SAL- ja SOFO-rivit kohteessa %s"
-#: ../spell.c:5331
#, c-format
msgid "Flag is not a number in %s line %d: %s"
-msgstr "Lippu ei ole lukuarvo kohteessa %s rivill %d: %s"
+msgstr "Lippu ei ole lukuarvo kohteessa %s rivillä %d: %s"
-#: ../spell.c:5334
#, c-format
msgid "Illegal flag in %s line %d: %s"
-msgstr "Tuntematon lippu kohteessa %s rivill %d: %s"
+msgstr "Tuntematon lippu kohteessa %s rivillä %d: %s"
-#: ../spell.c:5493 ../spell.c:5501
#, c-format
msgid "%s value differs from what is used in another .aff file"
msgstr "%s-arvo eroaa toisessa .aff-tiedostossa olevasta"
-#: ../spell.c:5602
#, c-format
msgid "Reading dictionary file %s ..."
msgstr "Luetaan sanakirjatiedostoa %s"
-#: ../spell.c:5611
#, c-format
msgid "E760: No word count in %s"
msgstr "E760: Ei sanalaskuria kohteessa %s"
-#: ../spell.c:5669
#, c-format
msgid "line %6d, word %6d - %s"
msgstr "rivi %6d, sana %6d - %s"
-#: ../spell.c:5691
#, c-format
msgid "Duplicate word in %s line %d: %s"
-msgstr "Toistettu sana kohteessa %s rivill %d: %s"
+msgstr "Toistettu sana kohteessa %s rivillä %d: %s"
-#: ../spell.c:5694
#, c-format
msgid "First duplicate word in %s line %d: %s"
-msgstr "Ensimminen kappale kohteessa %s rivill %d: %s"
+msgstr "Ensimmäinen kappale kohteessa %s rivillä %d: %s"
-#: ../spell.c:5746
#, c-format
msgid "%d duplicate word(s) in %s"
msgstr "toistettuja sanoja %d kohteessa %s"
-#: ../spell.c:5748
#, c-format
msgid "Ignored %d word(s) with non-ASCII characters in %s"
msgstr "Ei-ASCII-merkkien takia ohitettuja sanoja %d kohteessa %s"
-#: ../spell.c:6115
#, c-format
msgid "Reading word file %s ..."
msgstr "Luetaan sanatiedostoa %s..."
-#: ../spell.c:6155
#, c-format
msgid "Duplicate /encoding= line ignored in %s line %d: %s"
-msgstr "Toistettu /encoding= ohitettu kohteessa %s rivill %d: %s"
+msgstr "Toistettu /encoding= ohitettu kohteessa %s rivillä %d: %s"
-#: ../spell.c:6159
#, c-format
msgid "/encoding= line after word ignored in %s line %d: %s"
-msgstr "/encoding= sanojen jlkeen ohitettu kohteessa %s rivill %d: %s"
+msgstr "/encoding= sanojen jälkeen ohitettu kohteessa %s rivillä %d: %s"
-#: ../spell.c:6180
#, c-format
msgid "Duplicate /regions= line ignored in %s line %d: %s"
-msgstr "Toistettu /regions= ohitettu kohteessa %s rivill %d: %s"
+msgstr "Toistettu /regions= ohitettu kohteessa %s rivillä %d: %s"
-#: ../spell.c:6185
#, c-format
msgid "Too many regions in %s line %d: %s"
-msgstr "Liikaa regionseja kohteessa %s rivill %d: %s"
+msgstr "Liikaa regionseja kohteessa %s rivillä %d: %s"
-#: ../spell.c:6198
#, c-format
msgid "/ line ignored in %s line %d: %s"
-msgstr "/ ohitettu kohteessa %s rivill %d: %s"
+msgstr "/ ohitettu kohteessa %s rivillä %d: %s"
-#: ../spell.c:6224
#, c-format
msgid "Invalid region nr in %s line %d: %s"
-msgstr "Virheellinen region-luku kohteessa %s rivill %d: %s"
+msgstr "Virheellinen region-luku kohteessa %s rivillä %d: %s"
-#: ../spell.c:6230
#, c-format
msgid "Unrecognized flags in %s line %d: %s"
-msgstr "Tunnistamaton lippu kohteessa %s rivill %d: %s"
+msgstr "Tunnistamaton lippu kohteessa %s rivillä %d: %s"
-#: ../spell.c:6257
#, c-format
msgid "Ignored %d words with non-ASCII characters"
msgstr "Ei-ASCIIn takia ohitettuja sanoja %d"
-#: ../spell.c:6656
#, c-format
msgid "Compressed %d of %d nodes; %d (%d%%) remaining"
-msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jljell"
+msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jäljellä"
-#: ../spell.c:7340
msgid "Reading back spell file..."
msgstr "Luetaan taas oikaisulukutiedostoa..."
#. Go through the trie of good words, soundfold each word and add it to
#. the soundfold trie.
-#: ../spell.c:7357
msgid "Performing soundfolding..."
-msgstr "ntmyksen mukaan yhdistelln..."
+msgstr "Ääntämyksen mukaan yhdistellään..."
-#: ../spell.c:7368
-#, c-format
-msgid "Number of words after soundfolding: %<PRId64>"
-msgstr "Sanoja ntmysyhdistelyn jlkeen: %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "Number of words after soundfolding: %<PRId64>"
+#~ msgstr "Sanoja ääntämysyhdistelyn jälkeen: %ld"
-#: ../spell.c:7476
#, c-format
msgid "Total number of words: %d"
-msgstr "Sanoja yhteens: %d"
+msgstr "Sanoja yhteensä: %d"
-#: ../spell.c:7655
#, c-format
msgid "Writing suggestion file %s ..."
msgstr "Kirjoitetaan ehdotustiedostoa %s..."
-#: ../spell.c:7707 ../spell.c:7927
#, c-format
msgid "Estimated runtime memory use: %d bytes"
-msgstr "Arvioitu kyttmuisti: %d tavua"
+msgstr "Arvioitu käyttömuisti: %d tavua"
-#: ../spell.c:7820
msgid "E751: Output file name must not have region name"
-msgstr "E751: Tulostetiedostonimess ei saa olla alueen nime"
+msgstr "E751: Tulostetiedostonimessä ei saa olla alueen nimeä"
-#: ../spell.c:7822
msgid "E754: Only up to 8 regions supported"
-msgstr "E754: Enintn 8 aluetta tuetaan"
+msgstr "E754: Enintään 8 aluetta tuetaan"
-#: ../spell.c:7846
#, c-format
msgid "E755: Invalid region in %s"
msgstr "E755: Virheellinen alue kohteelle %s"
-#: ../spell.c:7907
msgid "Warning: both compounding and NOBREAK specified"
-msgstr "Varoitus: sek yhdyssanamuodostus ett NOBREAK kytss"
+msgstr "Varoitus: sekä yhdyssanamuodostus että NOBREAK käytössä"
-#: ../spell.c:7920
#, c-format
msgid "Writing spell file %s ..."
msgstr "Kirjoitetaan oikaisulukutiedostoa %s..."
-#: ../spell.c:7925
msgid "Done!"
msgstr "Valmista."
-#: ../spell.c:8034
-#, c-format
-msgid "E765: 'spellfile' does not have %<PRId64> entries"
-msgstr "E765: spellfile ei sisll %<PRId64> kohtaa"
-
-#: ../spell.c:8074
#, fuzzy, c-format
-msgid "Word '%.*s' removed from %s"
-msgstr "Sana poistettu kohteesta %s"
+#~ msgid "E765: 'spellfile' does not have %<PRId64> entries"
+#~ msgstr "E765: spellfile ei sisällä %ld kohtaa"
-#: ../spell.c:8117
-#, fuzzy, c-format
-msgid "Word '%.*s' added to %s"
-msgstr "Sana listty kohteeseen %s"
-
-#: ../spell.c:8381
-msgid "E763: Word characters differ between spell files"
-msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen vlill"
-
-#: ../spell.c:8684
-msgid "Sorry, no suggestions"
-msgstr "Sori, ei ehdotuksia"
-
-#: ../spell.c:8687
-#, c-format
-msgid "Sorry, only %<PRId64> suggestions"
-msgstr "Sori, vain %<PRId64> ehdotusta"
-
-#. for when 'cmdheight' > 1
-#. avoid more prompt
-#: ../spell.c:8704
-#, c-format
-msgid "Change \"%.*s\" to:"
-msgstr "Muuta %.*s:"
-
-#: ../spell.c:8737
-#, c-format
-msgid " < \"%.*s\""
-msgstr " < %.*s"
-
-#: ../spell.c:8882
-msgid "E752: No previous spell replacement"
-msgstr "E752: Ei edellist oikaisulukukorjausta"
-
-#: ../spell.c:8925
-#, c-format
-msgid "E753: Not found: %s"
-msgstr "E753: Ei lytynyt: %s"
-
-#: ../spell.c:9276
-#, c-format
-msgid "E778: This does not look like a .sug file: %s"
-msgstr "E778: Ei vaikuta .sug-tiedostolta: %s"
-
-#: ../spell.c:9282
-#, c-format
-msgid "E779: Old .sug file, needs to be updated: %s"
-msgstr "E779: Vanha .sug-tiedosto pit pivitt: %s"
-
-#: ../spell.c:9286
#, c-format
-msgid "E780: .sug file is for newer version of Vim: %s"
-msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s"
+msgid "Word '%.*s' removed from %s"
+msgstr "Sana %.*s poistettu kohteesta %s"
-#: ../spell.c:9295
#, c-format
-msgid "E781: .sug file doesn't match .spl file: %s"
-msgstr "E781: .sug-tiedosto ei tsm .spl-tiedostoon: %s"
+msgid "Word '%.*s' added to %s"
+msgstr "Sana %.*s lisätty kohteeseen %s"
-#: ../spell.c:9305
-#, c-format
-msgid "E782: error while reading .sug file: %s"
-msgstr "E782: virhe luettaessa .sug-tiedostoa: %s"
+msgid "E763: Word characters differ between spell files"
+msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen välillä"
#. This should have been checked when generating the .spl
#. file.
-#: ../spell.c:11575
msgid "E783: duplicate char in MAP entry"
-msgstr "E783: kaksoiskappale merkist MAP-kohdassa"
+msgstr "E783: kaksoiskappale merkistä MAP-kohdassa"
+
+msgid "E766: Insufficient arguments for printf()"
+msgstr "E766: printf():lle ei annettu tarpeeksi argumentteja"
+
+msgid "E807: Expected Float argument for printf()"
+msgstr "E807: Odotettiin Float-argumenttia printf():lle"
+
+msgid "E767: Too many arguments to printf()"
+msgstr "E767: printf():lle annettiin liikaa argumentteja"
-#: ../syntax.c:266
msgid "No Syntax items defined for this buffer"
-msgstr "Ei syntaksikohteita tlle puskurille"
+msgstr "Ei syntaksikohteita tälle puskurille"
-#: ../syntax.c:3083 ../syntax.c:3104 ../syntax.c:3127
#, c-format
msgid "E390: Illegal argument: %s"
msgstr "E390: Virheellinen argumentti: %s"
-#: ../syntax.c:3299
+msgid "syntax iskeyword "
+msgstr "syntax iskeyword "
+
#, c-format
msgid "E391: No such syntax cluster: %s"
msgstr "E391: Syntaksiklusteri puuttuu: %s"
-#: ../syntax.c:3433
msgid "syncing on C-style comments"
msgstr "synkkaa C-tyylin kommentteihin"
-#: ../syntax.c:3439
msgid "no syncing"
msgstr "ei synkkausta"
-#: ../syntax.c:3441
msgid "syncing starts "
msgstr "synkkaus aloitettu "
-#: ../syntax.c:3443 ../syntax.c:3506
msgid " lines before top line"
-msgstr " rivi ennen alkua"
+msgstr " riviä ennen alkua"
-#: ../syntax.c:3448
msgid ""
"\n"
"--- Syntax sync items ---"
@@ -5729,7 +5225,6 @@ msgstr ""
"\n"
"--- Syntax sync -kohteet ---"
-#: ../syntax.c:3452
msgid ""
"\n"
"syncing on items"
@@ -5737,7 +5232,6 @@ msgstr ""
"\n"
"synkataan kohteisiin"
-#: ../syntax.c:3457
msgid ""
"\n"
"--- Syntax items ---"
@@ -5745,2314 +5239,2499 @@ msgstr ""
"\n"
"--- Syntax-kohteet ---"
-#: ../syntax.c:3475
#, c-format
msgid "E392: No such syntax cluster: %s"
msgstr "E392: syntaksiklusteria ei ole: %s"
-#: ../syntax.c:3497
msgid "minimal "
-msgstr "vhintn "
+msgstr "vähintään "
-#: ../syntax.c:3503
msgid "maximal "
-msgstr "enitntn "
+msgstr "enitntään "
-#: ../syntax.c:3513
msgid "; match "
-msgstr "; tsm "
+msgstr "; täsmää "
-#: ../syntax.c:3515
msgid " line breaks"
msgstr " rivinvaihdot"
-#: ../syntax.c:4076
msgid "E395: contains argument not accepted here"
-msgstr "E395: contains ei sovi thn"
+msgstr "E395: contains ei sovi tähän"
-#: ../syntax.c:4096
-#, fuzzy
msgid "E844: invalid cchar value"
-msgstr "E474: Virheellinen argumentti"
+msgstr "E844: Virheellinen cchar-arvo"
-#: ../syntax.c:4107
msgid "E393: group[t]here not accepted here"
-msgstr "E393: group[t]here ei sovi thn"
+msgstr "E393: group[t]here ei sovi tähän"
-#: ../syntax.c:4126
#, c-format
msgid "E394: Didn't find region item for %s"
-msgstr "E394: Aluetta nimelle %s ei lydy"
+msgstr "E394: Aluetta nimelle %s ei löydy"
-#: ../syntax.c:4188
msgid "E397: Filename required"
msgstr "E397: Tiedostonimi puuttuu"
-#: ../syntax.c:4221
-#, fuzzy
msgid "E847: Too many syntax includes"
-msgstr "E77: Liikaa tiedostonimi"
+msgstr "E847: Liikaa syntax includeja"
-#: ../syntax.c:4303
#, c-format
msgid "E789: Missing ']': %s"
msgstr "E789: ] puuttuu: %s"
-#: ../syntax.c:4531
+#, c-format
+msgid "E890: trailing char after ']': %s]%s"
+msgstr "E890: Ylimääräisiä merkkejä merkin ] perässä: %s]%s"
+
#, c-format
msgid "E398: Missing '=': %s"
msgstr "E398: = puuttuu: %s"
-#: ../syntax.c:4666
#, c-format
msgid "E399: Not enough arguments: syntax region %s"
msgstr "E399: Argumentteja puuttuu: syntaksialue %s"
-#: ../syntax.c:4870
-#, fuzzy
msgid "E848: Too many syntax clusters"
-msgstr "E391: Syntaksiklusteri puuttuu: %s"
+msgstr "E848: Liikaa syntaksiklustereita"
-#: ../syntax.c:4954
msgid "E400: No cluster specified"
-msgstr "E400: klusteri mrittelemtt"
+msgstr "E400: klusteri määrittelemättä"
#. end delimiter not found
-#: ../syntax.c:4986
#, c-format
msgid "E401: Pattern delimiter not found: %s"
msgstr "E401: Kuvoin erotin puuttuu: %s"
-#: ../syntax.c:5049
#, c-format
msgid "E402: Garbage after pattern: %s"
-msgstr "E402: Roskia kuvion jljess: %s"
+msgstr "E402: Roskia kuvion jäljessä: %s"
-#: ../syntax.c:5120
msgid "E403: syntax sync: line continuations pattern specified twice"
-msgstr "E403: syntax sync: rivinjatkamiskuvio mritelty kahdesti"
+msgstr "E403: syntax sync: rivinjatkamiskuvio määritelty kahdesti"
-#: ../syntax.c:5169
#, c-format
msgid "E404: Illegal arguments: %s"
msgstr "E404: Virheelliset argumentit: %s"
-#: ../syntax.c:5217
#, c-format
msgid "E405: Missing equal sign: %s"
msgstr "E405: = puuttuu: %s"
-#: ../syntax.c:5222
#, c-format
msgid "E406: Empty argument: %s"
-msgstr "E406: Tyhj argumentti: %s"
+msgstr "E406: Tyhjä argumentti: %s"
-#: ../syntax.c:5240
#, c-format
msgid "E407: %s not allowed here"
-msgstr "E407: %s ei sovi thn"
+msgstr "E407: %s ei sovi tähän"
-#: ../syntax.c:5246
#, c-format
msgid "E408: %s must be first in contains list"
msgstr "E408: %s kuuluu contains-listan alkuun"
-#: ../syntax.c:5304
#, c-format
msgid "E409: Unknown group name: %s"
-msgstr "E409: Tuntematon ryhmn nimi: %s"
+msgstr "E409: Tuntematon ryhmän nimi: %s"
-#: ../syntax.c:5512
#, c-format
msgid "E410: Invalid :syntax subcommand: %s"
msgstr "E410: Virheelluinen :syntax-osakomento: %s"
-#: ../syntax.c:5854
msgid ""
" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"
msgstr ""
+" KAIKKI MÄÄRÄ TÄSMÄYS HITAIN KEKSIARVO NIMI ILMAUS"
-#: ../syntax.c:6146
msgid "E679: recursive loop loading syncolor.vim"
-msgstr "E679: rekursiivinen silmukka syncolor.vimiss"
+msgstr "E679: rekursiivinen silmukka syncolor.vimissä"
-#: ../syntax.c:6256
#, c-format
msgid "E411: highlight group not found: %s"
-msgstr "E411: korostusryhm ei lytynyt: %s"
+msgstr "E411: korostusryhmää ei löytynyt: %s"
-#: ../syntax.c:6278
#, c-format
msgid "E412: Not enough arguments: \":highlight link %s\""
msgstr "E412: Argumentteja puuttuu: :highlight link %s"
-#: ../syntax.c:6284
#, c-format
msgid "E413: Too many arguments: \":highlight link %s\""
msgstr "E413: Liikaa argumentteja: :highlight link %s"
-#: ../syntax.c:6302
msgid "E414: group has settings, highlight link ignored"
-msgstr "E414: ryhmll on asetuksia, highlight link -komento ohitetaan"
+msgstr "E414: ryhmällä on asetuksia, highlight link -komento ohitetaan"
-#: ../syntax.c:6367
#, c-format
msgid "E415: unexpected equal sign: %s"
msgstr "E415: odotuksenvastainen =-merkki: %s"
-#: ../syntax.c:6395
#, c-format
msgid "E416: missing equal sign: %s"
msgstr "E416: puuttuva =-merkki: %s"
-#: ../syntax.c:6418
#, c-format
msgid "E417: missing argument: %s"
msgstr "E417: puuttuva argumentti: %s"
-#: ../syntax.c:6446
#, c-format
msgid "E418: Illegal value: %s"
msgstr "E418: Viallinen arvo: %s"
-#: ../syntax.c:6496
msgid "E419: FG color unknown"
-msgstr "E419: edustavri tuntematon"
+msgstr "E419: edustaväri tuntematon"
-#: ../syntax.c:6504
msgid "E420: BG color unknown"
-msgstr "E420: taustavri tuntematon"
+msgstr "E420: taustaväri tuntematon"
-#: ../syntax.c:6564
#, c-format
msgid "E421: Color name or number not recognized: %s"
-msgstr "E421: Vrin nimi tai numero tuntematon: %s"
-
-#: ../syntax.c:6714
-#, c-format
-msgid "E422: terminal code too long: %s"
-msgstr "E422: terminaalikoodi liian pitk: %s"
+msgstr "E421: Värin nimi tai numero tuntematon: %s"
-#: ../syntax.c:6753
#, c-format
msgid "E423: Illegal argument: %s"
msgstr "E423: Virheellinen argumentti: %s"
-#: ../syntax.c:6925
msgid "E424: Too many different highlighting attributes in use"
msgstr "E424: Liikaa eri korostusattribuutteja"
-#: ../syntax.c:7427
msgid "E669: Unprintable character in group name"
-msgstr "E669: Tulostuskelvoton merkki ryhmn nimess"
+msgstr "E669: Tulostuskelvoton merkki ryhmän nimessä"
-#: ../syntax.c:7434
msgid "W18: Invalid character in group name"
-msgstr "W18: Virheellinen merkki ryhmn nimess"
+msgstr "W18: Virheellinen merkki ryhmän nimessä"
-#: ../syntax.c:7448
msgid "E849: Too many highlight and syntax groups"
-msgstr ""
+msgstr "E849: Liikaa korostuksia ja syntaksiryhmiä"
-#: ../tag.c:104
msgid "E555: at bottom of tag stack"
-msgstr "E555: tgipinon pohja"
+msgstr "E555: tägipinon pohja"
-#: ../tag.c:105
msgid "E556: at top of tag stack"
-msgstr "E556: tgipinon huippu"
+msgstr "E556: tägipinon huippu"
-#: ../tag.c:380
msgid "E425: Cannot go before first matching tag"
-msgstr "E425: Ei voida menn ensimmist tsmv tgi alummaksi"
+msgstr "E425: Ei voida mennä ensimmäistä täsmäävää tägiä alummaksi"
-#: ../tag.c:504
#, c-format
msgid "E426: tag not found: %s"
-msgstr "E426: tgi puuttuu: %s"
+msgstr "E426: tägi puuttuu: %s"
-#: ../tag.c:528
msgid " # pri kind tag"
-msgstr " # arvo tyyppi tgi"
+msgstr " # arvo tyyppi tägi"
-#: ../tag.c:531
msgid "file\n"
msgstr "tiedosto\n"
-#: ../tag.c:829
msgid "E427: There is only one matching tag"
-msgstr "E427: Vain yksi tgi tsm"
+msgstr "E427: Vain yksi tägi täsmää"
-#: ../tag.c:831
msgid "E428: Cannot go beyond last matching tag"
-msgstr "E428: Ei voida edet viimeisen tsmvn tgin ohi"
+msgstr "E428: Ei voida edetä viimeisen täsmäävän tägin ohi"
-#: ../tag.c:850
#, c-format
msgid "File \"%s\" does not exist"
msgstr "Tiedostoa %s ei ole"
#. Give an indication of the number of matching tags
-#: ../tag.c:859
#, c-format
msgid "tag %d of %d%s"
-msgstr "tgi %d/%d%s"
+msgstr "tägi %d/%d%s"
-#: ../tag.c:862
msgid " or more"
msgstr " tai useammasta"
-#: ../tag.c:864
msgid " Using tag with different case!"
-msgstr " Tgiss eri kirjaintaso"
+msgstr " Tägissä eri kirjaintaso"
-#: ../tag.c:909
#, c-format
msgid "E429: File \"%s\" does not exist"
msgstr "E429: Tiedostoa %s ei ole"
#. Highlight title
-#: ../tag.c:960
msgid ""
"\n"
" # TO tag FROM line in file/text"
msgstr ""
"\n"
-" # TILL tagg FRN LINJE i fil/text"
+" # TILL tagg FRÅN LINJE i fil/text"
-#: ../tag.c:1303
#, c-format
msgid "Searching tags file %s"
-msgstr "Etsitn tgitiedostoa %s"
+msgstr "Etsitään tägitiedostoa %s"
-#: ../tag.c:1545
msgid "Ignoring long line in tags file"
-msgstr "Ohitetaan pitk rivi tgitiedostossa"
+msgstr "Ohitetaan pitkä rivi tägitiedostossa"
-#: ../tag.c:1915
#, c-format
msgid "E431: Format error in tags file \"%s\""
-msgstr "E431: Muotovirh tgitiedostossa %s"
+msgstr "E431: Muotovirh tägitiedostossa %s"
-#: ../tag.c:1917
-#, c-format
-msgid "Before byte %<PRId64>"
-msgstr "Ennen tavua %<PRId64>"
+#, fuzzy, c-format
+#~ msgid "Before byte %<PRId64>"
+#~ msgstr "Ennen tavua %ld"
-#: ../tag.c:1929
#, c-format
msgid "E432: Tags file not sorted: %s"
-msgstr "E432: Tgitiedosto ei ole jrjestetty: %s"
+msgstr "E432: Tägitiedosto ei ole järjestetty: %s"
#. never opened any tags file
-#: ../tag.c:1960
msgid "E433: No tags file"
-msgstr "E433: Ei tgitiedostoja"
+msgstr "E433: Ei tägitiedostoja"
-#: ../tag.c:2536
msgid "E434: Can't find tag pattern"
-msgstr "E434: Tgikuviota ei lydy"
+msgstr "E434: Tägikuviota ei löydy"
-#: ../tag.c:2544
msgid "E435: Couldn't find tag, just guessing!"
-msgstr "E435: Tgi ei lydy, arvataan."
+msgstr "E435: Tägiä ei löydy, arvataan."
-#: ../tag.c:2797
#, c-format
msgid "Duplicate field name: %s"
-msgstr "Kaksoiskappale kentn nimest: %s"
-
-#: ../term.c:1442
-msgid "' not known. Available builtin terminals are:"
-msgstr " ei tunnettu. Tuetut terminaalit:"
-
-#: ../term.c:1463
-msgid "defaulting to '"
-msgstr "oletusarvona "
-
-#: ../term.c:1731
-msgid "E557: Cannot open termcap file"
-msgstr "E557: Ei voi avata termcap-tiedostoa"
-
-#: ../term.c:1735
-msgid "E558: Terminal entry not found in terminfo"
-msgstr "E558: Terminaalia ei lytynyt terminfosta"
-
-#: ../term.c:1737
-msgid "E559: Terminal entry not found in termcap"
-msgstr "E559: Terminaalia ei lytynyt termcapista"
-
-#: ../term.c:1878
-#, c-format
-msgid "E436: No \"%s\" entry in termcap"
-msgstr "E436: %s ei lytynyt termcapista"
-
-#: ../term.c:2249
-msgid "E437: terminal capability \"cm\" required"
-msgstr "E437: terminaalilla pit olla cm kyvyissn"
-
-#. Highlight title
-#: ../term.c:4376
-msgid ""
-"\n"
-"--- Terminal keys ---"
-msgstr ""
-"\n"
-"--- Terminaalinppimet ---"
-
-#: ../ui.c:481
-msgid "Vim: Error reading input, exiting...\n"
-msgstr "Vim: Virhe luettaessa sytett, poistutaan...\n"
+msgstr "Kaksoiskappale kentän nimestä: %s"
#. 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: Rivimr vaihtui odottamatta"
+msgstr "E881: Rivimäärä vaihtui odottamatta"
-#: ../undo.c:627
#, c-format
msgid "E828: Cannot open undo file for writing: %s"
msgstr "E828: Kumoustiedoston avaus kirjoittamista varten ei onnistu: %s"
-#: ../undo.c:717
+#, fuzzy, c-format
+#~ msgid "E5003: Unable to create directory \"%s\" for undo file: %s"
+#~ msgstr "E346: Hakemisto %s ei ole enää cdpathissa"
+
#, c-format
msgid "E825: Corrupted undo file (%s): %s"
msgstr "E825: Pilaanntunut kumoustiedosto (%s): %s"
-#: ../undo.c:1039
msgid "Cannot write undo file in any directory in 'undodir'"
-msgstr "Ei voitu lukea kumoustiedostoa mistn undodir-muuttujan hakemistosta"
+msgstr "Ei voitu lukea kumoustiedostoa mistään undodir-muuttujan hakemistosta"
-#: ../undo.c:1074
#, c-format
msgid "Will not overwrite with undo file, cannot read: %s"
msgstr "Ei ylikirjoitetat kumoustiedostolla, koska ei voida lukea: %s"
-#: ../undo.c:1092
#, c-format
msgid "Will not overwrite, this is not an undo file: %s"
-msgstr "Ei ylikirjoiteta, koska tm ei ole kumoustiedosto: %s"
+msgstr "Ei ylikirjoiteta, koska tämä ei ole kumoustiedosto: %s"
-#: ../undo.c:1108
msgid "Skipping undo file write, nothing to undo"
msgstr "Ohitetaan kumoustiedoston kirjoitus, koska ei ole peruutettavia"
-#: ../undo.c:1121
#, c-format
msgid "Writing undo file: %s"
msgstr "Kirjoitetaan kumoustiedostoa: %s"
-#: ../undo.c:1213
#, c-format
msgid "E829: write error in undo file: %s"
msgstr "E829: Kirjoitusvirhe kumoustiedostossa: %s"
-#: ../undo.c:1280
#, c-format
msgid "Not reading undo file, owner differs: %s"
msgstr "Ei lueta kumoustiedosto jonka omistaja on eri: %s"
-#: ../undo.c:1292
#, c-format
msgid "Reading undo file: %s"
msgstr "Luetaan kumoustiedostoa: %s"
-#: ../undo.c:1299
#, c-format
msgid "E822: Cannot open undo file for reading: %s"
msgstr "E822: Kumoustiedostoa ei voi avata lukemista varten: %s"
-#: ../undo.c:1308
#, c-format
msgid "E823: Not an undo file: %s"
msgstr "E823: Ei ole kumoustiedosto: %s"
-#: ../undo.c:1313
#, c-format
msgid "E824: Incompatible undo file: %s"
-msgstr "E824: Epyhteensopiva kumoustiedosto: %s"
+msgstr "E824: Epäyhteensopiva kumoustiedosto: %s"
-#: ../undo.c:1328
msgid "File contents changed, cannot use undo info"
msgstr ""
-"Tiedoston sislt on muuttunut, joen kumoustiedot ovat kyttkelvottomia"
+"Tiedoston sisältö on muuttunut, joen kumoustiedot ovat käyttökelvottomia"
-#: ../undo.c:1497
#, c-format
msgid "Finished reading undo file %s"
msgstr "Ladattu kumoustiedoto %s"
-#: ../undo.c:1586 ../undo.c:1812
msgid "Already at oldest change"
msgstr "Vanhimmassa muutoksessa"
-#: ../undo.c:1597 ../undo.c:1814
msgid "Already at newest change"
msgstr "Nuorimmassa muutoksessa"
-#: ../undo.c:1806
-#, c-format
-msgid "E830: Undo number %<PRId64> not found"
-msgstr "E830: Kumouslukua %<PRId64> ei lydy"
+#, fuzzy, c-format
+#~ msgid "E830: Undo number %<PRId64> not found"
+#~ msgstr "E830: Kumouslukua %ld ei löydy"
-#: ../undo.c:1979
msgid "E438: u_undo: line numbers wrong"
-msgstr "E438: u_undo: vrt rivinumerot"
+msgstr "E438: u_undo: väärät rivinumerot"
-#: ../undo.c:2183
msgid "more line"
-msgstr "rivi lis"
+msgstr "rivi lisää"
-#: ../undo.c:2185
msgid "more lines"
-msgstr "rivi lis"
+msgstr "riviä lisää"
-#: ../undo.c:2187
msgid "line less"
-msgstr "rivi vhemmn"
+msgstr "rivi vähemmän"
-#: ../undo.c:2189
msgid "fewer lines"
-msgstr "rivi vhemmn"
+msgstr "riviä vähemmän"
-#: ../undo.c:2193
msgid "change"
msgstr "muutos"
-#: ../undo.c:2195
msgid "changes"
msgstr "muutosta"
-# eka %s ylpuolelta, toka %s alapuolelta, kolmas %s aika
-#: ../undo.c:2225
-#, c-format
-msgid "%<PRId64> %s; %s #%<PRId64> %s"
-msgstr "%<PRId64> %s, %s #%<PRId64> %s"
+# eka %s yläpuolelta, toka %s alapuolelta, kolmas %s aika
+#, fuzzy, c-format
+#~ msgid "%<PRId64> %s; %s #%<PRId64> %s"
+#~ msgstr "%ld %s, %s #%ld %s"
+
+msgid "after"
+msgstr "jälkeen muutoksen"
-#: ../undo.c:2228
msgid "before"
msgstr "ennen muutosta"
-#: ../undo.c:2228
-msgid "after"
-msgstr "jlkeen muutoksen"
-
-#: ../undo.c:2325
msgid "Nothing to undo"
msgstr "Ei kumottavaa"
-#: ../undo.c:2330
-#, fuzzy
msgid "number changes when saved"
-msgstr "muutoksia aika tallennettu"
+msgstr "numero muutoksia aika tallennettu"
-#: ../undo.c:2360
-#, c-format
-msgid "%<PRId64> seconds ago"
-msgstr "%<PRId64> sekuntia sitten"
+#, fuzzy, c-format
+#~ msgid "%<PRId64> seconds ago"
+#~ msgstr "%ld sekuntia sitten"
-#: ../undo.c:2372
msgid "E790: undojoin is not allowed after undo"
-msgstr "E790: undojoin ei toimi undon jlkeen"
+msgstr "E790: undojoin ei toimi undon jälkeen"
-#: ../undo.c:2466
msgid "E439: undo list corrupt"
msgstr "E439: kumouslista rikki"
-#: ../undo.c:2495
msgid "E440: undo line missing"
msgstr "E440: kumousrivi puuttuu"
-#: ../version.c:600
-msgid ""
-"\n"
-"Included patches: "
-msgstr ""
-"\n"
-"Ptsit: "
-
-#: ../version.c:627
msgid ""
"\n"
"Extra patches: "
msgstr ""
"\n"
-"Muita ptsej: "
-
-#: ../version.c:639 ../version.c:864
-msgid "Modified by "
-msgstr "Muokannut "
+"Muita pätsejä: "
-#: ../version.c:646
msgid ""
"\n"
"Compiled "
msgstr ""
"\n"
-"Kntnyt "
+"Kääntänyt "
-#: ../version.c:649
msgid "by "
msgstr ": "
-#: ../version.c:660
+#, fuzzy
msgid ""
"\n"
-"Huge version "
-msgstr ""
"\n"
-"Huge-versio "
-
-#: ../version.c:661
-msgid "without GUI."
-msgstr "ilman GUIta."
-
-#: ../version.c:662
-msgid " Features included (+) or not (-):\n"
+"Optional features included (+) or not (-): "
msgstr " Ominaisuudet mukana (+) ja poissa (-):\n"
-#: ../version.c:667
msgid " system vimrc file: \""
-msgstr " jrjestelmn vimrc: \""
-
-#: ../version.c:672
-msgid " user vimrc file: \""
-msgstr " kyttjn vimrc: \""
-
-#: ../version.c:677
-msgid " 2nd user vimrc file: \""
-msgstr " 2. kyttjn vimrc: \""
+msgstr " järjestelmän vimrc: \""
-#: ../version.c:682
-msgid " 3rd user vimrc file: \""
-msgstr " 3. kyttjn vimrc: \""
-
-#: ../version.c:687
-msgid " user exrc file: \""
-msgstr " kyttjn exrc: \""
-
-#: ../version.c:692
-msgid " 2nd user exrc file: \""
-msgstr " 2. kyttjn exrc: \""
-
-#: ../version.c:699
msgid " fall-back for $VIM: \""
msgstr " $VIMin fallback: \""
-#: ../version.c:705
msgid " f-b for $VIMRUNTIME: \""
msgstr " $VIMRUNTIMEn f-b: \""
-#: ../version.c:709
-msgid "Compilation: "
-msgstr "Knns: "
-
-#: ../version.c:712
-msgid "Linking: "
-msgstr "Linkitys: "
-
-#: ../version.c:717
-msgid " DEBUG BUILD"
-msgstr " DEBUG-versio"
-
-#: ../version.c:767
-msgid "VIM - Vi IMproved"
-msgstr "VIM - Vi IMproved"
-
-#: ../version.c:769
-msgid "version "
-msgstr "versio "
-
-#: ../version.c:770
msgid "by Bram Moolenaar et al."
-msgstr "tekijt Bram Moolenaar et al."
+msgstr "tekijät Bram Moolenaar et al."
-#: ../version.c:774
-msgid "Vim is open source and freely distributable"
-msgstr "Vim on avointa lhdekoodia ja vapaasti jaossa"
+#, fuzzy
+#~ msgid "Nvim is open source and freely distributable"
+#~ msgstr "Vim on avointa lähdekoodia ja vapaasti jaossa"
-#: ../version.c:776
-msgid "Help poor children in Uganda!"
-msgstr "Auta Ugandan kyhi lapsia"
+#~ msgid "https://neovim.io/community"
+#~ msgstr ""
-#: ../version.c:777
-msgid "type :help iccf<Enter> for information "
-msgstr "kirjoita :help iccf<Enter> listietoa varten "
+#, fuzzy
+#~ msgid "type :help nvim<Enter> if you are new! "
+#~ msgstr "kirjoita :help iccf<Enter> lisätietoa varten "
+
+#, fuzzy
+#~ msgid "type :CheckHealth<Enter> to optimize Nvim"
+#~ msgstr "kirjoita :help iccf<Enter> lisätietoa varten "
-#: ../version.c:779
msgid "type :q<Enter> to exit "
msgstr "kirjoita :q<Enter> lopettaaksesi "
-#: ../version.c:780
-msgid "type :help<Enter> or <F1> for on-line help"
-msgstr "kirjoita :help<Enter> tai <F1> ohjetta varten "
-
-#: ../version.c:781
-msgid "type :help version7<Enter> for version info"
-msgstr "kirjoita :help version7<Enter> versiotietoja varten "
-
-#: ../version.c:784
-msgid "Running in Vi compatible mode"
-msgstr "Suoritetaan Vi-yhteensopivuustilaa"
+#, fuzzy
+#~ msgid "type :help<Enter> for help "
+#~ msgstr "kirjoita :q<Enter> lopettaaksesi "
-#: ../version.c:785
-msgid "type :set nocp<Enter> for Vim defaults"
-msgstr "kirjoita :set nocp<Enter> Vimin oletuksiin "
+msgid "Help poor children in Uganda!"
+msgstr "Auta Ugandan köyhiä lapsia"
-#: ../version.c:786
-msgid "type :help cp-default<Enter> for info on this"
-msgstr "kirjoita :help cp-default<Enter> ohjetta oletuksista varten"
+msgid "type :help iccf<Enter> for information "
+msgstr "kirjoita :help iccf<Enter> lisätietoa varten "
-#: ../version.c:827
msgid "Sponsor Vim development!"
-msgstr "Tue Vimin kehityst"
+msgstr "Tue Vimin kehitystä"
-#: ../version.c:828
msgid "Become a registered Vim user!"
-msgstr "Rekisteridy Vim-kyttjksi."
+msgstr "Rekisteröidy Vim-käyttäjäksi."
-#: ../version.c:831
msgid "type :help sponsor<Enter> for information "
-msgstr "kirjoita :help sponsor<Enter> listietoja varten"
+msgstr "kirjoita :help sponsor<Enter> lisätietoja varten"
-#: ../version.c:832
msgid "type :help register<Enter> for information "
-msgstr "kirjoita :help register<Enter> listietoja varten"
+msgstr "kirjoita :help register<Enter> lisätietoja varten"
-#: ../version.c:834
msgid "menu Help->Sponsor/Register for information "
-msgstr "valikko Ohje->Sponsoroi/Rekisteri listietoja varten"
+msgstr "valikko Ohje->Sponsoroi/Rekisteröi lisätietoja varten"
-#: ../window.c:119
msgid "Already only one window"
-msgstr "En yksi ikkuna jljell"
+msgstr "Enää yksi ikkuna jäljellä"
-#: ../window.c:224
msgid "E441: There is no preview window"
msgstr "E441: Ei esikatseluikkunaa"
-#: ../window.c:559
msgid "E442: Can't split topleft and botright at the same time"
-msgstr "E442: Ei voi jakaa vasenta ylnurkkaa ja oikeaa alanurkkaa yhtaikaa"
+msgstr "E442: Ei voi jakaa vasenta ylänurkkaa ja oikeaa alanurkkaa yhtäaikaa"
-#: ../window.c:1228
msgid "E443: Cannot rotate when another window is split"
-msgstr "E443: Ei voi kiert kun toinen ikkuna on jaettu"
+msgstr "E443: Ei voi kiertää kun toinen ikkuna on jaettu"
-#: ../window.c:1803
msgid "E444: Cannot close last window"
-msgstr "E444: Ei voi sulkea viimeist ikkunaa"
+msgstr "E444: Ei voi sulkea viimeistä ikkunaa"
-#: ../window.c:1810
msgid "E813: Cannot close autocmd window"
msgstr "E813: Ei voi sulkea autocmd-ikkunaa"
-#: ../window.c:1814
msgid "E814: Cannot close window, only autocmd window would remain"
-msgstr "E814: Ei voi sulkea viimeist ikkunaa, joka ei ole autocmd-ikkuna"
+msgstr "E814: Ei voi sulkea viimeistä ikkunaa, joka ei ole autocmd-ikkuna"
-#: ../window.c:2717
msgid "E445: Other window contains changes"
-msgstr "E445: Toinen ikkuna sislt muutoksia"
+msgstr "E445: Toinen ikkuna sisältää muutoksia"
-#: ../window.c:4805
msgid "E446: No file name under cursor"
-msgstr "E446: Ei tiedostonime kursorin alla"
+msgstr "E446: Ei tiedostonimeä kursorin alla"
-#~ msgid "E831: bf_key_init() called with empty password"
-#~ msgstr "E831: bf_key_init() tyhjll salasanalla"
+msgid "List or number required"
+msgstr "Lista tai luku tarvitaan"
-#~ msgid "E820: sizeof(uint32_t) != 4"
-#~ msgstr "E820: sizeof(uint32_t) != 4"
+#~ msgid ""
+#~ "Failed to set path: sys.path is not a list\n"
+#~ "You should now append vim.VIM_SPECIAL_PATH to sys.path"
+#~ msgstr ""
+#~ "Ei onnistuttu asettaman polkua: sys.path ei ole list\n"
+#~ "Lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path"
-#~ msgid "E817: Blowfish big/little endian use wrong"
-#~ msgstr "E817: Blowfishin tavujrjestys vr"
+#~ msgid ""
+#~ "Failed to set path hook: sys.path_hooks is not a list\n"
+#~ "You should now do the following:\n"
+#~ "- append vim.path_hook to sys.path_hooks\n"
+#~ "- append vim.VIM_SPECIAL_PATH to sys.path\n"
+#~ msgstr ""
+#~ "Ei voitu asettaa polkukoukkua: sys.path_hooks ei ole lista\n"
+#~ "Koeta seuraavaa:\n"
+#~ "- lisää vim.path_hook muuttujaan sys.path_hooks\n"
+#~ "- lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path\n"
-#~ msgid "E818: sha256 test failed"
-#~ msgstr "E818: sha256-testi eponnistui failed"
+#~ msgid "internal error: invalid value type"
+#~ msgstr "sisäinen virhe: huono arvotyyppi"
-#~ msgid "E819: Blowfish test failed"
-#~ msgstr "E819: Blowfish-testi eponnistui"
+#~ msgid "internal error: NULL reference passed"
+#~ msgstr "sisäinen virhe: NULL-viite annettu"
-#~ msgid "Patch file"
-#~ msgstr "Patch-tiedosto"
+#~ msgid "unable to convert %s to vim structure"
+#~ msgstr "ei voi konvertoida oliota %s vim-tietorakenteeksi"
-#~ msgid ""
-#~ "&OK\n"
-#~ "&Cancel"
-#~ msgstr ""
-#~ "&OK\n"
-#~ "&Peru"
+#~ msgid "unable to convert %s to vim dictionary"
+#~ msgstr "ei voitu konvertoida oliota %s vim-sanakirjaksi"
-#~ msgid "E240: No connection to Vim server"
-#~ msgstr "E240: Ei yhteytt vim-palvelimeen"
+#~ msgid "E859: Failed to convert returned python object to vim value"
+#~ msgstr "E859: Ei voitu konvertoida python-oliota vim-arvoksi"
-#~ msgid "E241: Unable to send to %s"
-#~ msgstr "E241: Kohteeseen %s lhettminen ei onnistunut"
+#~ msgid "E858: Eval did not return a valid python object"
+#~ msgstr "E858: Eval ei palauttanut python-oliota"
-#~ msgid "E277: Unable to read a server reply"
-#~ msgstr "E277: Palvelimen vastauksen lukeminen ei onnistunut"
+#~ msgid "failed to run the code"
+#~ msgstr "ei voitu suorittaa koodia"
-#~ msgid "E258: Unable to send to client"
-#~ msgstr "E258: Asiakkaalle lhetys ei onnistunut"
+#~ msgid "did not switch to the specified tab page"
+#~ msgstr "ei voitu vaihtaa annetulle välilehtisivulle"
-#~ msgid "Save As"
-#~ msgstr "Tallenna nimell"
+#~ msgid "expected vim.TabPage object, but got %s"
+#~ msgstr "odotettiin vim.TabPage-oliota, saatiin %s"
-#~ msgid "Source Vim script"
-#~ msgstr "Lataa vim-skripti"
+#~ msgid "did not switch to the specified window"
+#~ msgstr "ei vaihdettu annettuun ikkunaan"
-#~ msgid "Edit File"
-#~ msgstr "Muokkaa tiedostoa"
+#~ msgid "failed to find window in the current tab page"
+#~ msgstr "ei voitu löytää ikkunaa nykyiselle välilehtisivulle"
-#~ msgid " (NOT FOUND)"
-#~ msgstr " (EI LYTYNYT)"
+#~ msgid "expected vim.Window object, but got %s"
+#~ msgstr "odotettiin vim.Window-oliota, saatiin %s"
-#~ msgid "unknown"
-#~ msgstr "tuntematon"
+#~ msgid "expected vim.Buffer object, but got %s"
+#~ msgstr "odotettiin vim.Buffer-oliota, ei %s"
-#~ msgid "Edit File in new window"
-#~ msgstr "Muokkaa uudessa ikkunassa"
+#~ msgid "attempt to refer to deleted buffer"
+#~ msgstr "yritettiin viitata poistettuun puskuriin"
-#~ msgid "Append File"
-#~ msgstr "Lis tiedostoon"
+#~ msgid "no such window"
+#~ msgstr "ikkunaa ei ole"
-#~ msgid "Window position: X %d, Y %d"
-#~ msgstr "Ikkunan sijainti: X %d, Y %d"
+#~ msgid "readonly attribute: buffer"
+#~ msgstr "kirjoitussuojausattribuutti: puskuri"
-#~ msgid "Save Redirection"
-#~ msgstr "Tallenna uudelleenosoitus"
+#~ msgid "attempt to refer to deleted window"
+#~ msgstr "yritettiin viitata poistettuun ikkunaan"
-#~ msgid "Save View"
-#~ msgstr "Tallenna nkym"
+#~ msgid "no such tab page"
+#~ msgstr "välilehteä ei ole"
-#~ msgid "Save Session"
-#~ msgstr "Tallenna sessio"
+#~ msgid "attempt to refer to deleted tab page"
+#~ msgstr "yritettiin viitata poistettuun välilehteen"
-#~ msgid "Save Setup"
-#~ msgstr "Tallenna asetukset"
+#~ msgid "internal error: unknown option type"
+#~ msgstr "sisäinen virhe: tuntematon asetustyyppi"
-#~ msgid "E809: #< is not available without the +eval feature"
-#~ msgstr "E809: #< ei ole kytss jollei +eval ole pll"
+#~ msgid "unable to get option value"
+#~ msgstr "ei voitu hakea asetuksen arvoa"
-#~ msgid "E196: No digraphs in this version"
-#~ msgstr "E196: Digraafeja ei ole tss versiossa"
+#~ msgid "failed to run function %s"
+#~ msgstr "ei voitu suorittaa funktiota %s"
-#~ msgid "is a device (disabled with 'opendevice' option)"
-#~ msgstr "on laite (ei kytss opendevice-asetuksen takia)"
+#~ msgid "function %s does not exist"
+#~ msgstr "funktiota %s ei ole"
-#~ msgid "Reading from stdin..."
-#~ msgstr "Luetaan vakiosytteest"
+#~ msgid "unnamed function %s does not exist"
+#~ msgstr "nimetöntä funktiota %s ei ole"
-#~ msgid "[crypted]"
-#~ msgstr "[salattu]"
+#~ msgid "cannot modify fixed list"
+#~ msgstr "ei voida muokata kiinitettyä listaa"
-#~ msgid "E821: File is encrypted with unknown method"
-#~ msgstr "E821: Tiedoston salaus on tuntematon"
+#~ msgid "cannot delete vim.List attributes"
+#~ msgstr "ei voi poistaa vim.List-attribuutteja"
-#~ msgid "NetBeans disallows writes of unmodified buffers"
-#~ msgstr "NetBeans ei salli kirjoittaa muokkaamattomiin puskureihin"
+#~ msgid "failed to add item to list"
+#~ msgstr "ei voitu lisätä kohtaa listaan"
-#~ msgid "Partial writes disallowed for NetBeans buffers"
-#~ msgstr "Osittaiset kirjoitukset kielletty NetBeans-puskureissa"
+#~ msgid "attempt to assign sequence of size %d to extended slice of size %d"
+#~ msgstr ""
+#~ "yritettiin asettaa sekvenssiä jonka koko on %d sliceen jonka koko on %d"
-#~ msgid "writing to device disabled with 'opendevice' option"
-#~ msgstr "laitteeseen kirjoittaminen pois kytst opendevice-asetuksella"
+#~ msgid "internal error: failed to add item to list"
+#~ msgstr "sisäinen virhe: ei voitu lisätä kohtaa listaan"
-# tietkseni resurssiforkki on applen tiedostojrjestelmn tunnistejuttujuttu
-#~ msgid "E460: The resource fork would be lost (add ! to override)"
-#~ msgstr "E460: resurssiosa hviisi (lis komentoon ! ohittaaksesi)"
+#~ msgid "internal error: not enough list items"
+#~ msgstr "sisäinen virhe: ei tarpeeksi listan kohtia"
-#~ msgid "<cannot open> "
-#~ msgstr "<ei voi avata> "
-
-#~ msgid "E616: vim_SelFile: can't get font %s"
-#~ msgstr "E616: vim_SelFile: ei saada fonttia %s"
+#~ msgid "internal error: no vim list item %d"
+#~ msgstr "sisäinen virhe: ei vim-listan indeksiä %d"
-#~ msgid "E614: vim_SelFile: can't return to current directory"
-#~ msgstr "E614: vim_SelFile: nykyiseen hakemistoon ei voi palata"
+#~ msgid "attempt to assign sequence of size greater than %d to extended slice"
+#~ msgstr ""
+#~ "yritettiin sijoittaa sekvenssiä jonka koko on enemmän kuin %d sliceen"
-#~ msgid "Pathname:"
-#~ msgstr "Polku:"
+#~ msgid "slice step cannot be zero"
+#~ msgstr "slicen askel ei voi olla nolla"
-#~ msgid "E615: vim_SelFile: can't get current directory"
-#~ msgstr "E615: vim_SelFile: nykyist hakemistoa ei saada selville"
+#~ msgid "internal error: failed to get vim list item %d"
+#~ msgstr "sisäinen virhe: ei pystytty hakea vimin listan indeksiä %d"
-#~ msgid "OK"
-#~ msgstr "OK"
+#~ msgid "list index out of range"
+#~ msgstr "listaindeksi arvoalueen ulkopuolelta"
-#~ msgid "Cancel"
-#~ msgstr "Peru"
+#~ msgid "list constructor does not accept keyword arguments"
+#~ msgstr "listakonstruktori ei tue avainsanaparametrejä"
-#~ msgid "Vim dialog"
-#~ msgstr "Vim-ikkuna"
+#~ msgid "expected sequence element of size 2, but got sequence of size %d"
+#~ msgstr "sekvenssin elementin koon pitäisi olla 2, ei %d"
-#~ msgid "Scrollbar Widget: Could not get geometry of thumb pixmap."
-#~ msgstr "Vierityspalkki: Pixmapin geometria ei selvi"
+#~ msgid "hashtab changed during iteration"
+#~ msgstr "hashtab muuttui kesken iteraation"
-#~ msgid "E232: Cannot create BalloonEval with both message and callback"
-#~ msgstr "E232: Ei voi luoda BalloonEvalia viestille ja callbackille"
+#~ msgid "cannot set attribute %s"
+#~ msgstr "ei voi asettaa attribuuttia %s"
-#~ msgid "E229: Cannot start the GUI"
-#~ msgstr "E229: GUIn kynnistys ei onnistu"
+#~ msgid "cannot delete vim.Dictionary attributes"
+#~ msgstr "ei voi poistaa vim.Dictionary-attribuutteja"
-#~ msgid "E230: Cannot read from \"%s\""
-#~ msgstr "E230: Ei voi lukea kohteesta %s"
+#~ msgid "internal error: imp.find_module returned tuple with NULL"
+#~ msgstr ""
+#~ "sisäinen virhe: imp.find_module palautti tuplen joka sisältää nullin"
-#~ msgid "E665: Cannot start GUI, no valid font found"
-#~ msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei lydy"
+#~ msgid ""
+#~ "expected 3-tuple as imp.find_module() result, but got tuple of size %d"
+#~ msgstr ""
+#~ "odotettiin 3-tuple tuloksnea imp.find_module()-kutsulle, mutta tuplen "
+#~ "koko onkin %d"
-#~ msgid "E231: 'guifontwide' invalid"
-#~ msgstr "E231: guifontwide virheellinen"
+#~ msgid "expected 3-tuple as imp.find_module() result, but got %s"
+#~ msgstr "odotettiin 3-tuplea tuloksena imp.find_module()-kutsulle, ei %s"
-#~ msgid "E599: Value of 'imactivatekey' is invalid"
-#~ msgstr "E599: imactivatekeyn arvo on virheellinen"
+#~ msgid "E264: Python: Error initialising I/O objects"
+#~ msgstr "E264: Python: Virhe IO-olioiden alustuksessa"
-#~ msgid "E254: Cannot allocate color %s"
-#~ msgstr "E254: Vri %s ei voi mritell"
+#~ msgid "invalid attribute: %s"
+#~ msgstr "virheellinen attribuutti: %s"
-#~ msgid "No match at cursor, finding next"
-#~ msgstr "Ei tsmyst kursorin alla, etsitn seuraava"
+#~ msgid "can't delete OutputObject attributes"
+#~ msgstr "ei voi poistaa OutputObject-attribuutteja"
-#~ msgid "Input _Methods"
-#~ msgstr "Syte_menetelmt"
+#~ msgid "number must be greater or equal to zero"
+#~ msgstr "luvun on oltava yhtä suuri tai suurempi kuin nolla"
-#~ msgid "VIM - Search and Replace..."
-#~ msgstr "VIM - Etsi ja korvaa..."
+#~ msgid "value is too small to fit into C int type"
+#~ msgstr "arvo on liian pieni mahtumaan C:n int-tyyppiin"
-#~ msgid "VIM - Search..."
-#~ msgstr "VIM - Etsi..."
+#~ msgid "expected int() or something supporting coercing to int(), but got %s"
+#~ msgstr ""
+#~ "odotettiin tyyppiä int() tai jotain joka muuntuu tyyppiin int(), ei %s"
-#~ msgid "Find what:"
-#~ msgstr "Etsi:"
+#~ msgid ""
+#~ "expected int(), long() or something supporting coercing to long(), but "
+#~ "got %s"
+#~ msgstr ""
+#~ "odotettiin instanssia tyypeistä int(), long() tai mitä tahansa joka "
+#~ "muuntuisi tyyppiin long(), ei %s"
-#~ msgid "Replace with:"
-#~ msgstr "Korvaa:"
+#~ msgid "expected bytes() or str() instance, but got %s"
+#~ msgstr "odotettiin instanssia tyypeistä bytes() tai str(), ei %s"
-#~ msgid "Match whole word only"
-#~ msgstr "Korvaa kokonaisia sanoja"
+#~ msgid "expected str() or unicode() instance, but got %s"
+#~ msgstr "odottettiin insanssia tyypeistä str() tai unicode(), ei %s"
-#~ msgid "Match case"
-#~ msgstr "Kirjaintaso"
+#~ msgid "index must be int or slice, not %s"
+#~ msgstr "indeksin pitää olla int tai slice, ei %s"
-#~ msgid "Direction"
-#~ msgstr "Suunta"
+#~ msgid "failed to add key '%s' to dictionary"
+#~ msgstr "avaimen %s lisääminen sanakirjaan ei onnistu"
-#~ msgid "Up"
-#~ msgstr "Yls"
+#~ msgid "list is locked"
+#~ msgstr "luettelo on lukittu"
-#~ msgid "Down"
-#~ msgstr "Alas"
+#~ msgid "Need encryption key for \"%s\""
+#~ msgstr "Tarvitaan salausavain kohteelle %s "
-#~ msgid "Find Next"
-#~ msgstr "Etsi seuraava"
+#~ msgid "E744: NetBeans does not allow changes in read-only files"
+#~ msgstr "E744: NetBeans ei tue muutoksia kirjoitussuojattuihin tiedostoihin"
-#~ msgid "Replace"
-#~ msgstr "Korvaa"
+#~ msgid "E463: Region is guarded, cannot modify"
+#~ msgstr "E463: Alue on suojattu, muuttaminen ei onnistu"
-#~ msgid "Replace All"
-#~ msgstr "Korvaa kaikki"
+#~ msgid "E449: Invalid expression received"
+#~ msgstr "E449: Virheellinen ilmaus saatu"
-#~ msgid "Vim: Received \"die\" request from session manager\n"
-#~ msgstr "Vim: sessiomanageri lhetti die-pyynnn\n"
+#~ msgid "E233: cannot open display"
+#~ msgstr "E233: näyttöä ei voi avata"
-#~ msgid "Close"
-#~ msgstr "Sulje"
+#~ msgid "E247: no registered server named \"%s\""
+#~ msgstr "E247: palvelinta %s ei ole rekisteröitynä"
-#~ msgid "New tab"
-#~ msgstr "Uusi vlilehti"
+#~ msgid "E800: Arabic cannot be used: Not enabled at compile time\n"
+#~ msgstr "E800: Arabiaa ei voi käyttää, koska sitä ei käännetty mukaan\n"
-#~ msgid "Open Tab..."
-#~ msgstr "Avaa vlilehti..."
+#~ msgid "E27: Farsi cannot be used: Not enabled at compile time\n"
+#~ msgstr "E27: Farsia ei voi käyttää, koska sitä ei käännetty mukaan\n"
-#~ msgid "Vim: Main window unexpectedly destroyed\n"
-#~ msgstr "Vim: Pikkuna tuhoutui odottamatta\n"
+#~ msgid "E26: Hebrew cannot be used: Not enabled at compile time\n"
+#~ msgstr "E26: Hepreaa ei voi käyttää, koska sitä ei käännetty mukaan\n"
-#~ msgid "&Filter"
-#~ msgstr "&Suodata"
+#~ msgid "E25: GUI cannot be used: Not enabled at compile time"
+#~ msgstr "E25: GUIta ei voi käyttää, koska sitä ei käännetty mukaan"
-#~ msgid "&Cancel"
-#~ msgstr "&Peru"
+#~ msgid "E448: Could not load library function %s"
+#~ msgstr "E448: Ei voitu ladta kirjastofunktiota %s"
-#~ msgid "Directories"
-#~ msgstr "Hakemistot"
+#~ msgid "E236: Font \"%s\" is not fixed-width"
+#~ msgstr "E236: Fontti %s ei ole tasavälinen"
-#~ msgid "Filter"
-#~ msgstr "Suodatus"
+#~ msgid "E234: Unknown fontset: %s"
+#~ msgstr "E234: Tuntematon fontset: %s"
-#~ msgid "&Help"
-#~ msgstr "O&hje"
+#~ msgid "gvimext.dll error"
+#~ msgstr "gvimext.dll-virhe"
-#~ msgid "Files"
-#~ msgstr "Tiedostot"
+#~ msgid "Error creating process: Check if gvim is in your path!"
+#~ msgstr "Virhe prosessin käynnistämisessä, varmista että gvim on polulla"
-#~ msgid "&OK"
-#~ msgstr "&Ok"
+#~ msgid "Edits the selected file(s) with Vim"
+#~ msgstr "Muokkaa valittuja tiedostoja Vimillä"
-#~ msgid "Selection"
-#~ msgstr "Valinta"
+#~ msgid "Edit with existing Vim - "
+#~ msgstr "Muokkaa olemassaolevalla Vimillä - "
-#~ msgid "Find &Next"
-#~ msgstr "Hae &seuraava"
+#~ msgid "Edit with &Vim"
+#~ msgstr "Muokkaa &Vimillä"
-#~ msgid "&Replace"
-#~ msgstr "Ko&rvaa"
+#~ msgid "Diff with Vim"
+#~ msgstr "Diffi Vimillä"
-#~ msgid "Replace &All"
-#~ msgstr "Korvaa k&aikki"
+#~ msgid "Edit with single &Vim"
+#~ msgstr "Muokkaa yhdellä &Vimillä"
-#~ msgid "&Undo"
-#~ msgstr "&Kumoa"
+#~ msgid "Edit with &multiple Vims"
+#~ msgstr "&Muokkaa usealla Vimillä"
-#~ msgid "E671: Cannot find window title \"%s\""
-#~ msgstr "E671: Ikkunan otsikkoa ei lydy %s"
+#~ msgid "E299: Perl evaluation forbidden in sandbox without the Safe module"
+#~ msgstr "E299: Perl-suoritus kielletty hiekkalaatikossa ilman Safe-moduulia"
-# OLE on object linking and embedding p windowska
-#~ msgid "E243: Argument not supported: \"-%s\"; Use the OLE version."
-#~ msgstr "E243: Argumenttia ei tueta: -%s, kyt OLE-versiota"
+#~ msgid ""
+#~ "Sorry, this command is disabled: the Perl library could not be loaded."
+#~ msgstr "komento ei toimi, Perl kirjastoa ei voinut ladata."
-# MDI eli windowsin moni-ikkunasovellus
-#~ msgid "E672: Unable to open window inside MDI application"
-#~ msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen"
+#~ msgid "E370: Could not load library %s"
+#~ msgstr "E370: Kirjaston %s lataaminen ei onnistu"
-#~ msgid "Close tab"
-#~ msgstr "Sulje vlilehti"
+#~ msgid "type :help windows95<Enter> for info on this"
+#~ msgstr "kirjoita :help windows95<Enter> lisätietoja varten"
-#~ msgid "Open tab..."
-#~ msgstr "Avaa vlilehti..."
+#~ msgid "WARNING: Windows 95/98/ME detected"
+#~ msgstr "VAROITUS: Window 95/98/ME havaittu"
-#~ msgid "Find string (use '\\\\' to find a '\\')"
-#~ msgstr "Etsi merkkijonoa (\\\\:ll lyt \\:t)"
+#~ msgid " for Vim defaults "
+#~ msgstr " Vim-oletuksia varten"
-#~ msgid "Find & Replace (use '\\\\' to find a '\\')"
-#~ msgstr "Etsi ja korvaa (\\\\:ll lyt \\:t)"
+#~ msgid "menu Edit->Global Settings->Toggle Vi Compatible"
+#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda Vi-yhteensopivuutta"
-#~ msgid "Not Used"
-#~ msgstr "Ei kytss"
+#~ msgid "menu Edit->Global Settings->Toggle Insert Mode "
+#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda syötetilaa"
-#~ msgid "Directory\t*.nothing\n"
-#~ msgstr "Hakemisto\t*.nothing\n"
+#~ msgid "Running modeless, typed text is inserted"
+#~ msgstr "Suoritetaan tilattomana, kirjoitettu teksti syötetään"
-#~ msgid ""
-#~ "Vim E458: Cannot allocate colormap entry, some colors may be incorrect"
-#~ msgstr ""
-#~ "Vim E458: Ei voi varata vrikartan alkiota, vrit voivat menn vrin"
+#~ msgid "menu Help->Orphans for information "
+#~ msgstr "valikko Ohje->Orvot lisätietoja varten "
-#~ msgid "E250: Fonts for the following charsets are missing in fontset %s:"
-#~ msgstr "E250: Seuraavien merkistjoukkojen fontit puuttuvat fontsetist %s:"
+#~ msgid "type :help cp-default<Enter> for info on this"
+#~ msgstr "kirjoita :help cp-default<Enter> ohjetta oletuksista varten"
-#~ msgid "E252: Fontset name: %s"
-#~ msgstr "E252: Fontsetin nimi: %s"
+#~ msgid "type :set nocp<Enter> for Vim defaults"
+#~ msgstr "kirjoita :set nocp<Enter> Vimin oletuksiin "
-#~ msgid "Font '%s' is not fixed-width"
-#~ msgstr "Fontti %s ei ole tasavlinen"
+#~ msgid "Running in Vi compatible mode"
+#~ msgstr "Suoritetaan Vi-yhteensopivuustilaa"
-#~ msgid "E253: Fontset name: %s\n"
-#~ msgstr "E253: Fontsetin nimi: %s\n"
+#~ msgid "type :help version8<Enter> for version info"
+#~ msgstr "kirjoita :help version8<Enter> versiotietoja varten "
-#~ msgid "Font0: %s\n"
-#~ msgstr "Fontti0: %s\n"
+#~ msgid "type :help<Enter> or <F1> for on-line help"
+#~ msgstr "kirjoita :help<Enter> tai <F1> ohjetta varten "
-#~ msgid "Font1: %s\n"
-#~ msgstr "Fontti1: %s\n"
+#~ msgid "version "
+#~ msgstr "versio "
-#~ msgid "Font%<PRId64> width is not twice that of font0\n"
-#~ msgstr "Fontti%<PRId64>:n leveys ei ole kaksi kertaa fontti0:n\n"
+#~ msgid "VIM - Vi IMproved"
+#~ msgstr "VIM - Vi IMproved"
-#~ msgid "Font0 width: %<PRId64>\n"
-#~ msgstr "Fontti0:n leveys: %<PRId64>\n"
+#~ msgid " DEBUG BUILD"
+#~ msgstr " DEBUG-versio"
-#~ msgid ""
-#~ "Font1 width: %<PRId64>\n"
-#~ "\n"
-#~ msgstr ""
-#~ "Fontti1:n leveys: %<PRId64>\n"
-#~ "\n"
+#~ msgid "Linking: "
+#~ msgstr "Linkitys: "
-#~ msgid "Invalid font specification"
-#~ msgstr "Virheellinen fonttimritys"
+#~ msgid "Compiler: "
+#~ msgstr "Käännin: "
-#~ msgid "&Dismiss"
-#~ msgstr "&Ohita"
+#~ msgid "Compilation: "
+#~ msgstr "Käännös: "
-#~ msgid "no specific match"
-#~ msgstr "ei tarkkaa tsmyst"
+#~ msgid " system menu file: \""
+#~ msgstr " järjestelmävalikko: \""
-#~ msgid "Vim - Font Selector"
-#~ msgstr "Vim - fonttivalitsin"
+#~ msgid " defaults file: \""
+#~ msgstr " defaults-tiedosto: \""
-#~ msgid "Name:"
-#~ msgstr "Nimi:"
+#~ msgid "3rd user gvimrc file: \""
+#~ msgstr "3. käyttäjän gvimrc: \""
-#~ msgid "Show size in Points"
-#~ msgstr "Nyt koko pistein"
+#~ msgid "2nd user gvimrc file: \""
+#~ msgstr "2. käyttäjän gvimrc: \""
-#~ msgid "Encoding:"
-#~ msgstr "Koodaus:"
+#~ msgid " user gvimrc file: \""
+#~ msgstr " käyttäjän gvimrc: \""
-#~ msgid "Font:"
-#~ msgstr "Fontti:"
+#~ msgid " system gvimrc file: \""
+#~ msgstr " järjestelmän gvimrc: \""
-#~ msgid "Style:"
-#~ msgstr "Tyyli:"
+#~ msgid " 2nd user exrc file: \""
+#~ msgstr " 2. käyttäjän exrc: \""
-#~ msgid "Size:"
-#~ msgstr "Koko:"
+#~ msgid " user exrc file: \""
+#~ msgstr " käyttäjän exrc: \""
-#~ msgid "E256: Hangul automata ERROR"
-#~ msgstr "E256: Hangu-automaattivirhe"
+#~ msgid " 3rd user vimrc file: \""
+#~ msgstr " 3. käyttäjän vimrc: \""
-#~ msgid "E563: stat error"
-#~ msgstr "E563: stat-virhe"
+#~ msgid " 2nd user vimrc file: \""
+#~ msgstr " 2. käyttäjän vimrc: \""
-#~ msgid "E625: cannot open cscope database: %s"
-#~ msgstr "E625: ei voi avata cscope-tietokantaa: %s"
+#~ msgid " user vimrc file: \""
+#~ msgstr " käyttäjän vimrc: \""
-#~ msgid "E626: cannot get cscope database information"
-#~ msgstr "E626: ei voi hakea cscope-tietokannan tietoja"
+#~ msgid "with (classic) GUI."
+#~ msgstr "perinteisellä GUIlla."
-#~ msgid "Lua library cannot be loaded."
-#~ msgstr "Luan kirjastoa ei voitu ladata."
+#~ msgid "with Cocoa GUI."
+#~ msgstr "Cocoa-GUIlla."
-#~ msgid "cannot save undo information"
-#~ msgstr "ei voitu tallentaa kumoustietoja"
+#~ msgid "with Carbon GUI."
+#~ msgstr "Carbon-GUIlla."
-#~ msgid ""
-#~ "E815: Sorry, this command is disabled, the MzScheme libraries could not "
-#~ "be loaded."
-#~ msgstr "E815: Sori, komento ei toimi, MzScheme-kirjastoa ei voitu ladata."
+#~ msgid "with GUI."
+#~ msgstr "GUIlla."
-#~ msgid "invalid expression"
-#~ msgstr "virheellinen ilmaus"
+#~ msgid "with Photon GUI."
+#~ msgstr "Photon-GUIlla."
-#~ msgid "expressions disabled at compile time"
-#~ msgstr "ilmaukset poistettu kytst knnsaikana"
+#~ msgid "with X11-Athena GUI."
+#~ msgstr "X11-Athena-GUIlla."
-#~ msgid "hidden option"
-#~ msgstr "piilotettu asetus"
+#~ msgid "with X11-neXtaw GUI."
+#~ msgstr "X11-neXtaw-GUIlla."
-#~ msgid "unknown option"
-#~ msgstr "tuntematon asetus"
+#~ msgid "with X11-Motif GUI."
+#~ msgstr "X11-Motif-GUIlla."
-#~ msgid "window index is out of range"
-#~ msgstr "ikkunan indeksi alueen ulkopuolella"
+#~ msgid "with GTK2 GUI."
+#~ msgstr "GTK2-GUIlla."
-#~ msgid "couldn't open buffer"
-#~ msgstr "ei voitu avata puskuria"
+#~ msgid "with GTK2-GNOME GUI."
+#~ msgstr "GTK2-Gnome-GUIlla."
-#~ msgid "cannot delete line"
-#~ msgstr "ei voitu poistaa rivi"
+#~ msgid "with GTK3 GUI."
+#~ msgstr "GTK3-GUIlla."
-#~ msgid "cannot replace line"
-#~ msgstr "ei voitu korvata rivi"
+#~ msgid "without GUI."
+#~ msgstr "ilman GUIta."
-#~ msgid "cannot insert line"
-#~ msgstr "ei voitu list rivi"
+#~ msgid ""
+#~ "\n"
+#~ "Tiny version "
+#~ msgstr ""
+#~ "\n"
+#~ "Tiny-versio "
-#~ msgid "string cannot contain newlines"
-#~ msgstr "merkkijono ei saa sislt rivinvaihtoja"
+#~ msgid ""
+#~ "\n"
+#~ "Small version "
+#~ msgstr ""
+#~ "\n"
+#~ "Small-versio "
-#~ msgid "Vim error: ~a"
-#~ msgstr "Vim-virhe: ~a"
+#~ msgid ""
+#~ "\n"
+#~ "Normal version "
+#~ msgstr ""
+#~ "\n"
+#~ "Normal-versio "
-#~ msgid "Vim error"
-#~ msgstr "Vim-virhe"
+#~ msgid ""
+#~ "\n"
+#~ "Big version "
+#~ msgstr ""
+#~ "\n"
+#~ "Big-version "
-#~ msgid "buffer is invalid"
-#~ msgstr "puskuri on virheellinen"
+#~ msgid ""
+#~ "\n"
+#~ "Huge version "
+#~ msgstr ""
+#~ "\n"
+#~ "Huge-versio "
-#~ msgid "window is invalid"
-#~ msgstr "ikkuna on virheellinen"
+#~ msgid "Modified by "
+#~ msgstr "Muokannut "
-#~ msgid "linenr out of range"
-#~ msgstr "rivinumero arvoalueen ulkopuolelta"
+#~ msgid ""
+#~ "\n"
+#~ "Included patches: "
+#~ msgstr ""
+#~ "\n"
+#~ "Pätsit: "
-#~ msgid "not allowed in the Vim sandbox"
-#~ msgstr "ei sallittu Vimin hiekkalaatikossa"
+#~ msgid ""
+#~ "\n"
+#~ "OpenVMS version"
+#~ msgstr ""
+#~ "\n"
+#~ "OpenVMS-version"
-#~ msgid "E836: This Vim cannot execute :python after using :py3"
+#~ msgid ""
+#~ "\n"
+#~ "MacOS version"
#~ msgstr ""
-#~ "E836: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa"
+#~ "\n"
+#~ "MacOS-version"
-#~ msgid "E837: This Vim cannot execute :py3 after using :python"
+#~ msgid ""
+#~ "\n"
+#~ "MacOS X version"
#~ msgstr ""
-#~ "E837: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa"
+#~ "\n"
+#~ "MacOS X-version"
#~ msgid ""
-#~ "E263: Sorry, this command is disabled, the Python library could not be "
-#~ "loaded."
+#~ "\n"
+#~ "MacOS X (unix) version"
#~ msgstr ""
-#~ "E263: Sori, komento ei toimi, Python-kirjaston lataaminen ei onnistunut."
+#~ "\n"
+#~ "MacOS X-version (unix)"
-#~ msgid "can't delete OutputObject attributes"
-#~ msgstr "ei voi poistaa OutputObject-attribuutteja"
+#~ msgid ""
+#~ "\n"
+#~ "MS-Windows 32-bit console version"
+#~ msgstr ""
+#~ "\n"
+#~ "MS-Windows 32-bittinen konsoliversio"
-#~ msgid "softspace must be an integer"
-#~ msgstr "softspacen pit olla kokonaisluku"
+#~ msgid ""
+#~ "\n"
+#~ "MS-Windows 64-bit console version"
+#~ msgstr ""
+#~ "\n"
+#~ "MS-Windows 32-bittinen konsoliversio"
-#~ msgid "invalid attribute"
-#~ msgstr "virheellinen attribuutti"
+#~ msgid " with OLE support"
+#~ msgstr " OLE-tuella"
-#~ msgid "<buffer object (deleted) at %p>"
-#~ msgstr "<puskuriolio (poistettu) kohdassa %p>"
+#~ msgid " in Win32s mode"
+#~ msgstr " Win32s-tilassa"
-#~ msgid "E659: Cannot invoke Python recursively"
-#~ msgstr "E659: Pythonia ei voi kutsua rekursiivisesti"
+#~ msgid ""
+#~ "\n"
+#~ "MS-Windows 32-bit GUI version"
+#~ msgstr ""
+#~ "\n"
+#~ "MS-Windows 32-bittinen GUI-version"
-#~ msgid "E265: $_ must be an instance of String"
-#~ msgstr "E265: muuttujan $_ pit olla Stringin instanssi"
+#~ msgid ""
+#~ "\n"
+#~ "MS-Windows 64-bit GUI version"
+#~ msgstr ""
+#~ "\n"
+#~ "MS-Windows 64-bittinen GUI-versio"
#~ msgid ""
-#~ "E266: Sorry, this command is disabled, the Ruby library could not be "
-#~ "loaded."
-#~ msgstr "E266: Sori, komento ei toimi, Ruby-kirjastoa ei voitu ladata."
+#~ "\n"
+#~ "MS-Windows 16/32-bit GUI version"
+#~ msgstr ""
+#~ "\n"
+#~ "MS-Windows 16- t. 32-bittinen GUI-versio"
-#~ msgid "E267: unexpected return"
-#~ msgstr "E267: odotuksenvastainen return"
+#~ msgid "E827: Undo file is encrypted: %s"
+#~ msgstr "E827: Kumoustiedosto on salattu: %s"
-#~ msgid "E268: unexpected next"
-#~ msgstr "E268: Odotuksenvastainen next"
+#~ msgid "E826: Undo file decryption failed: %s"
+#~ msgstr "E826: Kumoustiedoston purku epäonnistui: %s"
-#~ msgid "E269: unexpected break"
-#~ msgstr "E269: Odotuksenvastainen break"
+#~ msgid "E832: Non-encrypted file has encrypted undo file: %s"
+#~ msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s"
-#~ msgid "E270: unexpected redo"
-#~ msgstr "E270: odotuksenvastainen redo"
+#~ msgid "No undo possible; continue anyway"
+#~ msgstr "Ei voi kumota, jatketaan silti"
-#~ msgid "E271: retry outside of rescue clause"
-#~ msgstr "E271: retry rescuen ulkopuolella"
+#~ msgid "Used CUT_BUFFER0 instead of empty selection"
+#~ msgstr "Käytettiin CUT_BUFFER0:aa tyhjän valinnan sijaan"
-#~ msgid "E272: unhandled exception"
-#~ msgstr "E272: ksittelemtn poikkeus"
+#~ msgid "new shell started\n"
+#~ msgstr "uusi kuori avattu\n"
-#~ msgid "E273: unknown longjmp status %d"
-#~ msgstr "E273: tuntematon longjmp-tila %d"
+#~ msgid "Cannot open $VIMRUNTIME/rgb.txt"
+#~ msgstr "Ei voida avata tiedostoa $VIMRUNTIME/rgb.txt"
-#~ msgid "Toggle implementation/definition"
-#~ msgstr "Vaihda toteutuksen ja mritelmn vlill"
+#~ msgid ""
+#~ "\n"
+#~ "--- Terminal keys ---"
+#~ msgstr ""
+#~ "\n"
+#~ "--- Terminaalinäppäimet ---"
-#~ msgid "Show base class of"
-#~ msgstr "Nyt kantaluokka kohteelle"
+#~ msgid "E437: terminal capability \"cm\" required"
+#~ msgstr "E437: terminaalilla pitää olla cm kyvyissään"
-#~ msgid "Show overridden member function"
-#~ msgstr "Nyt korvattu jsenfunktio"
+#~ msgid "E436: No \"%s\" entry in termcap"
+#~ msgstr "E436: %s ei löytynyt termcapista"
-#~ msgid "Retrieve from file"
-#~ msgstr "Jljit tiedostosta"
+#~ msgid "E559: Terminal entry not found in termcap"
+#~ msgstr "E559: Terminaalia ei löytynyt termcapista"
-#~ msgid "Retrieve from project"
-#~ msgstr "Jljit projektista"
+#~ msgid "E558: Terminal entry not found in terminfo"
+#~ msgstr "E558: Terminaalia ei löytynyt terminfosta"
-#~ msgid "Retrieve from all projects"
-#~ msgstr "Jljit kaikista projekteista"
+#~ msgid "E557: Cannot open termcap file"
+#~ msgstr "E557: Ei voi avata termcap-tiedostoa"
-#~ msgid "Retrieve"
-#~ msgstr "Jljit"
+#~ msgid "defaulting to '"
+#~ msgstr "oletusarvona "
-#~ msgid "Show source of"
-#~ msgstr "Nyt lhdekoodi kohteelle"
+#~ msgid "' not known. Available builtin terminals are:"
+#~ msgstr " ei tunnettu. Tuetut terminaalit:"
-#~ msgid "Find symbol"
-#~ msgstr "Etsi symboli"
+#~ msgid "E430: Tag file path truncated for %s\n"
+#~ msgstr "E430: Tägitiedoston polku katkaistu kohdassa %s\n"
-#~ msgid "Browse class"
-#~ msgstr "Selaa luokkaa"
+#~ msgid "E422: terminal code too long: %s"
+#~ msgstr "E422: terminaalikoodi liian pitkä: %s"
-#~ msgid "Show class in hierarchy"
-#~ msgstr "Nyt luokka hierarkiassa"
+#~ msgid "E845: Insufficient memory, word list will be incomplete"
+#~ msgstr "E845: Muisti ei riitä, sanalista jää keskeneräiseksi"
+
+#~ msgid "Conversion in %s not supported"
+#~ msgstr "Muutosta kohteessa %s ei tueta"
-#~ msgid "Show class in restricted hierarchy"
-#~ msgstr "Nyt luokka rajoitetussa hierarkiassa"
+#~ msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\""
+#~ msgstr "Varoitus: Ei löydetty sanalistaa %s_%s.spl tai %s_ascii.spl"
-#~ msgid "Xref refers to"
-#~ msgstr "Xref viittaa kohteeseen"
+#~ msgid ""
+#~ "\n"
+#~ "# Last %sSearch Pattern:\n"
+#~ "~"
+#~ msgstr ""
+#~ "\n"
+#~ "# Edellinen %sHakulauseke:\n"
+#~ "~"
-#~ msgid "Xref referred by"
-#~ msgstr "Xref viitattu kohteesta"
+#~ msgid "Substitute "
+#~ msgstr "Korvaa "
-#~ msgid "Xref has a"
-#~ msgstr "Xref sislt kohteen"
+#~ msgid "(NFA) COULD NOT OPEN %s !"
+#~ msgstr "(NFA) EI VOI AVATA KOHDETTA %s"
-#~ msgid "Xref used by"
-#~ msgstr "Xrefi kytt"
+#~ msgid ""
+#~ "Could not open temporary log file for writing, displaying on stderr ... "
+#~ msgstr ""
+#~ "Ei voitu avata väliaikaislokitiedosta kirjoittamista varten, joten "
+#~ "virheet näytetään vakiovirhevirrassa. "
-#~ msgid "Show docu of"
-#~ msgstr "Nyt dokumentti kohteelle"
+#~ msgid "E878: (NFA) Could not allocate memory for branch traversal!"
+#~ msgstr "E878: (NFA) Ei voitu allokoida muistia polkujen läpikäyntiin"
-#~ msgid "Generate docu for"
-#~ msgstr "Luo dokumentti kohteelle"
+#~ msgid "E876: (NFA regexp) Not enough space to store the whole NFA "
+#~ msgstr "E876: (NFA regexp) Tila ei riitä NFA:n tallentamiseen"
#~ msgid ""
-#~ "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in "
-#~ "$PATH).\n"
+#~ "E875: (NFA regexp) (While converting from postfix to NFA), too many "
+#~ "states left on stack"
#~ msgstr ""
-#~ "Ei voida yhdist SNiFF+:aan. Tarkista ympristmuuttujat (sniffemacsin "
-#~ "lyty polkumuuttujasta $PATH).\n"
+#~ "E875: (NFA regexp) (Muunnettaessa postfixistä NFA:ksi), liikaa tiloja "
+#~ "jäljellä pinossa"
-#~ msgid "E274: Sniff: Error during read. Disconnected"
-#~ msgstr "E274: Sniff: Virhe luettaessa, yhteys katkaistu"
+#~ msgid "E874: (NFA) Could not pop the stack !"
+#~ msgstr "E874: (NFA) Ei voida poistaa pinosta"
-#~ msgid "SNiFF+ is currently "
-#~ msgstr "SNiFF+ "
+#~ msgid "E873: (NFA regexp) proper termination error"
+#~ msgstr "E873: (NFA regexp) oikea lopetusvirhe"
-#~ msgid "not "
-#~ msgstr "ei ole "
+#~ msgid "E879: (NFA regexp) Too many \\z("
+#~ msgstr "E879: (NFA regexp) Liikaa merkkejä \\z("
-#~ msgid "connected"
-#~ msgstr "yhdistetty"
+#~ msgid "E872: (NFA regexp) Too many '('"
+#~ msgstr "E872: (NFA regexp) Liian monta suljetta '('"
-#~ msgid "E275: Unknown SNiFF+ request: %s"
-#~ msgstr "E275: Tuntematon SNiFF+-pyynt: %s"
+#~ msgid "E871: (NFA regexp) Can't have a multi follow a multi !"
+#~ msgstr "E871: (NFA regexp) Multi ei voi seurata multia"
-#~ msgid "E276: Error connecting to SNiFF+"
-#~ msgstr "E276: Virhe yhdistettess SNiFF+:aan"
+#~ msgid "E870: (NFA regexp) Error reading repetition limits"
+#~ msgstr "E870: (NFA regexp) Virhe luettaessa toiston määriä"
-#~ msgid "E278: SNiFF+ not connected"
-#~ msgstr "E278: SNiFF+ ei ole yhdistetty"
+#~ msgid "E869: (NFA) Unknown operator '\\@%c'"
+#~ msgstr "E869: (NFA) Tuntematon operaattori '\\@%c'"
-#~ msgid "E279: Not a SNiFF+ buffer"
-#~ msgstr "E279: Ei ole SNiFF+-puskuri"
+#~ msgid "E868: Error building NFA with equivalence class!"
+#~ msgstr "E868: Virhe NFA:n ekvivalenssiluokkia tekemisessä"
-#~ msgid "Sniff: Error during write. Disconnected"
-#~ msgstr "Sniff: Virhe kirjoituksessa, yhteys katkaistu"
+#~ msgid "E867: (NFA) Unknown operator '\\%%%c'"
+#~ msgstr "E867: (NFA) Tuntematon operaattori '\\%%%c'"
-#~ msgid "invalid buffer number"
-#~ msgstr "virheellinen puskurinumero"
+#~ msgid "E867: (NFA) Unknown operator '\\z%c'"
+#~ msgstr "E867: (NFA) Tuntematon operaattori '\\z%c'"
-#~ msgid "not implemented yet"
-#~ msgstr "ei toteutettu"
+#~ msgid "E877: (NFA regexp) Invalid character class: %ld"
+#~ msgstr "E877: (NFA regexp) Virheellinen merkkiluokka: %ld"
-#~ msgid "cannot set line(s)"
-#~ msgstr "ei voi asettaa rivej"
+#~ msgid "E866: (NFA regexp) Misplaced %c"
+#~ msgstr "E866: (NFA-regexp) %c väärässä paikassa"
-#~ msgid "invalid mark name"
-#~ msgstr "virheellinen merkin nimi"
+#~ msgid "E865: (NFA) Regexp end encountered prematurely"
+#~ msgstr "E865: (NFA) Säännöllisen ilmauksen ennenaikainen loppu"
-#~ msgid "mark not set"
-#~ msgstr "merkko ei ole asetettu"
+#~ msgid "Error file"
+#~ msgstr "Virhetiedosto"
-#~ msgid "row %d column %d"
-#~ msgstr "rivi %d sarake %d"
+#~ msgid "shell returned %d"
+#~ msgstr "kuori palautti arvon %d"
-#~ msgid "cannot insert/append line"
-#~ msgstr "rivin lisys ei onnistu"
+#~ msgid "Vim Warning"
+#~ msgstr "Vim-varoitus"
-#~ msgid "line number out of range"
-#~ msgstr "rivinumero arvoalueen ulkopuolella"
+#~ msgid ""
+#~ "VIMRUN.EXE not found in your $PATH.\n"
+#~ "External commands will not pause after completion.\n"
+#~ "See :help win32-vimrun for more information."
+#~ msgstr ""
+#~ "VIMRUN.EXEä ei löydy muuttujasta $PATH.\n"
+#~ "Ulkoiset komennot eivät pysähdy suorituksen lopussa.\n"
+#~ "Lisätietoja komennolla :help win32-vimrun"
-#~ msgid "unknown flag: "
-#~ msgstr "tuntematon asetus: "
+#~ msgid "E371: Command not found"
+#~ msgstr "E371: Komentoa ei löydy"
-#~ msgid "unknown vimOption"
-#~ msgstr "tuntematon vimOption"
+#~ msgid "shutdown"
+#~ msgstr "sammutus"
-#~ msgid "keyboard interrupt"
-#~ msgstr "nppimistkeskeytys"
+#~ msgid "logoff"
+#~ msgstr "uloskirjautuminen"
-#~ msgid "vim error"
-#~ msgstr "vim-virhe"
+#~ msgid "close"
+#~ msgstr "sulkeminen"
-#~ msgid "cannot create buffer/window command: object is being deleted"
-#~ msgstr "ei voi luoda puskuri- tai ikkunakomentoa, olio on poistumassa"
+#~ msgid "Vim: Caught %s event\n"
+#~ msgstr "Vim: Napattiin %s\n"
+
+#~ msgid "Could not fix up function pointers to the DLL!"
+#~ msgstr "Ei voitu korjata funktio-osoittimia DLL:ssä"
+
+#~ msgid "VIM Error"
+#~ msgstr "VIM-virhe"
+
+#~ msgid "Could not load vim32.dll!"
+#~ msgstr "Vim32.dll:ää ei voitu ladata"
+
+#~ msgid "At line"
+#~ msgstr "Rivillä"
+
+#~ msgid "XSMP SmcOpenConnection failed: %s"
+#~ msgstr "XSMP SmcOpenConnection epäonnistui: %s"
+
+#~ msgid "XSMP ICE connection watch failed"
+#~ msgstr "XSMP:n ICE-yhteyden tarkkailu epäonnistui"
+
+#~ msgid "XSMP opening connection"
+#~ msgstr "XSMP avaa yhteyttä"
+
+#~ msgid "XSMP handling save-yourself request"
+#~ msgstr "XSMP käsittelee save-yourself-pyyntöä"
+
+#~ msgid "Opening the X display failed"
+#~ msgstr "X-näytön avaus epäonnistui"
+
+#~ msgid "XSMP lost ICE connection"
+#~ msgstr "XSMP kadotti ICE-yhteyden"
#~ msgid ""
-#~ "cannot register callback command: buffer/window is already being deleted"
-#~ msgstr "callbackia ei voi rekisterid: puskuri tai ikkuna on poistettu"
+#~ "\n"
+#~ "Command terminated\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Komento loppui\n"
#~ msgid ""
-#~ "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-"
-#~ "dev@vim.org"
+#~ "\n"
+#~ "Cannot execute shell "
#~ msgstr ""
-#~ "E280: kriittinen TCL-virhe: reflist hajalla? Ilmoita asiasta "
-#~ "postituslistalle vim-dev@vim.org"
+#~ "\n"
+#~ "Kuoren suoritus ei onnistu "
-#~ msgid "cannot register callback command: buffer/window reference not found"
+#~ msgid ""
+#~ "\n"
+#~ "Cannot fork\n"
#~ msgstr ""
-#~ "callbackia ei voi rekisterid: puskurin tai ikkunan viitett ei lydy"
+#~ "\n"
+#~ "Ei voi haarauttaa\n"
#~ msgid ""
-#~ "E571: Sorry, this command is disabled: the Tcl library could not be "
-#~ "loaded."
-#~ msgstr "E571: Sori, komento ei toimi, Tcl-kirjastoa ei voitu ladata."
+#~ "\n"
+#~ "Cannot create pipes\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Putkia ei voi tehdä\n"
#~ msgid ""
-#~ "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim."
-#~ "org"
+#~ "\n"
+#~ "Cannot execute shell sh\n"
#~ msgstr ""
-#~ "E281: TCL-virhe: lopetuskoodi ei ole kokonaisluku? Ilmoita asiasta "
-#~ "postituslistalle vim-dev@vim.org"
+#~ "\n"
+#~ "Kuoren sh suoritus ei onnistu\n"
-#~ msgid "E572: exit code %d"
-#~ msgstr "E572: palautusarvo %d"
+# mikä security context?
+#~ msgid "Could not get security context %s for %s. Removing it!"
+#~ msgstr "Ei saatu turvallisuuskontekstia %s kohteelle %s ja se poistetaan"
-#~ msgid "cannot get line"
-#~ msgstr "ei voida hakea rivi"
+#~ msgid "Could not set security context %s for %s"
+#~ msgstr "Ei voitu asettaa turvallisuuskontekstia %s kohteelle %s"
-#~ msgid "Unable to register a command server name"
-#~ msgstr "Komentopalvelimen nimen rekisterinti ei onnistu"
+#~ msgid "Opening the X display timed out"
+#~ msgstr "X-näytön avaus aikakatkaistiin"
-#~ msgid "E248: Failed to send command to the destination program"
-#~ msgstr "E248: Komennon lhetys kohdeohjelmalle ei onnistu"
+#~ msgid "Testing the X display failed"
+#~ msgstr "X-näytön testaus epäonnistui"
-#~ msgid "E573: Invalid server id used: %s"
-#~ msgstr "E573: Virheellinen palvelimen tunniste: %s"
+#~ msgid ""
+#~ "\n"
+#~ "Vim: Got X error\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Vim: X-virhe\n"
-#~ msgid "E251: VIM instance registry property is badly formed. Deleted!"
-#~ msgstr "E251: VIMin instanssin rekisteriarvo on virheellinen, poistettiin."
+#~ msgid "Opening the X display took %ld msec"
+#~ msgstr "X-näytön avaus vei %ld millisekuntia"
-#~ msgid "netbeans is not supported with this GUI\n"
-#~ msgstr "netbeans ei toimi tss kyttliittymss\n"
+#~ msgid "E245: Illegal char '%c' in font name \"%s\""
+#~ msgstr "E245: Virheellinen merkki %c fontin nimessä %s"
-#~ msgid "This Vim was not compiled with the diff feature."
-#~ msgstr "Thn Vimiin ei ole knnetty diff-toimintoja mukaan."
+#~ msgid "E244: Illegal quality name \"%s\" in font name \"%s\""
+#~ msgstr "E244: Virheellinen laatunimi %s fontin nimessä %s"
-#~ msgid "'-nb' cannot be used: not enabled at compile time\n"
-#~ msgstr "-nb:t ei voi kytt, koska sit ei knnetty mukaan\n"
+#~ msgid "E244: Illegal charset name \"%s\" in font name \"%s\""
+#~ msgstr "E244: Virheellinen merkistön nimi %s fontin nimessä %s"
-#~ msgid "Vim: Error: Failure to start gvim from NetBeans\n"
-#~ msgstr "Vim: Virhe: Gvimin kynnistys NetBeansist ei onnistu\n"
+#~ msgid "Printing '%s'"
+#~ msgstr "Tulostetaan %s"
+
+#~ msgid "E238: Print error: %s"
+#~ msgstr "E238: Tulostinvirhe: %s"
+
+#~ msgid "E613: Unknown printer font: %s"
+#~ msgstr "E613: Tuntematon tulostimen fontti: %s"
+
+#~ msgid "to %s on %s"
+#~ msgstr "tulostimelle %s kohteessa %s"
+
+#~ msgid "E237: Printer selection failed"
+#~ msgstr "E237: Tulostimen valinta epäonnistui"
+
+#~ msgid "'columns' is not 80, cannot execute external commands"
+#~ msgstr "columns ei ole 80, ei voi suorittaa ulkoista komentoa"
+
+#~ msgid "I/O ERROR"
+#~ msgstr "IO-virhe"
+
+#~ msgid "ANCHOR_BUF_SIZE too small."
+#~ msgstr "ANCHOR_BUF_SIZE liian pieni."
+
+#~ msgid " returned\n"
+#~ msgstr " palautti\n"
+
+#~ msgid "shell "
+#~ msgstr "kuori "
+
+#~ msgid "Cannot execute "
+#~ msgstr "Ei voi suorittaa "
+
+#~ msgid "E360: Cannot execute shell with -f option"
+#~ msgstr "E360: Kuorta ei voi avata asetuksella -f"
+
+#~ msgid "mch_get_shellsize: not a console??\n"
+#~ msgstr "mch_get_shellsize: ei ole konsoli?\n"
+
+#~ msgid "cannot change console mode ?!\n"
+#~ msgstr "ei voi vaihtaa konsolitilaa?\n"
+
+#~ msgid "Vim exiting with %d\n"
+#~ msgstr "Vim sulkeutuu koodilla %d\n"
+
+#~ msgid "Cannot create "
+#~ msgstr "Ei voi luoda "
+
+#~ msgid "Cannot open NIL:\n"
+#~ msgstr "Ei voi avata NILiä:\n"
+
+#~ msgid "Need %s version %ld\n"
+#~ msgstr "Tarvitaan %s versio %ld\n"
+
+#~ msgid "Need Amigados version 2.04 or later\n"
+#~ msgstr "Amigados 2.04 tai uudempi tarvitaan\n"
+
+#~ msgid "VIM: Can't open window!\n"
+#~ msgstr "VIM: Ei voi avata ikkunaa\n"
+
+#~ msgid "cannot open "
+#~ msgstr "ei voi avata "
+
+#~ msgid "E538: No mouse support"
+#~ msgstr "E538: Hiirtä ei tueta"
+
+#~ msgid "E533: can't select wide font"
+#~ msgstr "E533: Leveän fontin valinta ei onnistu"
+
+#~ msgid "E598: Invalid fontset"
+#~ msgstr "E598: Viallinen fontset"
+
+#~ msgid "E597: can't select fontset"
+#~ msgstr "E597: Fontsetin valinta ei onnistu"
+
+#~ msgid "E596: Invalid font(s)"
+#~ msgstr "E596: Viallisia fontteja"
+
+#~ msgid "E617: Cannot be changed in the GTK+ 2 GUI"
+#~ msgstr "E617: Ei voi muuttaa GTK+2-GUIssa"
+
+#~ msgid "E531: Use \":gui\" to start the GUI"
+#~ msgstr "E531: Käytä komentoa :gui GUIn käynnistämiseen"
+
+#~ msgid "E530: Cannot change term in GUI"
+#~ msgstr "E530: Ei voi vaihtaa termiä GUIssa"
+
+#~ msgid "E522: Not found in termcap"
+#~ msgstr "E522: Puuttuu termcapista"
+
+#~ msgid "Thanks for flying Vim"
+#~ msgstr "Kiitos että ajoit Vimiä"
+
+#~ msgid "%<%f%h%m%=Page %N"
+#~ msgstr "%<%f%h%m%=Sivu %N"
#~ msgid ""
#~ "\n"
-#~ "Where case is ignored prepend / to make flag upper case"
+#~ "# Registers:\n"
#~ msgstr ""
#~ "\n"
-#~ "Jos aakkoslaji on ohitettu, lis alkuun / tehdksesi asetuksesta "
-#~ "suuraakkosia"
+#~ "# Rekisterit:\n"
-#~ msgid "-register\t\tRegister this gvim for OLE"
-#~ msgstr "-register\t\trekisteri gvim OLEa varten"
+#~ msgid "Illegal register name"
+#~ msgstr "Virheellinen rekisterin nimi"
-#~ msgid "-unregister\t\tUnregister gvim for OLE"
-#~ msgstr "-unregister\t\tPoista gvim OLE-rekisterist"
+#~ msgid "freeing %ld lines"
+#~ msgstr "vapautetaan %ld riviä"
-#~ msgid "-g\t\t\tRun using GUI (like \"gvim\")"
-#~ msgstr "-g\t\t\tAvaa GUI (kuten gvimill)"
+#~ msgid "cannot yank; delete anyway"
+#~ msgstr "Ei voi kopioida; poista joka tapauksessa"
-#~ msgid "-f or --nofork\tForeground: Don't fork when starting GUI"
-#~ msgstr "-f tai --nofork\tEdustalle: l haarauta GUIn kynnistyksess"
+#~ msgid "E775: Eval feature not available"
+#~ msgstr "E775: Eval ei ole käytettävissä"
-#~ msgid "-f\t\t\tDon't use newcli to open window"
-#~ msgstr "-f\t\t\tl kyt newcli:t ikkunan avaamiseen"
+#~ msgid "E505: %s is read-only (add ! to override)"
+#~ msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)"
-#~ msgid "-dev <device>\t\tUse <device> for I/O"
-#~ msgstr "-dev <laite>\t\tKyt <laitetta> IO:hon"
+#~ msgid "E511: netbeans already connected"
+#~ msgstr "E511: netbeans on yhdistetty jo"
-#~ msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc"
-#~ msgstr "-U <gvimrc>\t\tKyt <gvimrc>-tiedostoa .gvimrc:iden sijasta"
+#~ msgid "E838: netbeans is not supported with this GUI"
+#~ msgstr "E838: netbeans ei toimi tässä käyttöliittymässä"
-#~ msgid "-x\t\t\tEdit encrypted files"
-#~ msgstr "-x\t\t\tMuokkaa salattua tiedostoa"
+#~ msgid "E658: NetBeans connection lost for buffer %ld"
+#~ msgstr "E658: NetBeans-yhteys katkesi puskurille %ld"
-#~ msgid "-display <display>\tConnect vim to this particular X-server"
-#~ msgstr "-display <nytt>\tYhdist vim tiettyyn X-palvelimeen"
+#~ msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\""
+#~ msgstr "E668: Väärä avaustila NetBeans-yhteyden infotiedostolle: %s"
-#~ msgid "-X\t\t\tDo not connect to X server"
-#~ msgstr "-X\t\t\tl yhdist X-palvelimeen"
+#~ msgid "E547: Illegal mouseshape"
+#~ msgstr "E547: Virheellinen hiiren muoto"
-#~ msgid "--remote <files>\tEdit <files> in a Vim server if possible"
-#~ msgstr ""
-#~ "--remote <tiedostoja>\tMuokkaa <tiedostoja> Vim-palvelimessa, jos "
-#~ "mahdollista"
+#~ msgid "E341: Internal error: lalloc(%ld, )"
+#~ msgstr "E341: Sisäinen virhe: lalloc(%ld, )"
-#~ msgid "--remote-silent <files> Same, don't complain if there is no server"
-#~ msgstr ""
-#~ "--remote-silent <tiedostoja>\tSama, mutta l ilmoita puuttuvasta "
-#~ "palvelimesta"
+#~ msgid "E340: Line is becoming too long"
+#~ msgstr "E340: Rivistä tulee liian pitkä"
#~ msgid ""
-#~ "--remote-wait <files> As --remote but wait for files to have been edited"
+#~ "[calls] total re/malloc()'s %lu, total free()'s %lu\n"
+#~ "\n"
#~ msgstr ""
-#~ "--remote-wait <tiedostoja> kuten --remote, mutta odota tiedostojen "
-#~ "muokkaamista"
+#~ "[kutsut] yht. re/malloc() %lu, yht. free() %lu\n"
+#~ "\n"
#~ msgid ""
-#~ "--remote-wait-silent <files> Same, don't complain if there is no server"
+#~ "\n"
+#~ "[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n"
#~ msgstr ""
-#~ "--remote-wait-silent <tiedostoja> sama, mutta l ilmoita puuttuvasta "
-#~ "palvelimesta"
+#~ "\n"
+#~ "[tavua] yht. alloc-free %lu-%lu, käytössä %lu, käyttöhuippu %lu\n"
-#~ msgid ""
-#~ "--remote-tab[-wait][-silent] <files> As --remote but use tab page per "
-#~ "file"
-#~ msgstr ""
-#~ "--remote-tab[-wait][-silent] <tiedostoja> kuten --remote, mutta avaa "
-#~ "vlilehti joka tiedostolle"
+#~ msgid "ERROR: "
+#~ msgstr "VIRHE: "
-#~ msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit"
-#~ msgstr ""
-#~ "--remote-send <nppimi>\tLhet <nppimi> painalluksina Vimille ja "
-#~ "lopeta"
+#~ msgid "E338: Sorry, no file browser in console mode"
+#~ msgstr "E338: tiedostonselain puuttuu konsolitilasta"
-#~ msgid ""
-#~ "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result"
-#~ msgstr ""
-#~ "--remote-expr <ilmaus>\tKsittele <ilmaus> Vim-palvelimella ja tulosta "
-#~ "tulos"
+#~ msgid "Open File dialog"
+#~ msgstr "Avausikkuna"
-#~ msgid "--serverlist\t\tList available Vim server names and exit"
-#~ msgstr "--serverlist\t\tLuettele Vim-palvelinten nimet ja lopeta"
+#~ msgid "Save File dialog"
+#~ msgstr "Tallennusikkuna"
-#~ msgid "--servername <name>\tSend to/become the Vim server <name>"
-#~ msgstr "--servername <nimi>\tLhet Vim-palvelimelle <nimi> tai luo se"
+#~ msgid "Select Directory dialog"
+#~ msgstr "Hakemiston valintaikkuna"
+
+#~ msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>"
+#~ msgstr "Käännöksen ylläpitäjä: Flammie Pirinen <flammie@iki.fi>"
+
+#~ msgid "E337: Menu not found - check menu names"
+#~ msgstr "E337: Valikkoa ei löytynyt - tarkista valikkojen nimet"
+
+#~ msgid "E336: Menu path must lead to a sub-menu"
+#~ msgstr "E336: Valikkopolun pitää johtaa alivalikkoon"
+
+#~ msgid "Tear off this menu"
+#~ msgstr "Repäise valikko irti"
+
+#~ msgid "Swap file already exists!"
+#~ msgstr "Swap-tiedosto on jo olemassa"
#~ msgid ""
#~ "\n"
-#~ "Arguments recognised by gvim (Motif version):\n"
+#~ " [not usable with this version of Vim]"
#~ msgstr ""
#~ "\n"
-#~ "Gvimin (Motif-version) tuntemat argumentit:\n"
+#~ " [ei toimi tämän Vim-version kanssa]"
+
+#~ msgid "Using crypt key from swap file for the text file.\n"
+#~ msgstr "Käytetään swäpin salausavainta tekstitiedostolle\n"
#~ msgid ""
#~ "\n"
-#~ "Arguments recognised by gvim (neXtaw version):\n"
+#~ "to use the same key for text file and swap file"
#~ msgstr ""
#~ "\n"
-#~ "Gvimin (neXtaw-version) tuntemat argumentit:\n"
+#~ "käyttääksesi samaa avainta teksti- ja swäppitiedostoille"
#~ msgid ""
#~ "\n"
-#~ "Arguments recognised by gvim (Athena version):\n"
+#~ "If you wrote the text file after changing the crypt key press enter"
#~ msgstr ""
#~ "\n"
-#~ "Gvimin (Athena-version) tuntemat argumentit:\n"
+#~ "Jos kirjoitit tekstitiedoston salausavaimen vaihdon jälkeen paina enteriä"
-#~ msgid "-display <display>\tRun vim on <display>"
-#~ msgstr "-display <nytt>\tSuorita vim <nytss>"
+#~ msgid ""
+#~ "\n"
+#~ "enter the new crypt key."
+#~ msgstr ""
+#~ "\n"
+#~ "anna uusi salausavain."
-#~ msgid "-iconic\t\tStart vim iconified"
-#~ msgstr "-iconic\t\tKynnist pienennettyn"
+#~ msgid ""
+#~ "\n"
+#~ "If you entered a new crypt key but did not write the text file,"
+#~ msgstr ""
+#~ "\n"
+#~ "Jos käytit uutta salausavainta muttet kirjoittanut tekstitiedostoa,"
-#~ msgid "-background <color>\tUse <color> for the background (also: -bg)"
-#~ msgstr "-background <vri>\tKyt <vri> taustavrin (mys: -bg)"
+#~ msgid "Swap file is encrypted: \"%s\""
+#~ msgstr "Swap-tiedosto on salattu: %s"
-#~ msgid "-foreground <color>\tUse <color> for normal text (also: -fg)"
-#~ msgstr "-foreground <vri>\tKyt <vri> tekstin vrin (mys: -fg)"
+#~ msgid ""
+#~ "E833: %s is encrypted and this version of Vim does not support encryption"
+#~ msgstr "E833: %s on salattu eikä tämä Vim tue salausta"
-#~ msgid "-font <font>\t\tUse <font> for normal text (also: -fn)"
-#~ msgstr "-font <fontti>\t\tKyt <fonttia> tekstiss (mys: -fn)"
+#~ msgid "E843: Error while updating swap file crypt"
+#~ msgstr "E843: Virhe päivitettäessä swapin kryptausta"
-#~ msgid "-boldfont <font>\tUse <font> for bold text"
-#~ msgstr "-boldfont <fontti>\tKyt <fonttia> lihavoidussa tekstiss"
+#~ msgid "E289: input method doesn't support my preedit type"
+#~ msgstr "E289: syötemetodi ei tue tätä preedit-tyyppiä"
-#~ msgid "-italicfont <font>\tUse <font> for italic text"
-#~ msgstr "-italicfont <fontti>\tKyt <fonttia> kursivoidussa tekstiss"
+#~ msgid "E288: input method doesn't support any style"
+#~ msgstr "E288: syötemetodi ei tue tyylejä"
-#~ msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)"
+#~ msgid "E287: Warning: Could not set destroy callback to IM"
#~ msgstr ""
-#~ "-geometry <geom>\tKyt mittoja <geom> ikkunan asetteluun (mys: -geom)"
+#~ "E287: Varoitus: Ei voitu asettaa destroy-kutsua syötemetodipalvelimelle"
-#~ msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)"
-#~ msgstr "-borderwidt <leveys>\tKyt <leveytt> reunuksissa (mys: -bw) "
-
-#~ msgid ""
-#~ "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)"
-#~ msgstr ""
-#~ "-scrollbarwidth <leveys> Kyt <leveytt> vierityspalkissa (mys: -sw)"
+#~ msgid "E286: Failed to open input method"
+#~ msgstr "E286: Syötemetodin avaus ei onnistu"
-#~ msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)"
-#~ msgstr "-menuheight <korkeus>\tKyt <korkeutta> valikossa (mys: -mh)"
+#~ msgid "E285: Failed to create input context"
+#~ msgstr "E285: Syötekontekstin luonti ei onnistu"
-#~ msgid "-reverse\t\tUse reverse video (also: -rv)"
-#~ msgstr "-reverse\t\tKyt knteisvrej (mys: -rv) "
+#~ msgid "E284: Cannot set IC values"
+#~ msgstr "E284: Ei voi asettaa IC-arvoja"
-#~ msgid "+reverse\t\tDon't use reverse video (also: +rv)"
-#~ msgstr "+reverse\t\tl kyt knteisvrej (mys: +rv)"
+#~ msgid "E543: Not a valid codepage"
+#~ msgstr "E543: Koodisivu ei ole käypä"
-#~ msgid "-xrm <resource>\tSet the specified resource"
-#~ msgstr "-xrm <resurssi>\tAseta resurssi"
+#~ msgid "Missing '>'"
+#~ msgstr "> puuttuu"
#~ msgid ""
#~ "\n"
-#~ "Arguments recognised by gvim (RISC OS version):\n"
+#~ "# History of marks within files (newest to oldest):\n"
#~ msgstr ""
#~ "\n"
-#~ "Gvimin (RISC OS -version) tuntemat argumentit:\n"
-
-#~ msgid "--columns <number>\tInitial width of window in columns"
-#~ msgstr "--columns <luku>\tIkkunan alkuleveys sarakkeina"
+#~ "# Tiedostojen merkkien historia (uusimmasta vanhimpaan):\n"
-#~ msgid "--rows <number>\tInitial height of window in rows"
-#~ msgstr "--rows <luku>\tIkkunan alkukorkeus rivein"
+#~ msgid ""
+#~ "\n"
+#~ "# Jumplist (newest first):\n"
+#~ msgstr ""
+#~ "\n"
+#~ "# Hyppylista (uusin ensiksi):\n"
#~ msgid ""
#~ "\n"
-#~ "Arguments recognised by gvim (GTK+ version):\n"
+#~ "# File marks:\n"
#~ msgstr ""
#~ "\n"
-#~ "Gvimin (GTK+-version) tuntemat argumentit:\n"
+#~ "# Tiedoston merkit:\n"
-#~ msgid "-display <display>\tRun vim on <display> (also: --display)"
-#~ msgstr "-display <nytt>\tSuorita vim nytll <nytt> (mys: --display)"
+#~ msgid ": Send expression failed.\n"
+#~ msgstr ": Ilmauksen lähetys epäonnistui.\n"
-# X-ikkunointijrjestelmss saman sovelluksen saman luokan ikkunat
-# tunnistetaan rooliresursseista
-#~ msgid "--role <role>\tSet a unique role to identify the main window"
-#~ msgstr ""
-#~ "--role <rooli>\tAseta pikkunalle ainutlaatuinen rooli tunnisteeksi"
+#~ msgid "No display: Send expression failed.\n"
+#~ msgstr "Ei näyttöä: Ilmauksen lähetys epäonnistui.\n"
-#~ msgid "--socketid <xid>\tOpen Vim inside another GTK widget"
-#~ msgstr "--socketid <xid>\tAvaa Vim annettuun GTK-olioon "
+#~ msgid "%d of %d edited"
+#~ msgstr "%d/%d muokattu"
-#~ msgid "-P <parent title>\tOpen Vim inside parent application"
-#~ msgstr "-P <otsikko>\tAvaa Vim isntohjelman sisn"
+#~ msgid ": Send failed. Trying to execute locally\n"
+#~ msgstr ": Lähetys epäonnistui. Yritetään suorittaa paikallisena\n"
+
+#~ msgid ": Send failed.\n"
+#~ msgstr ": Lähetys epäonnistui.\n"
+
+#~ msgid "No display"
+#~ msgstr "Ei näyttöä"
#~ msgid "--windowid <HWND>\tOpen Vim inside another win32 widget"
#~ msgstr "--windowid <HWND>\tAvaa Vim annettuun win32-olioon "
-#~ msgid "No display"
-#~ msgstr "Ei nytt"
+#~ msgid "-P <parent title>\tOpen Vim inside parent application"
+#~ msgstr "-P <otsikko>\tAvaa Vim isäntäohjelman sisään"
-#~ msgid ": Send failed.\n"
-#~ msgstr ": Lhetys eponnistui.\n"
+#~ msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout"
+#~ msgstr "--echo-wid\t\tTulosta gvimin Window ID vakiotulosteeseen"
-#~ msgid ": Send failed. Trying to execute locally\n"
-#~ msgstr ": Lhetys eponnistui. Yritetn suorittaa paikallisena\n"
+#~ msgid "--socketid <xid>\tOpen Vim inside another GTK widget"
+#~ msgstr "--socketid <xid>\tAvaa Vim annettuun GTK-olioon "
-#~ msgid "%d of %d edited"
-#~ msgstr "%d/%d muokattu"
+# X-ikkunointijärjestelmässä saman sovelluksen saman luokan ikkunat
+# tunnistetaan rooliresursseista
+#~ msgid "--role <role>\tSet a unique role to identify the main window"
+#~ msgstr ""
+#~ "--role <rooli>\tAseta pääikkunalle ainutlaatuinen rooli tunnisteeksi"
-#~ msgid "No display: Send expression failed.\n"
-#~ msgstr "Ei nytt: Ilmauksen lhetys eponnistui.\n"
+#~ msgid "-display <display>\tRun vim on <display> (also: --display)"
+#~ msgstr "-display <näyttö>\tSuorita vim näytöllä <näyttö> (myös: --display)"
-#~ msgid ": Send expression failed.\n"
-#~ msgstr ": Ilmauksen lhetys eponnistui.\n"
+#~ msgid ""
+#~ "\n"
+#~ "Arguments recognised by gvim (GTK+ version):\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Gvimin (GTK+-version) tuntemat argumentit:\n"
-#~ msgid "E543: Not a valid codepage"
-#~ msgstr "E543: Koodisivu ei ole kyp"
+#~ msgid "-xrm <resource>\tSet the specified resource"
+#~ msgstr "-xrm <resurssi>\tAseta resurssi"
-#~ msgid "E285: Failed to create input context"
-#~ msgstr "E285: Sytekontekstin luonti ei onnistu"
+#~ msgid "+reverse\t\tDon't use reverse video (also: +rv)"
+#~ msgstr "+reverse\t\tÄlä käytä käänteisvärejä (myös: +rv)"
-#~ msgid "E286: Failed to open input method"
-#~ msgstr "E286: Sytemetodin avaus ei onnistu"
+#~ msgid "-reverse\t\tUse reverse video (also: -rv)"
+#~ msgstr "-reverse\t\tKäytä käänteisvärejä (myös: -rv) "
-#~ msgid "E287: Warning: Could not set destroy callback to IM"
+#~ msgid "-menuheight <height>\tUse a menu bar height of <height> (also: -mh)"
+#~ msgstr "-menuheight <korkeus>\tKäytä <korkeutta> valikossa (myös: -mh)"
+
+#~ msgid ""
+#~ "-scrollbarwidth <width> Use a scrollbar width of <width> (also: -sw)"
#~ msgstr ""
-#~ "E287: Varoitus: Ei voitu asettaa destroy-kutsua sytemetodipalvelimelle"
+#~ "-scrollbarwidth <leveys> Käytä <leveyttä> vierityspalkissa (myös: -sw)"
-#~ msgid "E288: input method doesn't support any style"
-#~ msgstr "E288: sytemetodi ei tue tyylej"
+#~ msgid "-borderwidth <width>\tUse a border width of <width> (also: -bw)"
+#~ msgstr "-borderwidt <leveys>\tKäytä <leveyttä> reunuksissa (myös: -bw) "
-#~ msgid "E289: input method doesn't support my preedit type"
-#~ msgstr "E289: sytemetodi ei tue tt preedit-tyyppi"
+#~ msgid "-geometry <geom>\tUse <geom> for initial geometry (also: -geom)"
+#~ msgstr ""
+#~ "-geometry <geom>\tKäytä mittoja <geom> ikkunan asetteluun (myös: -geom)"
-#~ msgid ""
-#~ "E833: %s is encrypted and this version of Vim does not support encryption"
-#~ msgstr "E833: %s on salattu eik tm Vim tue salausta"
+#~ msgid "-italicfont <font>\tUse <font> for italic text"
+#~ msgstr "-italicfont <fontti>\tKäytä <fonttia> kursivoidussa tekstissä"
-#~ msgid "Swap file is encrypted: \"%s\""
-#~ msgstr "Swap-tiedosto on salattu: %s"
+#~ msgid "-boldfont <font>\tUse <font> for bold text"
+#~ msgstr "-boldfont <fontti>\tKäytä <fonttia> lihavoidussa tekstissä"
+
+#~ msgid "-font <font>\t\tUse <font> for normal text (also: -fn)"
+#~ msgstr "-font <fontti>\t\tKäytä <fonttia> tekstissä (myös: -fn)"
+
+#~ msgid "-foreground <color>\tUse <color> for normal text (also: -fg)"
+#~ msgstr "-foreground <väri>\tKäytä <väriä> tekstin värinä (myös: -fg)"
+
+#~ msgid "-background <color>\tUse <color> for the background (also: -bg)"
+#~ msgstr "-background <väri>\tKäytä <väriä> taustavärinä (myös: -bg)"
+
+#~ msgid "-iconic\t\tStart vim iconified"
+#~ msgstr "-iconic\t\tKäynnistä pienennettynä"
+
+#~ msgid "-display <display>\tRun vim on <display>"
+#~ msgstr "-display <näyttö>\tSuorita vim <näytössä>"
#~ msgid ""
#~ "\n"
-#~ "If you entered a new crypt key but did not write the text file,"
+#~ "Arguments recognised by gvim (Athena version):\n"
#~ msgstr ""
#~ "\n"
-#~ "Jos kytit uutta salausavainta muttet kirjoittanut tekstitiedostoa,"
+#~ "Gvimin (Athena-version) tuntemat argumentit:\n"
#~ msgid ""
#~ "\n"
-#~ "enter the new crypt key."
+#~ "Arguments recognised by gvim (neXtaw version):\n"
#~ msgstr ""
#~ "\n"
-#~ "anna uusi salausavain."
+#~ "Gvimin (neXtaw-version) tuntemat argumentit:\n"
#~ msgid ""
#~ "\n"
-#~ "If you wrote the text file after changing the crypt key press enter"
+#~ "Arguments recognised by gvim (Motif version):\n"
#~ msgstr ""
#~ "\n"
-#~ "Jos kirjoitit tekstitiedoston salausavaimen vaihdon jlkeen paina enteri"
+#~ "Gvimin (Motif-version) tuntemat argumentit:\n"
+
+#~ msgid "-i <viminfo>\t\tUse <viminfo> instead of .viminfo"
+#~ msgstr "-i <viminfo>\t\tKäytä <viminfo>-tiedostoa .viminfon sijaan"
+
+#~ msgid "--servername <name>\tSend to/become the Vim server <name>"
+#~ msgstr "--servername <nimi>\tLähetä Vim-palvelimelle <nimi> tai luo se"
+
+#~ msgid "--serverlist\t\tList available Vim server names and exit"
+#~ msgstr "--serverlist\t\tLuettele Vim-palvelinten nimet ja lopeta"
#~ msgid ""
-#~ "\n"
-#~ "to use the same key for text file and swap file"
+#~ "--remote-expr <expr>\tEvaluate <expr> in a Vim server and print result"
#~ msgstr ""
-#~ "\n"
-#~ "kyttksesi samaa avainta teksti- ja swppitiedostoille"
+#~ "--remote-expr <ilmaus>\tKäsittele <ilmaus> Vim-palvelimella ja tulosta "
+#~ "tulos"
-#~ msgid "Using crypt key from swap file for the text file.\n"
-#~ msgstr "Kytetn swpin salausavainta tekstitiedostolle\n"
+#~ msgid "--remote-send <keys>\tSend <keys> to a Vim server and exit"
+#~ msgstr ""
+#~ "--remote-send <näppäimiä>\tLähetä <näppäimiä> painalluksina Vimille ja "
+#~ "lopeta"
#~ msgid ""
-#~ "\n"
-#~ " [not usable with this version of Vim]"
+#~ "--remote-tab[-wait][-silent] <files> As --remote but use tab page per "
+#~ "file"
#~ msgstr ""
-#~ "\n"
-#~ " [ei toimi tmn Vim-version kanssa]"
+#~ "--remote-tab[-wait][-silent] <tiedostoja> kuten --remote, mutta avaa "
+#~ "välilehti joka tiedostolle"
-#~ msgid "Tear off this menu"
-#~ msgstr "Repise valikko irti"
+#~ msgid ""
+#~ "--remote-wait-silent <files> Same, don't complain if there is no server"
+#~ msgstr ""
+#~ "--remote-wait-silent <tiedostoja> sama, mutta älä ilmoita puuttuvasta "
+#~ "palvelimesta"
-#~ msgid "Select Directory dialog"
-#~ msgstr "Hakemiston valintaikkuna"
+#~ msgid ""
+#~ "--remote-wait <files> As --remote but wait for files to have been edited"
+#~ msgstr ""
+#~ "--remote-wait <tiedostoja> kuten --remote, mutta odota tiedostojen "
+#~ "muokkaamista"
-#~ msgid "Save File dialog"
-#~ msgstr "Tallennusikkuna"
+#~ msgid "--remote-silent <files> Same, don't complain if there is no server"
+#~ msgstr ""
+#~ "--remote-silent <tiedostoja>\tSama, mutta älä ilmoita puuttuvasta "
+#~ "palvelimesta"
-#~ msgid "Open File dialog"
-#~ msgstr "Avausikkuna"
+#~ msgid "--remote <files>\tEdit <files> in a Vim server if possible"
+#~ msgstr ""
+#~ "--remote <tiedostoja>\tMuokkaa <tiedostoja> Vim-palvelimessa, jos "
+#~ "mahdollista"
-#~ msgid "E338: Sorry, no file browser in console mode"
-#~ msgstr "E338: Sori, tiedostonselain puuttuu konsolitilasta"
+#~ msgid "-X\t\t\tDo not connect to X server"
+#~ msgstr "-X\t\t\tÄlä yhdistä X-palvelimeen"
-#~ msgid "Vim: preserving files...\n"
-#~ msgstr "Vim: sstetn tiedostoja...\n"
+#~ msgid "-display <display>\tConnect vim to this particular X-server"
+#~ msgstr "-display <näyttö>\tYhdistä vim tiettyyn X-palvelimeen"
-#~ msgid "Vim: Finished.\n"
-#~ msgstr "Vim: Valmis.\n"
+#~ msgid "-x\t\t\tEdit encrypted files"
+#~ msgstr "-x\t\t\tMuokkaa salattua tiedostoa"
-#~ msgid "ERROR: "
-#~ msgstr "VIRHE: "
+#~ msgid "+\t\t\tStart at end of file"
+#~ msgstr "+\t\t\tAloita tiedoston lopusta"
-#~ msgid ""
-#~ "\n"
-#~ "[bytes] total alloc-freed %<PRIu64>-%<PRIu64>, in use %<PRIu64>, peak use "
-#~ "%<PRIu64>\n"
-#~ msgstr ""
-#~ "\n"
-#~ "[tavua] yht. alloc-free %<PRIu64>-%<PRIu64>, kytss %<PRIu64>, "
-#~ "kytthuippu %<PRIu64>\n"
+#~ msgid "-U <gvimrc>\t\tUse <gvimrc> instead of any .gvimrc"
+#~ msgstr "-U <gvimrc>\t\tKäytä <gvimrc>-tiedostoa .gvimrc:iden sijasta"
-#~ msgid ""
-#~ "[calls] total re/malloc()'s %<PRIu64>, total free()'s %<PRIu64>\n"
-#~ "\n"
-#~ msgstr ""
-#~ "[kutsut] yht. re/malloc() %<PRIu64>, yht. free() %<PRIu64>\n"
-#~ "\n"
+#~ msgid "--not-a-term\t\tSkip warning for input/output not being a terminal"
+#~ msgstr "--not-a-term\t\tOhita varoitus siitä että i/o ei ole terminaali"
-#~ msgid "E340: Line is becoming too long"
-#~ msgstr "E340: Rivist tulee liian pitk"
+#~ msgid "-T <terminal>\tSet terminal type to <terminal>"
+#~ msgstr "-T <terminaali>\tAseta terminaalin tyypiksi <terminaali>"
-#~ msgid "E341: Internal error: lalloc(%<PRId64>, )"
-#~ msgstr "E341: Sisinen virhe: lalloc(%<PRId64>, )"
+#~ msgid "-F\t\t\tStart in Farsi mode"
+#~ msgstr "-F\t\t\tkäynnistä farsi-tilassa"
-#~ msgid "E547: Illegal mouseshape"
-#~ msgstr "E547: Virheellinen hiiren muoto"
+#~ msgid "-H\t\t\tStart in Hebrew mode"
+#~ msgstr "-H\t\t\tkäynnistä heprea-tilassa"
-#~ msgid "Enter encryption key: "
-#~ msgstr "Anna salausavain: "
+#~ msgid "-A\t\t\tstart in Arabic mode"
+#~ msgstr "-A\t\t\tkäynnistä arabia-tilassa"
-#~ msgid "Enter same key again: "
-#~ msgstr "Anna sama avain uudestaan: "
+#~ msgid "-dev <device>\t\tUse <device> for I/O"
+#~ msgstr "-dev <laite>\t\tKäytä <laitetta> IO:hon"
-#~ msgid "Keys don't match!"
-#~ msgstr "Avaimet eivt tsm!"
+#~ msgid "-f\t\t\tDon't use newcli to open window"
+#~ msgstr "-f\t\t\tÄlä käytä newcli:tä ikkunan avaamiseen"
-#~ msgid "Cannot connect to Netbeans #2"
-#~ msgstr "Ei voi yhdist Netbeans #2:een"
+#~ msgid "-L\t\t\tSame as -r"
+#~ msgstr "-L\t\t\tkuten -r"
-#~ msgid "Cannot connect to Netbeans"
-#~ msgstr "Ei voi yhdist Netbeansiin"
+#~ msgid "-D\t\t\tDebugging mode"
+#~ msgstr "-D\t\t\tVianetsintätila"
-#~ msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\""
-#~ msgstr "E668: Vr avaustila NetBeans-yhteyden infotiedostolle: %s"
+#~ msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'"
+#~ msgstr "-N\t\t\tEi Vi-yhteensopivuutta: nocompatible"
-#~ msgid "read from Netbeans socket"
-#~ msgstr "luettu Netbeans-soketista"
+#~ msgid "-C\t\t\tCompatible with Vi: 'compatible'"
+#~ msgstr "-C\t\t\tVi-yhteensopivuustila: compatible"
-#~ msgid "E658: NetBeans connection lost for buffer %<PRId64>"
-#~ msgstr "E658: NetBeans-yhteys katkesi puskurille %<PRId64>"
+#~ msgid "-l\t\t\tLisp mode"
+#~ msgstr "-l\t\t\tLisp-tila"
-#~ msgid "E511: netbeans already connected"
-#~ msgstr "E511: netbeans on yhdistetty jo"
+#~ msgid "-b\t\t\tBinary mode"
+#~ msgstr "-b\t\t\tBinääritila"
-#~ msgid "E505: "
-#~ msgstr "E505: "
+#~ msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
+#~ msgstr "-Z\t\t\tRajoitettu tila (kuten rvimillä)"
-#~ msgid "E775: Eval feature not available"
-#~ msgstr "E775: Eval ei ole kytettviss"
+#~ msgid "-R\t\t\tReadonly mode (like \"view\")"
+#~ msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)"
-#~ msgid "freeing %<PRId64> lines"
-#~ msgstr "vapautetaan %<PRId64> rivi"
+#~ msgid "-y\t\t\tEasy mode (like \"evim\", modeless)"
+#~ msgstr "-y\t\t\tHelppokäyttötila (kuten evimissä, ilman tiloja)"
-#~ msgid "E530: Cannot change term in GUI"
-#~ msgstr "E530: Ei voi vaihtaa termi GUIssa"
+#~ msgid "-d\t\t\tDiff mode (like \"vimdiff\")"
+#~ msgstr "-d\t\t\tDiff-tila (kuten vimdiffillä)"
-#~ msgid "E531: Use \":gui\" to start the GUI"
-#~ msgstr "E531: Kyt komentoa :gui GUIn kynnistmiseen"
+#~ msgid "-E\t\t\tImproved Ex mode"
+#~ msgstr "-E\t\t\tParanneltu Ex-tila"
-#~ msgid "E617: Cannot be changed in the GTK+ 2 GUI"
-#~ msgstr "E617: Ei voi muuttaa GTK+2-GUIssa"
+#~ msgid "-e\t\t\tEx mode (like \"ex\")"
+#~ msgstr "-e\t\t\tEx-tila (kute exillä)"
-#~ msgid "E596: Invalid font(s)"
-#~ msgstr "E596: Viallisia fontteja"
+#~ msgid "-v\t\t\tVi mode (like \"vi\")"
+#~ msgstr "-v\t\t\tVi-tila (kuten villä)"
-#~ msgid "E597: can't select fontset"
-#~ msgstr "E597: Fontsetin valinta ei onnistu"
+#~ msgid "-f or --nofork\tForeground: Don't fork when starting GUI"
+#~ msgstr "-f tai --nofork\tEdustalle: Älä haarauta GUIn käynnistyksessä"
-#~ msgid "E598: Invalid fontset"
-#~ msgstr "E598: Viallinen fontset"
+#~ msgid "-g\t\t\tRun using GUI (like \"gvim\")"
+#~ msgstr "-g\t\t\tAvaa GUI (kuten gvimillä)"
-#~ msgid "E533: can't select wide font"
-#~ msgstr "E533: Leven fontin valinta ei onnistu"
+#~ msgid "-unregister\t\tUnregister gvim for OLE"
+#~ msgstr "-unregister\t\tPoista gvim OLE-rekisteristä"
-#~ msgid "E534: Invalid wide font"
-#~ msgstr "E534: Viallinen leve fontti"
+#~ msgid "-register\t\tRegister this gvim for OLE"
+#~ msgstr "-register\t\trekisteröi gvim OLEa varten"
-#~ msgid "E538: No mouse support"
-#~ msgstr "E538: Hiirt ei tueta"
+#~ msgid ""
+#~ "\n"
+#~ "Where case is ignored prepend / to make flag upper case"
+#~ msgstr ""
+#~ "\n"
+#~ "Jos aakkoslaji on ohitettu, lisää alkuun / tehdäksesi asetuksesta "
+#~ "suuraakkosia"
-#~ msgid "cannot open "
-#~ msgstr "ei voi avata "
+#~ msgid ""
+#~ "\n"
+#~ " or:"
+#~ msgstr ""
+#~ "\n"
+#~ " tai:"
-#~ msgid "VIM: Can't open window!\n"
-#~ msgstr "VIM: Ei voi avata ikkunaa\n"
+#~ msgid " vim [arguments] "
+#~ msgstr " vim [argumentit] "
-#~ msgid "Need Amigados version 2.04 or later\n"
-#~ msgstr "Amigados 2.04 tai uudempi tarvitaan\n"
+#~ msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n"
+#~ msgstr "Vim: Virhe: Tämä versio Vimistä ei toimi Cygwinin terminaalissa\n"
-#~ msgid "Need %s version %<PRId64>\n"
-#~ msgstr "Tarvitaan %s versio %<PRId64>\n"
+#~ msgid "Vim: Error: Failure to start gvim from NetBeans\n"
+#~ msgstr "Vim: Virhe: Gvimin käynnistys NetBeansistä ei onnistu\n"
-#~ msgid "Cannot open NIL:\n"
-#~ msgstr "Ei voi avata NILi:\n"
+#~ msgid "This Vim was not compiled with the diff feature."
+#~ msgstr "Tähän Vimiin ei ole käännetty diff-toimintoja mukaan."
-#~ msgid "Cannot create "
-#~ msgstr "Ei voi luoda "
+#~ msgid "'-nb' cannot be used: not enabled at compile time\n"
+#~ msgstr "-nb:tä ei voi käyttää, koska sitä ei käännetty mukaan\n"
-#~ msgid "Vim exiting with %d\n"
-#~ msgstr "Vim sulkeutuu koodilla %d\n"
+#~ msgid "netbeans is not supported with this GUI\n"
+#~ msgstr "netbeans ei toimi tässä käyttöliittymässä\n"
-#~ msgid "cannot change console mode ?!\n"
-#~ msgstr "ei voi vaihtaa konsolitilaa?\n"
+#~ msgid "%d files to edit\n"
+#~ msgstr "%d tiedostoa muokattavana\n"
-#~ msgid "mch_get_shellsize: not a console??\n"
-#~ msgstr "mch_get_shellsize: ei ole konsoli?\n"
+#~ msgid "E251: VIM instance registry property is badly formed. Deleted!"
+#~ msgstr "E251: VIMin instanssin rekisteriarvo on virheellinen, poistettiin."
-#~ msgid "E360: Cannot execute shell with -f option"
-#~ msgstr "E360: Kuorta ei voi avata asetuksella -f"
+#~ msgid "E573: Invalid server id used: %s"
+#~ msgstr "E573: Virheellinen palvelimen tunniste: %s"
-#~ msgid "Cannot execute "
-#~ msgstr "Ei voi suorittaa "
+#~ msgid "E248: Failed to send command to the destination program"
+#~ msgstr "E248: Komennon lähetys kohdeohjelmalle ei onnistu"
-#~ msgid "shell "
-#~ msgstr "kuori "
+#~ msgid "Unable to register a command server name"
+#~ msgstr "Komentopalvelimen nimen rekisteröinti ei onnistu"
-#~ msgid " returned\n"
-#~ msgstr " palautti\n"
+#~ msgid "cannot get line"
+#~ msgstr "ei voida hakea riviä"
-#~ msgid "ANCHOR_BUF_SIZE too small."
-#~ msgstr "ANCHOR_BUF_SIZE liian pieni."
+#~ msgid "E572: exit code %d"
+#~ msgstr "E572: palautusarvo %d"
-#~ msgid "I/O ERROR"
-#~ msgstr "IO-virhe"
+#~ msgid ""
+#~ "E571: Sorry, this command is disabled: the Tcl library could not be "
+#~ "loaded."
+#~ msgstr "E571: komento ei toimi, Tcl-kirjastoa ei voitu ladata."
-#~ msgid "Message"
-#~ msgstr "Viesti"
+#~ msgid "cannot register callback command: buffer/window reference not found"
+#~ msgstr ""
+#~ "callbackia ei voi rekisteröidä: puskurin tai ikkunan viitettä ei löydy"
-#~ msgid "'columns' is not 80, cannot execute external commands"
-#~ msgstr "columns ei ole 80, ei voi suorittaa ulkoista komentoa"
+#~ msgid ""
+#~ "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-"
+#~ "dev@vim.org"
+#~ msgstr ""
+#~ "E280: kriittinen TCL-virhe: reflist hajalla? Ilmoita asiasta "
+#~ "postituslistalle vim-dev@vim.org"
-#~ msgid "E237: Printer selection failed"
-#~ msgstr "E237: Tulostimen valinta eponnistui"
+#~ msgid ""
+#~ "cannot register callback command: buffer/window is already being deleted"
+#~ msgstr "callbackia ei voi rekisteröidä: puskuri tai ikkuna on poistettu"
-#~ msgid "to %s on %s"
-#~ msgstr "tulostimelle %s kohteessa %s"
+#~ msgid "cannot create buffer/window command: object is being deleted"
+#~ msgstr "ei voi luoda puskuri- tai ikkunakomentoa, olio on poistumassa"
-#~ msgid "E613: Unknown printer font: %s"
-#~ msgstr "E613: Tuntematon tulostimen fontti: %s"
+#~ msgid "vim error"
+#~ msgstr "vim-virhe"
-#~ msgid "E238: Print error: %s"
-#~ msgstr "E238: Tulostinvirhe: %s"
+#~ msgid "unknown vimOption"
+#~ msgstr "tuntematon vimOption"
-#~ msgid "Printing '%s'"
-#~ msgstr "Tulostetaan %s"
+#~ msgid "unknown flag: "
+#~ msgstr "tuntematon asetus: "
-#~ msgid "E244: Illegal charset name \"%s\" in font name \"%s\""
-#~ msgstr "E244: Virheellinen merkistn nimi %s fontin nimess %s"
+#~ msgid "cannot insert/append line"
+#~ msgstr "rivin lisäys ei onnistu"
-#~ msgid "E245: Illegal char '%c' in font name \"%s\""
-#~ msgstr "E245: Virheellinen merkki %c fontin nimess %s"
+#~ msgid "row %d column %d"
+#~ msgstr "rivi %d sarake %d"
+
+#~ msgid "mark not set"
+#~ msgstr "merkko ei ole asetettu"
+
+#~ msgid "cannot set line(s)"
+#~ msgstr "ei voi asettaa rivejä"
-#~ msgid "Vim: Double signal, exiting\n"
-#~ msgstr "Vim: Kaksoissignaali, lopetetaan\n"
+#~ msgid "not implemented yet"
+#~ msgstr "ei toteutettu"
-#~ msgid "Vim: Caught deadly signal %s\n"
-#~ msgstr "Vim: Tappava signaali %s\n"
+#~ msgid "E273: unknown longjmp status %d"
+#~ msgstr "E273: tuntematon longjmp-tila %d"
-#~ msgid "Vim: Caught deadly signal\n"
-#~ msgstr "Vim: Tappava signaali\n"
+#~ msgid "E272: unhandled exception"
+#~ msgstr "E272: käsittelemätön poikkeus"
-#~ msgid "Opening the X display took %<PRId64> msec"
-#~ msgstr "X-nytn avaus vei %<PRId64> millisekuntia"
+#~ msgid "E271: retry outside of rescue clause"
+#~ msgstr "E271: retry rescuen ulkopuolella"
-#~ msgid ""
-#~ "\n"
-#~ "Vim: Got X error\n"
-#~ msgstr ""
-#~ "\n"
-#~ "Vim: X-virhe\n"
+#~ msgid "E269: unexpected break"
+#~ msgstr "E269: Odotuksenvastainen break"
-#~ msgid "Testing the X display failed"
-#~ msgstr "X-nytn testaus eponnistui"
+#~ msgid "E268: unexpected next"
+#~ msgstr "E268: Odotuksenvastainen next"
-#~ msgid "Opening the X display timed out"
-#~ msgstr "X-nytn avaus aikakatkaistiin"
+#~ msgid "E267: unexpected return"
+#~ msgstr "E267: odotuksenvastainen return"
#~ msgid ""
-#~ "\n"
-#~ "Cannot execute shell sh\n"
+#~ "E266: Sorry, this command is disabled, the Ruby library could not be "
+#~ "loaded."
+#~ msgstr "E266: komento ei toimi, Ruby-kirjastoa ei voitu ladata."
+
+#~ msgid "E265: $_ must be an instance of String"
+#~ msgstr "E265: muuttujan $_ pitää olla Stringin instanssi"
+
+#~ msgid "E837: This Vim cannot execute :py3 after using :python"
#~ msgstr ""
-#~ "\n"
-#~ "Kuoren sh suoritus ei onnistu\n"
+#~ "E837: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa"
+
+#~ msgid "E659: Cannot invoke Python recursively"
+#~ msgstr "E659: Pythonia ei voi kutsua rekursiivisesti"
#~ msgid ""
-#~ "\n"
-#~ "Cannot create pipes\n"
+#~ "E887: Sorry, this command is disabled, the Python's site module could not "
+#~ "be loaded."
#~ msgstr ""
-#~ "\n"
-#~ "Putkia ei voi tehd\n"
+#~ "E887: Komento ei toimi, Pythonin site-moduulien lataaminen ei onnistunut."
#~ msgid ""
-#~ "\n"
-#~ "Cannot fork\n"
+#~ "E263: Sorry, this command is disabled, the Python library could not be "
+#~ "loaded."
+#~ msgstr "E263: komento ei toimi, Python-kirjaston lataaminen ei onnistunut."
+
+#~ msgid "E836: This Vim cannot execute :python after using :py3"
#~ msgstr ""
-#~ "\n"
-#~ "Ei voi haarauttaa\n"
+#~ "E836: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa"
+
+#~ msgid "not allowed in the Vim sandbox"
+#~ msgstr "ei sallittu Vimin hiekkalaatikossa"
+
+#~ msgid "linenr out of range"
+#~ msgstr "rivinumero arvoalueen ulkopuolelta"
+
+#~ msgid "window is invalid"
+#~ msgstr "ikkuna on virheellinen"
+
+#~ msgid "buffer is invalid"
+#~ msgstr "puskuri on virheellinen"
+
+#~ msgid "Vim error"
+#~ msgstr "Vim-virhe"
+
+#~ msgid "Vim error: ~a"
+#~ msgstr "Vim-virhe: ~a"
+
+#~ msgid "couldn't open buffer"
+#~ msgstr "ei voitu avata puskuria"
+
+#~ msgid "unknown option"
+#~ msgstr "tuntematon asetus"
+
+#~ msgid "hidden option"
+#~ msgstr "piilotettu asetus"
+
+#~ msgid "expressions disabled at compile time"
+#~ msgstr "ilmaukset poistettu käytöstä käännösaikana"
+
+#~ msgid "invalid expression"
+#~ msgstr "virheellinen ilmaus"
#~ msgid ""
-#~ "\n"
-#~ "Command terminated\n"
+#~ "E895: Sorry, this command is disabled, the MzScheme's racket/base module "
+#~ "could not be loaded."
#~ msgstr ""
-#~ "\n"
-#~ "Komento loppui\n"
+#~ "E895: Komento ei toimi, MzScheme-moduulia racket/base ei voitu ladata."
-#~ msgid "XSMP lost ICE connection"
-#~ msgstr "XSMP kadotti ICE-yhteyden"
+#~ msgid ""
+#~ "E815: Sorry, this command is disabled, the MzScheme libraries could not "
+#~ "be loaded."
+#~ msgstr "E815: komento ei toimi, MzScheme-kirjastoa ei voitu ladata."
-#~ msgid "Opening the X display failed"
-#~ msgstr "X-nytn avaus eponnistui"
+#~ msgid "Lua library cannot be loaded."
+#~ msgstr "Luan kirjastoa ei voitu ladata."
-#~ msgid "XSMP handling save-yourself request"
-#~ msgstr "XSMP ksittelee save-yourself-pyynt"
+#~ msgid "E626: cannot get cscope database information"
+#~ msgstr "E626: ei voi hakea cscope-tietokannan tietoja"
-#~ msgid "XSMP opening connection"
-#~ msgstr "XSMP avaa yhteytt"
+#~ msgid "E625: cannot open cscope database: %s"
+#~ msgstr "E625: ei voi avata cscope-tietokantaa: %s"
-#~ msgid "XSMP ICE connection watch failed"
-#~ msgstr "XSMP:n ICE-yhteyden tarkkailu eponnistui"
+#~ msgid "E563: stat error"
+#~ msgstr "E563: stat-virhe"
-#~ msgid "XSMP SmcOpenConnection failed: %s"
-#~ msgstr "XSMP SmcOpenConnection eponnistui: %s"
+#~ msgid "E256: Hangul automata ERROR"
+#~ msgstr "E256: Hangu-automaattivirhe"
-#~ msgid "At line"
-#~ msgstr "Rivill"
+#~ msgid "Size:"
+#~ msgstr "Koko:"
-#~ msgid "Could not load vim32.dll!"
-#~ msgstr "Vim32.dll: ei voitu ladata"
+#~ msgid "Style:"
+#~ msgstr "Tyyli:"
-#~ msgid "VIM Error"
-#~ msgstr "VIM-virhe"
+#~ msgid "Font:"
+#~ msgstr "Fontti:"
-#~ msgid "Could not fix up function pointers to the DLL!"
-#~ msgstr "Ei voitu korjata funktio-osoittimia DLL:ss"
+#~ msgid "Encoding:"
+#~ msgstr "Koodaus:"
-#~ msgid "shell returned %d"
-#~ msgstr "kuori palautti arvon %d"
+#~ msgid "Show size in Points"
+#~ msgstr "Näytä koko pisteinä"
-#~ msgid "Vim: Caught %s event\n"
-#~ msgstr "Vim: Napattiin %s\n"
+#~ msgid "Name:"
+#~ msgstr "Nimi:"
-#~ msgid "close"
-#~ msgstr "sulkeminen"
+#~ msgid "Vim - Font Selector"
+#~ msgstr "Vim - fonttivalitsin"
-#~ msgid "logoff"
-#~ msgstr "uloskirjautuminen"
+#~ msgid "no specific match"
+#~ msgstr "ei tarkkaa täsmäystä"
-#~ msgid "shutdown"
-#~ msgstr "sammutus"
+#~ msgid "&Dismiss"
+#~ msgstr "&Ohita"
-#~ msgid "E371: Command not found"
-#~ msgstr "E371: Komentoa ei lydy"
+#~ msgid "Invalid font specification"
+#~ msgstr "Virheellinen fonttimääritys"
+
+#~ msgid "Font1 width: %ld"
+#~ msgstr "Fontti1:n leveys: %ld"
+
+#~ msgid "Font0 width: %ld"
+#~ msgstr "Fontti0:n leveys: %ld"
+
+#~ msgid "Font%ld width is not twice that of font0"
+#~ msgstr "Fontti%ld:n leveys ei ole kaksi kertaa fontti0:n"
+
+#~ msgid "Font1: %s"
+#~ msgstr "Fontti1: %s"
+
+#~ msgid "Font0: %s"
+#~ msgstr "Fontti0: %s"
+
+#~ msgid "E253: Fontset name: %s"
+#~ msgstr "E253: Fontsetin nimi: %s"
+
+#~ msgid "Font '%s' is not fixed-width"
+#~ msgstr "Fontti %s ei ole tasavälinen"
+
+#~ msgid "E252: Fontset name: %s"
+#~ msgstr "E252: Fontsetin nimi: %s"
+
+#~ msgid "E250: Fonts for the following charsets are missing in fontset %s:"
+#~ msgstr "E250: Seuraavien merkistöjoukkojen fontit puuttuvat fontsetistä %s:"
#~ msgid ""
-#~ "VIMRUN.EXE not found in your $PATH.\n"
-#~ "External commands will not pause after completion.\n"
-#~ "See :help win32-vimrun for more information."
+#~ "Vim E458: Cannot allocate colormap entry, some colors may be incorrect"
#~ msgstr ""
-#~ "VIMRUN.EXE ei lydy muuttujasta $PATH.\n"
-#~ "Ulkoiset komennot eivt pyshdy suorituksen lopussa.\n"
-#~ "Listietoja komennolla :help win32-vimrun"
+#~ "Vim E458: Ei voi varata värikartan alkiota, värit voivat mennä väärin"
-#~ msgid "Vim Warning"
-#~ msgstr "Vim-varoitus"
+# MDI eli windowsin moni-ikkunasovellus
+#~ msgid "E672: Unable to open window inside MDI application"
+#~ msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen"
-#~ msgid "Error file"
-#~ msgstr "Virhetiedosto"
+# OLE on object linking and embedding på windowska
+#~ msgid "E243: Argument not supported: \"-%s\"; Use the OLE version."
+#~ msgstr "E243: Argumenttia ei tueta: -%s, käytä OLE-versiota"
-#~ msgid "Conversion in %s not supported"
-#~ msgstr "Muutosta kohteessa %s ei tueta"
+#~ msgid "Directory\t*.nothing\n"
+#~ msgstr "Hakemisto\t*.nothing\n"
-#~ msgid "E430: Tag file path truncated for %s\n"
-#~ msgstr "E430: Tgitiedoston polku katkaistu kohdassa %s\n"
+#~ msgid "Not Used"
+#~ msgstr "Ei käytössä"
-#~ msgid "new shell started\n"
-#~ msgstr "uusi kuori avattu\n"
+#~ msgid "Find & Replace (use '\\\\' to find a '\\')"
+#~ msgstr "Etsi ja korvaa (\\\\:llä löytää \\:t)"
-#~ msgid "Used CUT_BUFFER0 instead of empty selection"
-#~ msgstr "Kytettiin CUT_BUFFER0:aa tyhjn valinnan sijaan"
+#~ msgid "Find string (use '\\\\' to find a '\\')"
+#~ msgstr "Etsi merkkijonoa (\\\\:llä löytää \\:t)"
-#~ msgid "No undo possible; continue anyway"
-#~ msgstr "Ei voi kumota, jatketaan silti"
+#~ msgid "Open tab..."
+#~ msgstr "Avaa välilehti..."
-#~ msgid "E832: Non-encrypted file has encrypted undo file: %s"
-#~ msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s"
+#~ msgid "&Undo"
+#~ msgstr "&Kumoa"
-#~ msgid "E826: Undo file decryption failed: %s"
-#~ msgstr "E826: Kumoustiedoston purku eponnistui: %s"
+#~ msgid "Replace &All"
+#~ msgstr "Korvaa k&aikki"
-#~ msgid "E827: Undo file is encrypted: %s"
-#~ msgstr "E827: Kumoustiedosto on salattu: %s"
+#~ msgid "&Replace"
+#~ msgstr "Ko&rvaa"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 16/32-bit GUI version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 16- t. 32-bittinen GUI-versio"
+#~ msgid "Find &Next"
+#~ msgstr "Hae &seuraava"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 64-bit GUI version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 64-bittinen GUI-versio"
+#~ msgid "Selection"
+#~ msgstr "Valinta"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 32-bit GUI version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 32-bittinen GUI-version"
+#~ msgid "&OK"
+#~ msgstr "&Ok"
-#~ msgid " in Win32s mode"
-#~ msgstr " Win32s-tilassa"
+#~ msgid "Files"
+#~ msgstr "Tiedostot"
-#~ msgid " with OLE support"
-#~ msgstr " OLE-tuella"
+#~ msgid "&Help"
+#~ msgstr "O&hje"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 64-bit console version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 32-bittinen konsoliversio"
+#~ msgid "Filter"
+#~ msgstr "Suodatus"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 32-bit console version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 32-bittinen konsoliversio"
+#~ msgid "Directories"
+#~ msgstr "Hakemistot"
-#~ msgid ""
-#~ "\n"
-#~ "MS-Windows 16-bit version"
-#~ msgstr ""
-#~ "\n"
-#~ "MS-Windows 16-bittinen versio"
+#~ msgid "&Cancel"
+#~ msgstr "&Peru"
-#~ msgid ""
-#~ "\n"
-#~ "32-bit MS-DOS version"
-#~ msgstr ""
-#~ "\n"
-#~ "32-bittinen MS-DOS-versio"
+#~ msgid "&Filter"
+#~ msgstr "&Suodata"
-#~ msgid ""
-#~ "\n"
-#~ "16-bit MS-DOS version"
-#~ msgstr ""
-#~ "\n"
-#~ "16-bittinen MS-DOS-versio"
+#~ msgid "Vim: Main window unexpectedly destroyed\n"
+#~ msgstr "Vim: Pääikkuna tuhoutui odottamatta\n"
-#~ msgid ""
-#~ "\n"
-#~ "MacOS X (unix) version"
-#~ msgstr ""
-#~ "\n"
-#~ "MacOS X-version (unix)"
+#~ msgid "Open Tab..."
+#~ msgstr "Avaa välilehti..."
-#~ msgid ""
-#~ "\n"
-#~ "MacOS X version"
-#~ msgstr ""
-#~ "\n"
-#~ "MacOS X-version"
+#~ msgid "New tab"
+#~ msgstr "Uusi välilehti"
-#~ msgid ""
-#~ "\n"
-#~ "MacOS version"
-#~ msgstr ""
-#~ "\n"
-#~ "MacOS-version"
+#~ msgid "Close tab"
+#~ msgstr "Sulje välilehti"
-#~ msgid ""
-#~ "\n"
-#~ "RISC OS version"
-#~ msgstr ""
-#~ "\n"
-#~ "RISC OS-version"
+#~ msgid "Vim: Received \"die\" request from session manager\n"
+#~ msgstr "Vim: sessiomanageri lähetti die-pyynnön\n"
-#~ msgid ""
-#~ "\n"
-#~ "OpenVMS version"
-#~ msgstr ""
-#~ "\n"
-#~ "OpenVMS-version"
+#~ msgid "_Close"
+#~ msgstr "_Sulje"
-#~ msgid ""
-#~ "\n"
-#~ "Big version "
-#~ msgstr ""
-#~ "\n"
-#~ "Big-version "
+#~ msgid "Replace All"
+#~ msgstr "Korvaa kaikki"
-#~ msgid ""
-#~ "\n"
-#~ "Normal version "
-#~ msgstr ""
-#~ "\n"
-#~ "Normal-versio "
+#~ msgid "Replace"
+#~ msgstr "Korvaa"
-#~ msgid ""
-#~ "\n"
-#~ "Small version "
-#~ msgstr ""
-#~ "\n"
-#~ "Small-versio "
+#~ msgid "Find Next"
+#~ msgstr "Etsi seuraava"
-#~ msgid ""
-#~ "\n"
-#~ "Tiny version "
-#~ msgstr ""
-#~ "\n"
-#~ "Tiny-versio "
+#~ msgid "Down"
+#~ msgstr "Alas"
-#~ msgid "with GTK2-GNOME GUI."
-#~ msgstr "GTK2-Gnome-GUIlla."
+#~ msgid "Up"
+#~ msgstr "Ylös"
-#~ msgid "with GTK2 GUI."
-#~ msgstr "GTK2-GUIlla."
+#~ msgid "Direction"
+#~ msgstr "Suunta"
-#~ msgid "with X11-Motif GUI."
-#~ msgstr "X11-Motif-GUIlla."
+#~ msgid "Match case"
+#~ msgstr "Kirjaintaso"
-#~ msgid "with X11-neXtaw GUI."
-#~ msgstr "X11-neXtaw-GUIlla."
+#~ msgid "Match whole word only"
+#~ msgstr "Korvaa kokonaisia sanoja"
-#~ msgid "with X11-Athena GUI."
-#~ msgstr "X11-Athena-GUIlla."
+#~ msgid "Replace with:"
+#~ msgstr "Korvaa:"
-#~ msgid "with Photon GUI."
-#~ msgstr "Photon-GUIlla."
+#~ msgid "Find what:"
+#~ msgstr "Etsi:"
-#~ msgid "with GUI."
-#~ msgstr "GUIlla."
+#~ msgid "VIM - Search..."
+#~ msgstr "VIM - Etsi..."
-#~ msgid "with Carbon GUI."
-#~ msgstr "Carbon-GUIlla."
+#~ msgid "VIM - Search and Replace..."
+#~ msgstr "VIM - Etsi ja korvaa..."
-#~ msgid "with Cocoa GUI."
-#~ msgstr "Cocoa-GUIlla."
+#~ msgid "Input _Methods"
+#~ msgstr "Syöte_menetelmät"
-#~ msgid "with (classic) GUI."
-#~ msgstr "perinteisell GUIlla."
+#~ msgid "No"
+#~ msgstr "Ei"
-#~ msgid " system gvimrc file: \""
-#~ msgstr " jrjestelmn gvimrc: \""
+#~ msgid "Yes"
+#~ msgstr "Kyllä"
-#~ msgid " user gvimrc file: \""
-#~ msgstr " kyttjn gvimrc: \""
+#~ msgid "_OK"
+#~ msgstr "_OK"
-#~ msgid "2nd user gvimrc file: \""
-#~ msgstr "2. kyttjn gvimrc: \""
+#~ msgid "_Open"
+#~ msgstr "_Avaa"
-#~ msgid "3rd user gvimrc file: \""
-#~ msgstr "3. kyttjn gvimrc: \""
+#~ msgid "_Save"
+#~ msgstr "_Tallenna"
-#~ msgid " system menu file: \""
-#~ msgstr " jrjestelmvalikko: \""
+#~ msgid "_Cancel"
+#~ msgstr "_Peru"
-#~ msgid "Compiler: "
-#~ msgstr "Knnin: "
+#~ msgid "E232: Cannot create BalloonEval with both message and callback"
+#~ msgstr "E232: Ei voi luoda BalloonEvalia viestille ja callbackille"
-#~ msgid "menu Help->Orphans for information "
-#~ msgstr "valikko Ohje->Orvot listietoja varten "
+#~ msgid "Vim dialog"
+#~ msgstr "Vim-ikkuna"
-#~ msgid "Running modeless, typed text is inserted"
-#~ msgstr "Suoritetaan tilattomana, kirjoitettu teksti sytetn"
+#~ msgid "Scrollbar Widget: Could not get geometry of thumb pixmap."
+#~ msgstr "Vierityspalkki: Pixmapin geometria ei selviä"
-#~ msgid "menu Edit->Global Settings->Toggle Insert Mode "
-#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda sytetilaa"
+#~ msgid "Cancel"
+#~ msgstr "Peru"
-#~ msgid " for two modes "
-#~ msgstr " kahta tilaa varten "
+#~ msgid "OK"
+#~ msgstr "OK"
-#~ msgid "menu Edit->Global Settings->Toggle Vi Compatible"
-#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda Vi-yhteensopivuutta"
+#~ msgid "E615: vim_SelFile: can't get current directory"
+#~ msgstr "E615: vim_SelFile: nykyistä hakemistoa ei saada selville"
-#~ msgid " for Vim defaults "
-#~ msgstr " Vim-oletuksia varten"
+#~ msgid "Pathname:"
+#~ msgstr "Polku:"
-#~ msgid "WARNING: Windows 95/98/ME detected"
-#~ msgstr "VAROITUS: Window 95/98/ME havaittu"
+#~ msgid "E614: vim_SelFile: can't return to current directory"
+#~ msgstr "E614: vim_SelFile: nykyiseen hakemistoon ei voi palata"
-#~ msgid "type :help windows95<Enter> for info on this"
-#~ msgstr "kirjoita :help windows95<Enter> listietoja varten"
+#~ msgid "E616: vim_SelFile: can't get font %s"
+#~ msgstr "E616: vim_SelFile: ei saada fonttia %s"
-#~ msgid "E370: Could not load library %s"
-#~ msgstr "E370: Kirjaston %s lataaminen ei onnistu"
+#~ msgid "<cannot open> "
+#~ msgstr "<ei voi avata> "
+
+#~ msgid "No match at cursor, finding next"
+#~ msgstr "Ei täsmäystä kursorin alla, etsitään seuraava"
+
+#~ msgid "E599: Value of 'imactivatekey' is invalid"
+#~ msgstr "E599: imactivatekeyn arvo on virheellinen"
+
+#~ msgid "E231: 'guifontwide' invalid"
+#~ msgstr "E231: guifontwide virheellinen"
+
+#~ msgid "E665: Cannot start GUI, no valid font found"
+#~ msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei löydy"
+
+#~ msgid "E230: Cannot read from \"%s\""
+#~ msgstr "E230: Ei voi lukea kohteesta %s"
+
+#~ msgid "E229: Cannot start the GUI"
+#~ msgstr "E229: GUIn käynnistys ei onnistu"
+
+#~ msgid "E851: Failed to create a new process for the GUI"
+#~ msgstr "E851: Ei voitu luoda uutta prosessia käyttöliittymälle"
+
+# tietääkseni resurssiforkki on applen tiedostojärjestelmän tunnistejuttujuttu
+#~ msgid "E460: The resource fork would be lost (add ! to override)"
+#~ msgstr "E460: resurssiosa häviäisi (lisää komentoon ! ohittaaksesi)"
+
+#~ msgid "writing to device disabled with 'opendevice' option"
+#~ msgstr "laitteeseen kirjoittaminen pois käytöstä opendevice-asetuksella"
+
+#~ msgid "Partial writes disallowed for NetBeans buffers"
+#~ msgstr "Osittaiset kirjoitukset kielletty NetBeans-puskureissa"
+
+#~ msgid "NetBeans disallows writes of unmodified buffers"
+#~ msgstr "NetBeans ei salli kirjoittaa muokkaamattomiin puskureihin"
+
+#~ msgid "Reading from stdin..."
+#~ msgstr "Luetaan vakiosyötteestä"
+
+#~ msgid "Vim: Reading from stdin...\n"
+#~ msgstr "Vim: Luetaan vakiosyötteestä...\n"
+
+#~ msgid "is a device (disabled with 'opendevice' option)"
+#~ msgstr "on laite (ei käytössä opendevice-asetuksen takia)"
+
+#~ msgid "Debug Line"
+#~ msgstr "Vianetsintärivi"
+
+#~ msgid "Input Line"
+#~ msgstr "Syöterivi"
+
+#~ msgid "Expression"
+#~ msgstr "Ilmaus"
+
+#~ msgid "Search String"
+#~ msgstr "Hakujono"
+
+#~ msgid "Command Line"
+#~ msgstr "Komentorivi"
#~ msgid ""
-#~ "Sorry, this command is disabled: the Perl library could not be loaded."
-#~ msgstr "Sori, komento ei toimi, Perl kirjastoa ei voinut ladata."
+#~ "\n"
+#~ "# %s History (newest to oldest):\n"
+#~ msgstr ""
+#~ "\n"
+#~ "# %s Historia (uusimmasta alkaen):\n"
-#~ msgid "E299: Perl evaluation forbidden in sandbox without the Safe module"
-#~ msgstr "E299: Perl-suoritus kielletty hiekkalaatikossa ilman Safe-moduulia"
+#~ msgid "E196: No digraphs in this version"
+#~ msgstr "E196: Digraafeja ei ole tässä versiossa"
-#~ msgid "Edit with &multiple Vims"
-#~ msgstr "&Muokkaa usealla Vimill"
+#~ msgid "E195: Cannot open viminfo file for reading"
+#~ msgstr "E195: Viminfoa ei voi avata lukemista varten"
-#~ msgid "Edit with single &Vim"
-#~ msgstr "Muokkaa yhdell &Vimill"
+#~ msgid "E809: #< is not available without the +eval feature"
+#~ msgstr "E809: #< ei ole käytössä jollei +eval ole päällä"
-#~ msgid "Diff with Vim"
-#~ msgstr "Diffi Vimill"
+#~ msgid "Save Setup"
+#~ msgstr "Tallenna asetukset"
-#~ msgid "Edit with &Vim"
-#~ msgstr "Muokkaa &Vimill"
+#~ msgid "Save Session"
+#~ msgstr "Tallenna sessio"
-#~ msgid "Edit with existing Vim - "
-#~ msgstr "Muokkaa olemassaolevalla Vimill - "
+#~ msgid "Save View"
+#~ msgstr "Tallenna näkymä"
-#~ msgid "Edits the selected file(s) with Vim"
-#~ msgstr "Muokkaa valittuja tiedostoja Vimill"
+#~ msgid "Save Redirection"
+#~ msgstr "Tallenna uudelleenosoitus"
-#~ msgid "Error creating process: Check if gvim is in your path!"
-#~ msgstr "Virhe prosessin kynnistmisess, varmista ett gvim on polulla"
+#~ msgid "E930: Cannot use :redir inside execute()"
+#~ msgstr "E930: Komentoa :redir ei voi käyttää funktion execute() sisällä"
-#~ msgid "gvimext.dll error"
-#~ msgstr "gvimext.dll-virhe"
+#~ msgid "E466: :winpos requires two number arguments"
+#~ msgstr "E466: :winpos vaatii kaksi lukuargumenttia"
-#~ msgid "Path length too long!"
-#~ msgstr "Liian pitk polku"
+#~ msgid "E188: Obtaining window position not implemented for this platform"
+#~ msgstr "E188: Ikkunan sijainnin selvitys ei toimi tällä alustalla"
-#~ msgid "E234: Unknown fontset: %s"
-#~ msgstr "E234: Tuntematon fontset: %s"
+#~ msgid "Window position: X %d, Y %d"
+#~ msgstr "Ikkunan sijainti: X %d, Y %d"
-#~ msgid "E235: Unknown font: %s"
-#~ msgstr "E235: Tuntematon fontti: %s"
+#~ msgid ""
+#~ "E747: Cannot change directory, buffer is modified (add ! to override)"
+#~ msgstr ""
+#~ "E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lisää "
+#~ "komentoon ! ohittaaksesi"
-#~ msgid "E236: Font \"%s\" is not fixed-width"
-#~ msgstr "E236: Fontti %s ei ole tasavlinen"
+#~ msgid "Append File"
+#~ msgstr "Lisää tiedostoon"
-#~ msgid "E448: Could not load library function %s"
-#~ msgstr "E448: Ei voitu ladta kirjastofunktiota %s"
+#~ msgid "Edit File in new window"
+#~ msgstr "Muokkaa uudessa ikkunassa"
-#~ msgid "E26: Hebrew cannot be used: Not enabled at compile time\n"
-#~ msgstr "E26: Hepreaa ei voi kytt, koska sit ei knnetty mukaan\n"
+#~ msgid "unknown"
+#~ msgstr "tuntematon"
-#~ msgid "E27: Farsi cannot be used: Not enabled at compile time\n"
-#~ msgstr "E27: Farsia ei voi kytt, koska sit ei knnetty mukaan\n"
+#~ msgid "E172: Only one file name allowed"
+#~ msgstr "E172: Vain yksi tiedostonimi sallitaan"
-#~ msgid "E800: Arabic cannot be used: Not enabled at compile time\n"
-#~ msgstr "E800: Arabiaa ei voi kytt, koska sit ei knnetty mukaan\n"
+#~ msgid "Source Vim script"
+#~ msgstr "Lataa vim-skripti"
-#~ msgid "E247: no registered server named \"%s\""
-#~ msgstr "E247: palvelinta %s ei ole rekisterityn"
+#~ msgid " (NOT FOUND)"
+#~ msgstr " (EI LÖYTYNYT)"
-#~ msgid "E233: cannot open display"
-#~ msgstr "E233: nytt ei voi avata"
+#~ msgid ""
+#~ "\n"
+#~ "# Last Substitute String:\n"
+#~ "$"
+#~ msgstr ""
+#~ "\n"
+#~ "# Viimeisin korvausmerkkijono:\n"
+#~ "$"
-#~ msgid "E449: Invalid expression received"
-#~ msgstr "E449: Virheellinen ilmaus saatu"
+#~ msgid "Edit File"
+#~ msgstr "Muokkaa tiedostoa"
-#~ msgid "E463: Region is guarded, cannot modify"
-#~ msgstr "E463: Alue on suojattu, muuttaminen ei onnistu"
+#~ msgid "Save As"
+#~ msgstr "Tallenna nimellä"
-#~ msgid "E744: NetBeans does not allow changes in read-only files"
-#~ msgstr "E744: NetBeans ei tue muutoksia kirjoitussuojattuihin tiedostoihin"
+#~ msgid ""
+#~ "\n"
+#~ "# Bar lines, copied verbatim:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "# Bar-rivit, kopiotu sellaisenaan:\n"
-#~ msgid "Need encryption key for \"%s\""
-#~ msgstr "Tarvitaan salausavain kohteelle %s "
+#~ msgid "Illegal starting char"
+#~ msgstr "Virheellinen aloitusmerkki"
-#~ msgid "writelines() requires list of strings"
-#~ msgstr "writelines()-komennolle pit antaa merkkijonolista"
+#~ msgid "# Value of 'encoding' when this file was written\n"
+#~ msgstr "# encoding-muuttujan arvo tiedostoa kirjoitettaessa\n"
-#~ msgid "E264: Python: Error initialising I/O objects"
-#~ msgstr "E264: Python: Virhe IO-olioiden alustuksessa"
+#~ msgid ""
+#~ "# You may edit it if you're careful!\n"
+#~ "\n"
+#~ msgstr ""
+#~ "# Muokkaa varovasti!\n"
+#~ "\n"
-#~ msgid "no such buffer"
-#~ msgstr "puskuria ei ole"
+#~ msgid "# This viminfo file was generated by Vim %s.\n"
+#~ msgstr "# Vimin %s generoima viminfo-tiedosto.\n"
-#~ msgid "attempt to refer to deleted window"
-#~ msgstr "yritettiin viitata poistettuun ikkunaan"
+#~ msgid "E138: Can't write viminfo file %s!"
+#~ msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s"
-#~ msgid "readonly attribute"
-#~ msgstr "kirjoitussuojattu attribuutti"
+#~ msgid "E929: Too many viminfo temp files, like %s!"
+#~ msgstr "E929: liikaa viminfo-väliaikaistiedostoja, kuten %s."
-#~ msgid "cursor position outside buffer"
-#~ msgstr "kursorin sijainti puskurin ulkopuolella"
+#~ msgid "E136: viminfo: Too many errors, skipping rest of file"
+#~ msgstr "E136: viminfo: liikaa virheitä, ohitetaan lopputiedosto"
-#~ msgid "<window object (deleted) at %p>"
-#~ msgstr "<ikkunaolio (poistettu) kohdassa %p>"
+#~ msgid "%sviminfo: %s in line: "
+#~ msgstr "%sviminfo: %s rivillä: "
-#~ msgid "<window object (unknown) at %p>"
-#~ msgstr "<ikkunaolio (tuntematon) kohdassa %p>"
+#~ msgid "E258: Unable to send to client"
+#~ msgstr "E258: Asiakkaalle lähetys ei onnistunut"
-#~ msgid "<window %d>"
-#~ msgstr "<ikkuna %d>"
+#~ msgid "E277: Unable to read a server reply"
+#~ msgstr "E277: Palvelimen vastauksen lukeminen ei onnistunut"
-#~ msgid "no such window"
-#~ msgstr "ikkunaa ei ole"
+#~ msgid "E240: No connection to Vim server"
+#~ msgstr "E240: Ei yhteyttä vim-palvelimeen"
-#~ msgid "attempt to refer to deleted buffer"
-#~ msgstr "yritettiin viitata poistettuun puskuriin"
+#~ msgid ""
+#~ "&OK\n"
+#~ "&Cancel"
+#~ msgstr ""
+#~ "&OK\n"
+#~ "&Peru"
+
+#~ msgid ""
+#~ "\n"
+#~ "# global variables:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "# globaalit muuttujat:\n"
+
+#~ msgid "E729: using Funcref as a String"
+#~ msgstr "E729: Funcref ei käy merkkijonosta"
+
+#~ msgid "E914: Using a Channel as a Float"
+#~ msgstr "E914: Käytettiin Channelia Floattina"
+
+#~ msgid "E911: Using a Job as a Float"
+#~ msgstr "E911: Job ei käy Floatista"
+
+#~ msgid "E913: Using a Channel as a Number"
+#~ msgstr "E913: Channel ei käy Numberista"
+
+#~ msgid "E910: Using a Job as a Number"
+#~ msgstr "E910: Job ei käy Numberista"
+
+#~ msgid "E703: Using a Funcref as a Number"
+#~ msgstr "E703: Funcref ei käy Numberista"
+
+#~ msgid "E724: variable nested too deep for displaying"
+#~ msgstr "E724: muuttuja on upotettu liian syvälle näytettäväksi"
+
+#~ msgid "Patch file"
+#~ msgstr "Patch-tiedosto"
+
+#~ msgid "[crypted]"
+#~ msgstr "[salattu]"
+
+#~ msgid "Keys don't match!"
+#~ msgstr "Avaimet eivät täsmää!"
-# New Line eli uusi rivinvaihtomerkki (ei CR, LF tai CR LF)
-#~ msgid "[NL found]"
-#~ msgstr "[NL puuttuu]"
+#~ msgid "Enter same key again: "
+#~ msgstr "Anna sama avain uudestaan: "
-#~ msgid "Vim dialog..."
-#~ msgstr "Vim-ikkuna..."
+#~ msgid "Enter encryption key: "
+#~ msgstr "Anna salausavain: "
-#~ msgid "Font Selection"
-#~ msgstr "Fontin valinta"
+#~ msgid "Warning: Using a weak encryption method; see :help 'cm'"
+#~ msgstr "Varoitus: Käytetään heikkoa salausmenetelmää, ks. :help 'cm'"
-#~ msgid "E569: maximum number of cscope connections reached"
-#~ msgstr "E569: enimmismr cscope-yhteyksi otettu"
+#~ msgid "E821: File is encrypted with unknown method"
+#~ msgstr "E821: Tiedoston salaus on tuntematon"
+
+#~ msgid "E918: buffer must be loaded: %s"
+#~ msgstr "E918: puskuria ei voi ladata: %s"
+
+#~ msgid "E915: in_io buffer requires in_buf or in_name to be set"
+#~ msgstr "E915: in_io-puskurilla pitää olla in_buf tai in_name asetettu"
-#~ msgid "-name <name>\t\tUse resource as if vim was <name>"
-#~ msgstr "-name <nimi>\t\tKyt resurssia vim <nimen>"
+#~ msgid "E920: _io file requires _name to be set"
+#~ msgstr "E920: _io-tiedostolla pitää olla _name asetettu"
-#~ msgid "\t\t\t (Unimplemented)\n"
-#~ msgstr "\t\t\t (toteuttamatta)\n"
+#~ msgid "E906: not an open channel"
+#~ msgstr "E906: ei ole avoin kanava"
+
+#~ msgid ""
+#~ "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel"
+#~ msgstr ""
+#~ "E912: ei voida käyttää funktioita ch_evalexpr(), ch_sendexpr() raa'an tai "
+#~ "nl-kanavan kanssa"
-#~ msgid "E290: over-the-spot style requires fontset"
-#~ msgstr "E290: over-the-spot-tyyliss pit olla fontset"
+#~ msgid "E917: Cannot use a callback with %s()"
+#~ msgstr "E917: Ei voitu käyttää callbackia %s()"
-#~ msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled"
-#~ msgstr "E291: GTK+-versio vanhempi kuin 1.2.3: Tila-alue poistettu kytst"
+#~ msgid ""
+#~ "\n"
+#~ "# Buffer list:\n"
+#~ msgstr ""
+#~ "\n"
+#~ "# Puskuriluettelo:\n"
-#~ msgid "E292: Input Method Server is not running"
-#~ msgstr "E292: Sytemetodipalvelin ei ole kynniss"
+#~ msgid "E931: Buffer cannot be registered"
+#~ msgstr "E931: Puskuria ei voi rekisteröidä"
-#~ msgid "E396: containedin argument not accepted here"
-#~ msgstr "E396: containedin ei sovi thn"
+#~ msgid "E819: Blowfish test failed"
+#~ msgstr "E819: Blowfish-testi epäonnistui"
-#~ msgid "with GTK-GNOME GUI."
-#~ msgstr "GTK-Gnome-GUIlla."
+#~ msgid "E818: sha256 test failed"
+#~ msgstr "E818: sha256-testi epäonnistui failed"
-#~ msgid "with GTK GUI."
-#~ msgstr "GTK-GUIlla."
+#~ msgid "E817: Blowfish big/little endian use wrong"
+#~ msgstr "E817: Blowfishin tavujärjestys väärä"
-#~ msgid "-V[N]\t\tVerbose level"
-#~ msgstr "-V[N]\t\tMonisanaisuustaso"
+#~ msgid "E820: sizeof(uint32_t) != 4"
+#~ msgstr "E820: sizeof(uint32_t) != 4"
-#~ msgid "...(truncated)"
-#~ msgstr "...(katkaistu)"
+#~ msgid "E831: bf_key_init() called with empty password"
+#~ msgstr "E831: bf_key_init() tyhjällä salasanalla"
diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po
index cff140508b..2c203f808f 100644
--- a/src/nvim/po/uk.po
+++ b/src/nvim/po/uk.po
@@ -82,7 +82,7 @@ msgid "Key length is too high"
msgstr "Довжина ключа завелика"
#, c-format
-msgid "Key \"%s\" doesn't exist"
+msgid "Key does not exist: %s"
msgstr "Ключ «%s» не існує"
msgid "Empty option name"
@@ -3719,7 +3719,7 @@ msgid "Calling shell to execute: \"%s\""
msgstr "Викликається оболонка щоб виконати: «%s»"
#, c-format
-msgid "Invalid channel \"%<PRIu64>\""
+msgid "Invalid channel: %<PRIu64>"
msgstr "Некоректний канал «%<PRIu64>»"
msgid "Message is not an array"
@@ -3734,7 +3734,7 @@ msgstr "Повідомлення має бути цілим числом"
msgid "Unknown message type"
msgstr "Невідомий тип повідомлення"
-msgid "Request array size should be 4 (request) or 3 (notification)"
+msgid "Request array size must be 4 (request) or 3 (notification)"
msgstr "Розмір масиву запиту має бути 4 (запит) чи 3 (повідомлення)"
msgid "ID must be a positive integer"
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 6346951c05..6e81c5a171 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file popupmnu.c
///
/// Popup menu (PUM)
diff --git a/src/nvim/profile.c b/src/nvim/profile.c
index 97d7d77359..8fb8e92add 100644
--- a/src/nvim/profile.c
+++ b/src/nvim/profile.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdio.h>
#include <math.h>
#include <assert.h>
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 4fa5c85abd..112498ae20 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* quickfix.c: functions for quickfix mode, using a file with error messages
*/
@@ -856,7 +859,7 @@ restofline:
if (fmt_ptr == NULL) {
qi->qf_multiline = qi->qf_multiignore = false;
}
- } else if (fmt_ptr != NULL) {
+ } else {
// honor %> item
if (fmt_ptr->conthere) {
fmt_start = fmt_ptr;
@@ -984,7 +987,7 @@ qf_init_ext(
}
// Use the local value of 'errorformat' if it's set.
- if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) {
+ if (errorformat == p_efm && tv == NULL && buf && *buf->b_p_efm != NUL) {
efm = buf->b_p_efm;
} else {
efm = errorformat;
@@ -3284,7 +3287,6 @@ void ex_cc(exarg_T *eap)
|| eap->cmdidx == CMD_lrewind
|| eap->cmdidx == CMD_lfirst
|| eap->cmdidx == CMD_llast
- || eap->cmdidx == CMD_llast
|| eap->cmdidx == CMD_ldo
|| eap->cmdidx == CMD_lfdo) {
qi = GET_LOC_LIST(curwin);
@@ -3341,7 +3343,6 @@ void ex_cnext(exarg_T *eap)
|| eap->cmdidx == CMD_lnfile
|| eap->cmdidx == CMD_lNfile
|| eap->cmdidx == CMD_lpfile
- || eap->cmdidx == CMD_lpfile
|| eap->cmdidx == CMD_ldo
|| eap->cmdidx == CMD_lfdo) {
qi = GET_LOC_LIST(curwin);
diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c
index 111af0d0fb..18d453cbe9 100644
--- a/src/nvim/rbuffer.c
+++ b/src/nvim/rbuffer.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stddef.h>
#include <string.h>
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 9baa53d2a2..7a00ee27bb 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* Handling of regular expressions: vim_regcomp(), vim_regexec(), vim_regsub()
*
@@ -2350,7 +2353,7 @@ collection:
break;
case CLASS_LOWER:
for (cu = 1; cu <= 255; cu++) {
- if (vim_islower(cu) && cu != 170 && cu != 186) {
+ if (mb_islower(cu) && cu != 170 && cu != 186) {
regmbc(cu);
}
}
@@ -2376,7 +2379,7 @@ collection:
break;
case CLASS_UPPER:
for (cu = 1; cu <= 255; cu++) {
- if (vim_isupper(cu)) {
+ if (mb_isupper(cu)) {
regmbc(cu);
}
}
@@ -2398,7 +2401,7 @@ collection:
regc('\b');
break;
case CLASS_ESCAPE:
- regc('\033');
+ regc(ESC);
break;
}
} else {
@@ -2923,13 +2926,8 @@ static void skipchr(void)
else
prevchr_len = 0;
if (regparse[prevchr_len] != NUL) {
- if (enc_utf8)
- /* exclude composing chars that mb_ptr2len does include */
- prevchr_len += utf_ptr2len(regparse + prevchr_len);
- else if (has_mbyte)
- prevchr_len += (*mb_ptr2len)(regparse + prevchr_len);
- else
- ++prevchr_len;
+ // Exclude composing chars that utfc_ptr2len does include.
+ prevchr_len += utf_ptr2len(regparse + prevchr_len);
}
regparse += prevchr_len;
prev_at_start = at_start;
@@ -3052,7 +3050,7 @@ static int getoctchrs(void)
int c;
int i;
- for (i = 0; i < 3 && nr < 040; ++i) {
+ for (i = 0; i < 3 && nr < 040; i++) { // -V536
c = regparse[0];
if (c < '0' || c > '7')
break;
@@ -3474,7 +3472,7 @@ static long bt_regexec_both(char_u *line,
|| (ireg_ic
&& (((enc_utf8 && utf_fold(prog->regstart) == utf_fold(c)))
|| (c < 255 && prog->regstart < 255
- && vim_tolower(prog->regstart) == vim_tolower(c))))) {
+ && mb_tolower(prog->regstart) == mb_tolower(c))))) {
retval = regtry(prog, col);
} else {
retval = 0;
@@ -4155,7 +4153,7 @@ regmatch (
if (*opnd != *reginput
&& (!ireg_ic
|| (!enc_utf8
- && vim_tolower(*opnd) != vim_tolower(*reginput)))) {
+ && mb_tolower(*opnd) != mb_tolower(*reginput)))) {
status = RA_NOMATCH;
} else if (*opnd == NUL) {
// match empty string always works; happens when "~" is
@@ -4573,12 +4571,14 @@ regmatch (
if (OP(next) == EXACTLY) {
rst.nextb = *OPERAND(next);
if (ireg_ic) {
- if (vim_isupper(rst.nextb))
- rst.nextb_ic = vim_tolower(rst.nextb);
- else
- rst.nextb_ic = vim_toupper(rst.nextb);
- } else
+ if (mb_isupper(rst.nextb)) {
+ rst.nextb_ic = mb_tolower(rst.nextb);
+ } else {
+ rst.nextb_ic = mb_toupper(rst.nextb);
+ }
+ } else {
rst.nextb_ic = rst.nextb;
+ }
} else {
rst.nextb = NUL;
rst.nextb_ic = NUL;
@@ -5339,8 +5339,8 @@ do_class:
* would have been used for it. It does handle single-byte
* characters, such as latin1. */
if (ireg_ic) {
- cu = vim_toupper(*opnd);
- cl = vim_tolower(*opnd);
+ cu = mb_toupper(*opnd);
+ cl = mb_tolower(*opnd);
while (count < maxcount && (*scan == cu || *scan == cl)) {
count++;
scan++;
@@ -6312,14 +6312,15 @@ static char_u *cstrchr(char_u *s, int c)
/* tolower() and toupper() can be slow, comparing twice should be a lot
* faster (esp. when using MS Visual C++!).
* For UTF-8 need to use folded case. */
- if (enc_utf8 && c > 0x80)
+ if (c > 0x80) {
cc = utf_fold(c);
- else if (vim_isupper(c))
- cc = vim_tolower(c);
- else if (vim_islower(c))
- cc = vim_toupper(c);
- else
+ } else if (mb_isupper(c)) {
+ cc = mb_tolower(c);
+ } else if (mb_islower(c)) {
+ cc = mb_toupper(c);
+ } else {
return vim_strchr(s, c);
+ }
if (has_mbyte) {
for (p = s; *p != NUL; p += (*mb_ptr2len)(p)) {
@@ -6348,28 +6349,28 @@ static char_u *cstrchr(char_u *s, int c)
static fptr_T do_upper(int *d, int c)
{
- *d = vim_toupper(c);
+ *d = mb_toupper(c);
return (fptr_T)NULL;
}
static fptr_T do_Upper(int *d, int c)
{
- *d = vim_toupper(c);
+ *d = mb_toupper(c);
return (fptr_T)do_Upper;
}
static fptr_T do_lower(int *d, int c)
{
- *d = vim_tolower(c);
+ *d = mb_tolower(c);
return (fptr_T)NULL;
}
static fptr_T do_Lower(int *d, int c)
{
- *d = vim_tolower(c);
+ *d = mb_tolower(c);
return (fptr_T)do_Lower;
}
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 5b49ab38f0..139772d51e 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* NFA regular expression implementation.
*
@@ -2772,15 +2775,10 @@ static int nfa_max_width(nfa_state_T *startstate, int depth)
case NFA_ANY:
case NFA_START_COLL:
case NFA_START_NEG_COLL:
- /* matches some character, including composing chars */
- if (enc_utf8)
- len += MB_MAXBYTES;
- else if (has_mbyte)
- len += 2;
- else
- ++len;
+ // Matches some character, including composing chars.
+ len += MB_MAXBYTES;
if (state->c != NFA_ANY) {
- /* skip over the characters */
+ // Skip over the characters.
state = state->out1->out;
continue;
}
@@ -4373,7 +4371,7 @@ static int check_char_class(int class, int c)
return OK;
break;
case NFA_CLASS_LOWER:
- if (vim_islower(c) && c != 170 && c != 186) {
+ if (mb_islower(c) && c != 170 && c != 186) {
return OK;
}
break;
@@ -4391,8 +4389,9 @@ static int check_char_class(int class, int c)
return OK;
break;
case NFA_CLASS_UPPER:
- if (vim_isupper(c))
+ if (mb_isupper(c)) {
return OK;
+ }
break;
case NFA_CLASS_XDIGIT:
if (ascii_isxdigit(c))
@@ -4411,8 +4410,9 @@ static int check_char_class(int class, int c)
return OK;
break;
case NFA_CLASS_ESCAPE:
- if (c == '\033')
+ if (c == ESC) {
return OK;
+ }
break;
default:
@@ -4892,7 +4892,7 @@ static long find_match_text(colnr_T startcol, int regstart, char_u *match_text)
int c2_len = PTR2LEN(s2);
int c2 = PTR2CHAR(s2);
- if ((c1 != c2 && (!ireg_ic || vim_tolower(c1) != vim_tolower(c2)))
+ if ((c1 != c2 && (!ireg_ic || mb_tolower(c1) != mb_tolower(c2)))
|| c1_len != c2_len) {
match = false;
break;
@@ -5585,22 +5585,24 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
break;
}
if (ireg_ic) {
- int curc_low = vim_tolower(curc);
- int done = FALSE;
+ int curc_low = mb_tolower(curc);
+ int done = false;
- for (; c1 <= c2; ++c1)
- if (vim_tolower(c1) == curc_low) {
+ for (; c1 <= c2; c1++) {
+ if (mb_tolower(c1) == curc_low) {
result = result_if_matched;
done = TRUE;
break;
}
- if (done)
+ }
+ if (done) {
break;
+ }
}
} else if (state->c < 0 ? check_char_class(state->c, curc)
: (curc == state->c
- || (ireg_ic && vim_tolower(curc)
- == vim_tolower(state->c)))) {
+ || (ireg_ic && mb_tolower(curc)
+ == mb_tolower(state->c)))) {
result = result_if_matched;
break;
}
@@ -6003,8 +6005,9 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
#endif
result = (c == curc);
- if (!result && ireg_ic)
- result = vim_tolower(c) == vim_tolower(curc);
+ if (!result && ireg_ic) {
+ result = mb_tolower(c) == mb_tolower(curc);
+ }
// If ireg_icombine is not set only skip over the character
// itself. When it is set skip over composing characters.
@@ -6152,8 +6155,8 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
// Checking if the required start character matches is
// cheaper than adding a state that won't match.
c = PTR2CHAR(reginput + clen);
- if (c != prog->regstart && (!ireg_ic || vim_tolower(c)
- != vim_tolower(prog->regstart))) {
+ if (c != prog->regstart && (!ireg_ic || mb_tolower(c)
+ != mb_tolower(prog->regstart))) {
#ifdef REGEXP_DEBUG
fprintf(log_fd,
" Skipping start state, regstart does not match\n");
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index cf460adb82..10dc86d5fa 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* screen.c: code for displaying on the screen
*
@@ -102,6 +105,7 @@
#include "nvim/indent.h"
#include "nvim/getchar.h"
#include "nvim/main.h"
+#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
@@ -1015,14 +1019,10 @@ static void win_update(win_T *wp)
linenr_T from, to;
if (VIsual_active) {
- if (VIsual_active
- && (VIsual_mode != wp->w_old_visual_mode
- || type == INVERTED_ALL)) {
- /*
- * If the type of Visual selection changed, redraw the whole
- * selection. Also when the ownership of the X selection is
- * gained or lost.
- */
+ if (VIsual_mode != wp->w_old_visual_mode || type == INVERTED_ALL) {
+ // If the type of Visual selection changed, redraw the whole
+ // selection. Also when the ownership of the X selection is
+ // gained or lost.
if (curwin->w_cursor.lnum < VIsual.lnum) {
from = curwin->w_cursor.lnum;
to = VIsual.lnum;
@@ -1687,7 +1687,7 @@ static int compute_foldcolumn(win_T *wp, int col)
*/
static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row)
{
- char_u buf[51];
+ char_u buf[FOLD_TEXT_LEN];
pos_T *top, *bot;
linenr_T lnume = lnum + fold_count - 1;
int len;
@@ -2448,7 +2448,7 @@ win_line (
} else {
/* Long line, use only the last SPWORDLEN bytes. */
nextlinecol = v - SPWORDLEN;
- memmove(nextline, line + nextlinecol, SPWORDLEN);
+ memmove(nextline, line + nextlinecol, SPWORDLEN); // -V512
nextline_idx = SPWORDLEN + 1;
}
}
@@ -2580,13 +2580,14 @@ win_line (
* Do this for both search_hl and the match list.
*/
cur = wp->w_match_head;
- shl_flag = FALSE;
- while (cur != NULL || shl_flag == FALSE) {
- if (shl_flag == FALSE) {
+ shl_flag = false;
+ while (cur != NULL || !shl_flag) {
+ if (!shl_flag) {
shl = &search_hl;
- shl_flag = TRUE;
- } else
- shl = &cur->hl;
+ shl_flag = true;
+ } else {
+ shl = &cur->hl; // -V595
+ }
shl->startcol = MAXCOL;
shl->endcol = MAXCOL;
shl->attr_cur = 0;
@@ -2784,8 +2785,8 @@ win_line (
// draw 'breakindent': indent wrapped text accodringly
if (draw_state == WL_BRI - 1 && n_extra == 0) {
draw_state = WL_BRI;
- if (wp->w_p_bri && n_extra == 0 && row != startrow && filler_lines == 0) {
- char_attr = 0; // was: hl_attr(HLF_AT);
+ if (wp->w_p_bri && row != startrow && filler_lines == 0) {
+ char_attr = 0; // was: hl_attr(HLF_AT);
if (diff_hlf != (hlf_T)0) {
char_attr = hl_attr(diff_hlf);
@@ -3409,7 +3410,7 @@ win_line (
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
n_attr = 1;
- extra_attr = hl_attr(HLF_8);
+ extra_attr = hl_attr(HLF_0);
saved_attr2 = char_attr; // save current attr
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
@@ -3424,7 +3425,7 @@ win_line (
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') {
c = lcs_trail;
n_attr = 1;
- extra_attr = hl_attr(HLF_8);
+ extra_attr = hl_attr(HLF_0);
saved_attr2 = char_attr; // save current attr
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
@@ -3525,8 +3526,8 @@ win_line (
c_extra = lcs_tab2;
}
n_attr = tab_len + 1;
- extra_attr = hl_attr(HLF_8);
- saved_attr2 = char_attr; /* save current attr */
+ extra_attr = hl_attr(HLF_0);
+ saved_attr2 = char_attr; // save current attr
mb_c = c;
if (enc_utf8 && (*mb_char2len)(c) > 1) {
mb_utf8 = TRUE;
@@ -5330,43 +5331,39 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
c = *ptr;
/* check if this is the first byte of a multibyte */
if (l_has_mbyte) {
- if (l_enc_utf8 && len > 0)
+ if (len > 0) {
mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
- else
- mbyte_blen = (*mb_ptr2len)(ptr);
- if (l_enc_dbcs == DBCS_JPNU && c == 0x8e)
- mbyte_cells = 1;
- else if (l_enc_dbcs != 0)
- mbyte_cells = mbyte_blen;
- else { /* enc_utf8 */
- if (len >= 0)
- u8c = utfc_ptr2char_len(ptr, u8cc,
- (int)((text + len) - ptr));
- else
- u8c = utfc_ptr2char(ptr, u8cc);
- mbyte_cells = utf_char2cells(u8c);
- if (p_arshape && !p_tbidi && arabic_char(u8c)) {
- /* Do Arabic shaping. */
- if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
- /* Past end of string to be displayed. */
- nc = NUL;
- nc1 = NUL;
- } else {
- nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
- (int)((text + len) - ptr - mbyte_blen));
- nc1 = pcc[0];
- }
- pc = prev_c;
- prev_c = u8c;
- u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
- } else
- prev_c = u8c;
- if (col + mbyte_cells > screen_Columns) {
- /* Only 1 cell left, but character requires 2 cells:
- * display a '>' in the last column to avoid wrapping. */
- c = '>';
- mbyte_cells = 1;
+ } else {
+ mbyte_blen = utfc_ptr2len(ptr);
+ }
+ if (len >= 0) {
+ u8c = utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr));
+ } else {
+ u8c = utfc_ptr2char(ptr, u8cc);
+ }
+ mbyte_cells = utf_char2cells(u8c);
+ if (p_arshape && !p_tbidi && arabic_char(u8c)) {
+ // Do Arabic shaping.
+ if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
+ // Past end of string to be displayed.
+ nc = NUL;
+ nc1 = NUL;
+ } else {
+ nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
+ (int)((text + len) - ptr - mbyte_blen));
+ nc1 = pcc[0];
}
+ pc = prev_c;
+ prev_c = u8c;
+ u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
+ } else {
+ prev_c = u8c;
+ }
+ if (col + mbyte_cells > screen_Columns) {
+ // Only 1 cell left, but character requires 2 cells:
+ // display a '>' in the last column to avoid wrapping. */
+ c = '>';
+ mbyte_cells = 1;
}
}
@@ -5374,16 +5371,11 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
force_redraw_next = FALSE;
need_redraw = ScreenLines[off] != c
- || (mbyte_cells == 2
- && ScreenLines[off + 1] != (l_enc_dbcs ? ptr[1] : 0))
- || (l_enc_dbcs == DBCS_JPNU
- && c == 0x8e
- && ScreenLines2[off] != ptr[1])
- || (l_enc_utf8
- && (ScreenLinesUC[off] !=
- (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
- || (ScreenLinesUC[off] != 0
- && screen_comp_differs(off, u8cc))))
+ || (mbyte_cells == 2 && ScreenLines[off + 1] != 0)
+ || (ScreenLinesUC[off] !=
+ (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
+ || (ScreenLinesUC[off] != 0
+ && screen_comp_differs(off, u8cc)))
|| ScreenAttrs[off] != attr
|| exmode_active;
@@ -5537,13 +5529,14 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
* Do this both for search_hl and the match list.
*/
cur = wp->w_match_head;
- shl_flag = FALSE;
- while (cur != NULL || shl_flag == FALSE) {
- if (shl_flag == FALSE) {
+ shl_flag = false;
+ while (cur != NULL || shl_flag == false) {
+ if (shl_flag == false) {
shl = &search_hl;
- shl_flag = TRUE;
- } else
- shl = &cur->hl;
+ shl_flag = true;
+ } else {
+ shl = &cur->hl; // -V595
+ }
if (shl->rm.regprog != NULL
&& shl->lnum == 0
&& re_multiline(shl->rm.regprog)) {
@@ -6102,8 +6095,7 @@ retry:
if (new_ScreenLinesC[i] == NULL)
break;
if (new_ScreenLines == NULL
- || (l_enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
- || (l_enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
+ || (new_ScreenLinesUC == NULL || i != p_mco)
|| new_ScreenAttrs == NULL
|| new_LineOffset == NULL
|| new_LineWraps == NULL
@@ -6188,13 +6180,14 @@ retry:
ScreenLinesC[i] + LineOffset[old_row],
(size_t)len * sizeof(u8char_T));
}
- if (l_enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
+ if (ScreenLines2 != NULL) {
memmove(new_ScreenLines2 + new_LineOffset[new_row],
- ScreenLines2 + LineOffset[old_row],
- (size_t)len * sizeof(schar_T));
+ ScreenLines2 + LineOffset[old_row],
+ (size_t)len * sizeof(schar_T));
+ }
memmove(new_ScreenAttrs + new_LineOffset[new_row],
- ScreenAttrs + LineOffset[old_row],
- (size_t)len * sizeof(sattr_T));
+ ScreenAttrs + LineOffset[old_row],
+ (size_t)len * sizeof(sattr_T));
}
}
}
diff --git a/src/nvim/screen.h b/src/nvim/screen.h
index 81a8b9ed4c..17515d4253 100644
--- a/src/nvim/screen.h
+++ b/src/nvim/screen.h
@@ -3,6 +3,10 @@
#include <stdbool.h>
+#include "nvim/types.h"
+#include "nvim/buffer_defs.h"
+#include "nvim/pos.h"
+
/*
* flags for update_screen()
* The higher the value, the higher the priority
diff --git a/src/nvim/search.c b/src/nvim/search.c
index c5c92b41c5..c662e3ba40 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* search.c: code for normal mode searching commands
*/
@@ -335,23 +338,26 @@ int pat_has_uppercase(char_u *pat)
while (*p != NUL) {
int l;
- if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) {
- if (enc_utf8 && utf_isupper(utf_ptr2char(p)))
- return TRUE;
+ if ((l = mb_ptr2len(p)) > 1) {
+ if (mb_isupper(utf_ptr2char(p))) {
+ return true;
+ }
p += l;
} else if (*p == '\\') {
- if (p[1] == '_' && p[2] != NUL) /* skip "\_X" */
+ if (p[1] == '_' && p[2] != NUL) { // skip "\_X"
p += 3;
- else if (p[1] == '%' && p[2] != NUL) /* skip "\%X" */
+ } else if (p[1] == '%' && p[2] != NUL) { // skip "\%X"
p += 3;
- else if (p[1] != NUL) /* skip "\X" */
+ } else if (p[1] != NUL) { // skip "\X"
p += 2;
- else
+ } else {
p += 1;
- } else if (vim_isupper(*p))
- return TRUE;
- else
- ++p;
+ }
+ } else if (mb_isupper(*p)) {
+ return true;
+ } else {
+ p++;
+ }
}
return FALSE;
}
diff --git a/src/nvim/search.h b/src/nvim/search.h
index d4e40cb287..cb50742990 100644
--- a/src/nvim/search.h
+++ b/src/nvim/search.h
@@ -4,6 +4,12 @@
#include <stdbool.h>
#include <stdint.h>
+#include "nvim/types.h"
+#include "nvim/buffer_defs.h"
+#include "nvim/eval/typval.h"
+#include "nvim/normal.h"
+#include "nvim/os/time.h"
+
/* Values for the find_pattern_in_path() function args 'type' and 'action': */
#define FIND_ANY 1
#define FIND_DEFINE 2
diff --git a/src/nvim/sha256.c b/src/nvim/sha256.c
index c72dafd08e..a2378cc202 100644
--- a/src/nvim/sha256.c
+++ b/src/nvim/sha256.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file sha256.c
///
/// FIPS-180-2 compliant SHA-256 implementation
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index f65fdaf1c0..a6d8cb6563 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
@@ -73,15 +76,10 @@ KHASH_SET_INIT_STR(strset)
(vim_rename((char_u *)a, (char_u *)b))
#define mb_strnicmp(a, b, c) \
(mb_strnicmp((char_u *)a, (char_u *)b, c))
-#define has_non_ascii(a) (has_non_ascii((char_u *)a))
-#define string_convert(a, b, c) \
- ((char *)string_convert((vimconv_T *)a, (char_u *)b, c))
#define path_shorten_fname_if_possible(b) \
((char *)path_shorten_fname_if_possible((char_u *)b))
#define buflist_new(ffname, sfname, ...) \
(buflist_new((char_u *)ffname, (char_u *)sfname, __VA_ARGS__))
-#define convert_setup(vcp, from, to) \
- (convert_setup(vcp, (char_u *)from, (char_u *)to))
#define os_isdir(f) (os_isdir((char_u *) f))
#define regtilde(s, m) ((char *) regtilde((char_u *) s, m))
#define path_tail_with_sep(f) ((char *) path_tail_with_sep((char_u *)f))
@@ -413,8 +411,6 @@ typedef struct sd_read_def {
const char *error; ///< Error message in case of error.
uintmax_t fpos; ///< Current position (amount of bytes read since
///< reader structure initialization). May overflow.
- vimconv_T sd_conv; ///< Structure used for converting encodings of some
- ///< items.
} ShaDaReadDef;
struct sd_write_def;
@@ -435,8 +431,6 @@ typedef struct sd_write_def {
ShaDaWriteCloser close; ///< Close function.
void *cookie; ///< Data describing object written to.
const char *error; ///< Error message in case of error.
- vimconv_T sd_conv; ///< Structure used for converting encodings of some
- ///< items.
} ShaDaWriteDef;
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -803,7 +797,7 @@ static int open_shada_file_for_reading(const char *const fname,
return error;
}
- convert_setup(&sd_reader->sd_conv, "utf-8", p_enc);
+ assert(STRCMP(p_enc, "utf-8") == 0);
return 0;
}
@@ -811,7 +805,7 @@ static int open_shada_file_for_reading(const char *const fname,
/// Wrapper for closing file descriptors
static void close_file(void *cookie)
{
- const int error = file_free(cookie);
+ const int error = file_free(cookie, true);
if (error != 0) {
emsgf(_(SERR "System error while closing ShaDa file: %s"),
os_strerror(error));
@@ -1899,127 +1893,24 @@ shada_pack_entry_error:
}
#undef PACK_STRING
-/// Write single ShaDa entry, converting it if needed
+/// Write single ShaDa entry and free it afterwards
///
-/// @warning Frees entry after packing.
+/// Will not free if entry could not be freed.
///
/// @param[in] packer Packer used to write entry.
-/// @param[in] sd_conv Conversion definitions.
-/// @param[in] entry Entry written. If entry.can_free_entry is false then
-/// it assumes that entry was not converted, otherwise it
-/// is assumed that entry was already converted.
+/// @param[in] entry Entry written.
/// @param[in] max_kbyte Maximum size of an item in KiB. Zero means no
/// restrictions.
-static ShaDaWriteResult shada_pack_encoded_entry(msgpack_packer *const packer,
- const vimconv_T *const sd_conv,
- PossiblyFreedShadaEntry entry,
- const size_t max_kbyte)
- FUNC_ATTR_NONNULL_ALL
+static inline ShaDaWriteResult shada_pack_pfreed_entry(
+ msgpack_packer *const packer, PossiblyFreedShadaEntry entry,
+ const size_t max_kbyte)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_ALWAYS_INLINE
{
ShaDaWriteResult ret = kSDWriteSuccessfull;
+ ret = shada_pack_entry(packer, entry.data, max_kbyte);
if (entry.can_free_entry) {
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
shada_free_shada_entry(&entry.data);
- return ret;
}
-#define RUN_WITH_CONVERTED_STRING(cstr, code) \
- do { \
- bool did_convert = false; \
- if (sd_conv->vc_type != CONV_NONE && has_non_ascii((cstr))) { \
- char *const converted_string = string_convert(sd_conv, (cstr), NULL); \
- if (converted_string != NULL) { \
- (cstr) = converted_string; \
- did_convert = true; \
- } \
- } \
- code \
- if (did_convert) { \
- xfree((cstr)); \
- } \
- } while (0)
- switch (entry.data.type) {
- case kSDItemUnknown:
- case kSDItemMissing: {
- assert(false);
- }
- case kSDItemSearchPattern: {
- RUN_WITH_CONVERTED_STRING(entry.data.data.search_pattern.pat, {
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- });
- break;
- }
- case kSDItemHistoryEntry: {
- RUN_WITH_CONVERTED_STRING(entry.data.data.history_item.string, {
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- });
- break;
- }
- case kSDItemSubString: {
- RUN_WITH_CONVERTED_STRING(entry.data.data.sub_string.sub, {
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- });
- break;
- }
- case kSDItemVariable: {
- if (sd_conv->vc_type != CONV_NONE) {
- typval_T tgttv;
- var_item_copy(sd_conv, &entry.data.data.global_var.value, &tgttv,
- true, 0);
- tv_clear(&entry.data.data.global_var.value);
- entry.data.data.global_var.value = tgttv;
- }
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- break;
- }
- case kSDItemRegister: {
- bool did_convert = false;
- if (sd_conv->vc_type != CONV_NONE) {
- size_t first_non_ascii = 0;
- for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) {
- if (has_non_ascii(entry.data.data.reg.contents[i])) {
- first_non_ascii = i;
- did_convert = true;
- break;
- }
- }
- if (did_convert) {
- entry.data.data.reg.contents =
- xmemdup(entry.data.data.reg.contents,
- (entry.data.data.reg.contents_size
- * sizeof(entry.data.data.reg.contents[0])));
- for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) {
- if (i >= first_non_ascii) {
- entry.data.data.reg.contents[i] = get_converted_string(
- sd_conv,
- entry.data.data.reg.contents[i],
- strlen(entry.data.data.reg.contents[i]));
- } else {
- entry.data.data.reg.contents[i] =
- xstrdup(entry.data.data.reg.contents[i]);
- }
- }
- }
- }
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- if (did_convert) {
- for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) {
- xfree(entry.data.data.reg.contents[i]);
- }
- xfree(entry.data.data.reg.contents);
- }
- break;
- }
- case kSDItemHeader:
- case kSDItemGlobalMark:
- case kSDItemJump:
- case kSDItemBufferList:
- case kSDItemLocalMark:
- case kSDItemChange: {
- ret = shada_pack_entry(packer, entry.data, max_kbyte);
- break;
- }
- }
-#undef RUN_WITH_CONVERTED_STRING
return ret;
}
@@ -2556,11 +2447,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
break;
}
typval_T tgttv;
- if (sd_writer->sd_conv.vc_type != CONV_NONE) {
- var_item_copy(&sd_writer->sd_conv, &vartv, &tgttv, true, 0);
- } else {
- tv_copy(&vartv, &tgttv);
- }
+ tv_copy(&vartv, &tgttv);
ShaDaWriteResult spe_ret;
if ((spe_ret = shada_pack_entry(packer, (ShadaEntry) {
.type = kSDItemVariable,
@@ -2811,9 +2698,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
do { \
for (size_t i_ = 0; i_ < ARRAY_SIZE(wms_array); i_++) { \
if (wms_array[i_].data.type != kSDItemMissing) { \
- if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, \
- wms_array[i_], \
- max_kbyte) == kSDWriteFailed) { \
+ if (shada_pack_pfreed_entry(packer, wms_array[i_], max_kbyte) \
+ == kSDWriteFailed) { \
ret = kSDWriteFailed; \
goto shada_write_exit; \
} \
@@ -2823,8 +2709,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
PACK_WMS_ARRAY(wms->global_marks);
PACK_WMS_ARRAY(wms->registers);
for (size_t i = 0; i < wms->jumps_size; i++) {
- if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, wms->jumps[i],
- max_kbyte) == kSDWriteFailed) {
+ if (shada_pack_pfreed_entry(packer, wms->jumps[i], max_kbyte)
+ == kSDWriteFailed) {
ret = kSDWriteFailed;
goto shada_write_exit;
}
@@ -2832,8 +2718,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
#define PACK_WMS_ENTRY(wms_entry) \
do { \
if (wms_entry.data.type != kSDItemMissing) { \
- if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, wms_entry, \
- max_kbyte) == kSDWriteFailed) { \
+ if (shada_pack_pfreed_entry(packer, wms_entry, max_kbyte) \
+ == kSDWriteFailed) { \
ret = kSDWriteFailed; \
goto shada_write_exit; \
} \
@@ -2860,9 +2746,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
for (size_t i = 0; i < file_markss_to_dump; i++) {
PACK_WMS_ARRAY(all_file_markss[i]->marks);
for (size_t j = 0; j < all_file_markss[i]->changes_size; j++) {
- if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv,
- all_file_markss[i]->changes[j],
- max_kbyte) == kSDWriteFailed) {
+ if (shada_pack_pfreed_entry(packer, all_file_markss[i]->changes[j],
+ max_kbyte) == kSDWriteFailed) {
ret = kSDWriteFailed;
goto shada_write_exit;
}
@@ -2886,8 +2771,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
if (dump_one_history[i]) {
hms_insert_whole_neovim_history(&wms->hms[i]);
HMS_ITER(&wms->hms[i], cur_entry, {
- if (shada_pack_encoded_entry(
- packer, &sd_writer->sd_conv, (PossiblyFreedShadaEntry) {
+ if (shada_pack_pfreed_entry(
+ packer, (PossiblyFreedShadaEntry) {
.data = cur_entry->data,
.can_free_entry = cur_entry->can_free_entry,
}, max_kbyte) == kSDWriteFailed) {
@@ -3038,8 +2923,6 @@ shada_write_file_nomerge: {}
verbose_leave();
}
- convert_setup(&sd_writer.sd_conv, p_enc, "utf-8");
-
const ShaDaWriteResult sw_ret = shada_write(&sd_writer, (nomerge
? NULL
: &sd_reader));
@@ -3327,29 +3210,6 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader,
return kSDReadStatusSuccess;
}
-/// Convert or copy and return a string
-///
-/// @param[in] sd_conv Conversion definition.
-/// @param[in] str String to convert.
-/// @param[in] len String length.
-///
-/// @return [allocated] converted string or copy of the original string.
-static inline char *get_converted_string(const vimconv_T *const sd_conv,
- const char *const str,
- const size_t len)
- FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
-{
- if (!has_non_ascii_len(str, len)) {
- return xmemdupz(str, len);
- }
- size_t new_len = len;
- char *const new_str = string_convert(sd_conv, str, &new_len);
- if (new_str == NULL) {
- return xmemdupz(str, len);
- }
- return new_str;
-}
-
#define READERR(entry_name, error_desc) \
RERR "Error while reading ShaDa file: " \
entry_name " entry at position %" PRIu64 " " \
@@ -3427,10 +3287,7 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv,
sizeof(*unpacked.data.via.map.ptr)); \
ad_ga.ga_len++; \
}
-#define CONVERTED(str, len) ( \
- sd_reader->sd_conv.vc_type != CONV_NONE \
- ? get_converted_string(&sd_reader->sd_conv, (str), (len)) \
- : xmemdupz((str), (len)))
+#define CONVERTED(str, len) (xmemdupz((str), (len)))
#define BIN_CONVERTED(b) CONVERTED(b.ptr, b.size)
#define SET_ADDITIONAL_DATA(tgt, name) \
do { \
@@ -3803,30 +3660,14 @@ shada_read_next_item_start:
(char) unpacked.data.via.array.ptr[2].via.u64;
}
size_t strsize;
- if (sd_reader->sd_conv.vc_type == CONV_NONE
- || !has_non_ascii_len(unpacked.data.via.array.ptr[1].via.bin.ptr,
- unpacked.data.via.array.ptr[1].via.bin.size)) {
-shada_read_next_item_hist_no_conv:
- strsize = (
- unpacked.data.via.array.ptr[1].via.bin.size
- + 1 // Zero byte
- + 1); // Separator character
- entry->data.history_item.string = xmalloc(strsize);
- memcpy(entry->data.history_item.string,
- unpacked.data.via.array.ptr[1].via.bin.ptr,
- unpacked.data.via.array.ptr[1].via.bin.size);
- } else {
- size_t len = unpacked.data.via.array.ptr[1].via.bin.size;
- char *const converted = string_convert(
- &sd_reader->sd_conv, unpacked.data.via.array.ptr[1].via.bin.ptr,
- &len);
- if (converted != NULL) {
- strsize = len + 2;
- entry->data.history_item.string = xrealloc(converted, strsize);
- } else {
- goto shada_read_next_item_hist_no_conv;
- }
- }
+ strsize = (
+ unpacked.data.via.array.ptr[1].via.bin.size
+ + 1 // Zero byte
+ + 1); // Separator character
+ entry->data.history_item.string = xmalloc(strsize);
+ memcpy(entry->data.history_item.string,
+ unpacked.data.via.array.ptr[1].via.bin.ptr,
+ unpacked.data.via.array.ptr[1].via.bin.size);
entry->data.history_item.string[strsize - 2] = 0;
entry->data.history_item.string[strsize - 1] =
entry->data.history_item.sep;
@@ -3859,16 +3700,6 @@ shada_read_next_item_hist_no_conv:
"be converted to the VimL value")), initial_fpos);
goto shada_read_next_item_error;
}
- if (sd_reader->sd_conv.vc_type != CONV_NONE) {
- typval_T tgttv;
- var_item_copy(&sd_reader->sd_conv,
- &entry->data.global_var.value,
- &tgttv,
- true,
- 0);
- tv_clear(&entry->data.global_var.value);
- entry->data.global_var.value = tgttv;
- }
SET_ADDITIONAL_ELEMENTS(unpacked.data.via.array, 2,
entry->data.global_var.additional_elements,
"variable");
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index d4f49bffb2..25ae562e65 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// spell.c: code for spell checking
//
// See spellfile.c for the Vim spell file format.
@@ -92,6 +95,7 @@
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
+#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
@@ -2526,8 +2530,7 @@ void clear_spell_chartab(spelltab_T *sp)
}
}
-// Init the chartab used for spelling. Only depends on 'encoding'.
-// Called once while starting up and when 'encoding' changes.
+// Init the chartab used for spelling. Called once while starting up.
// The default is to use isalpha(), but the spell file should define the word
// characters to make it possible that 'encoding' differs from the current
// locale. For utf-8 we don't use isalpha() but our own functions.
@@ -2537,36 +2540,17 @@ void init_spell_chartab(void)
did_set_spelltab = false;
clear_spell_chartab(&spelltab);
- if (enc_dbcs) {
- // DBCS: assume double-wide characters are word characters.
- for (i = 128; i <= 255; ++i)
- if (MB_BYTE2LEN(i) == 2)
- spelltab.st_isw[i] = true;
- } else if (enc_utf8) {
- for (i = 128; i < 256; ++i) {
- int f = utf_fold(i);
- int u = utf_toupper(i);
-
- spelltab.st_isu[i] = utf_isupper(i);
- spelltab.st_isw[i] = spelltab.st_isu[i] || utf_islower(i);
- // The folded/upper-cased value is different between latin1 and
- // utf8 for 0xb5, causing E763 for no good reason. Use the latin1
- // value for utf-8 to avoid this.
- spelltab.st_fold[i] = (f < 256) ? f : i;
- spelltab.st_upper[i] = (u < 256) ? u : i;
- }
- } else {
- // Rough guess: use locale-dependent library functions.
- for (i = 128; i < 256; ++i) {
- if (vim_isupper(i)) {
- spelltab.st_isw[i] = true;
- spelltab.st_isu[i] = true;
- spelltab.st_fold[i] = vim_tolower(i);
- } else if (vim_islower(i)) {
- spelltab.st_isw[i] = true;
- spelltab.st_upper[i] = vim_toupper(i);
- }
- }
+ for (i = 128; i < 256; i++) {
+ int f = utf_fold(i);
+ int u = mb_toupper(i);
+
+ spelltab.st_isu[i] = mb_isupper(i);
+ spelltab.st_isw[i] = spelltab.st_isu[i] || mb_islower(i);
+ // The folded/upper-cased value is different between latin1 and
+ // utf8 for 0xb5, causing E763 for no good reason. Use the latin1
+ // value for utf-8 to avoid this.
+ spelltab.st_fold[i] = (f < 256) ? f : i;
+ spelltab.st_upper[i] = (u < 256) ? u : i;
}
}
diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h
index c54a7f5390..ddd54c724e 100644
--- a/src/nvim/spell_defs.h
+++ b/src/nvim/spell_defs.h
@@ -265,11 +265,11 @@ typedef struct trystate_S {
: (c) < \
256 ? (int)spelltab.st_fold[c] : (int)towlower(c))
-#define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \
+#define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? mb_toupper(c) \
: (c) < \
256 ? (int)spelltab.st_upper[c] : (int)towupper(c))
-#define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \
+#define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? mb_isupper(c) \
: (c) < 256 ? spelltab.st_isu[c] : iswupper(c))
// First language that is loaded, start of the linked list of loaded
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 4d7ff558ad..d34d69b3a4 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// spellfile.c: code for reading and writing spell files.
//
// See spell.c for information about spell checking.
@@ -223,7 +226,9 @@
// few bytes as possible, see offset2bytes())
#include <stdio.h>
+#include <stdint.h>
#include <wctype.h>
+#include <strings.h>
#include "nvim/vim.h"
#include "nvim/spell_defs.h"
@@ -266,7 +271,7 @@
#define SAL_REM_ACCENTS 4
#define VIMSPELLMAGIC "VIMspell" // string at start of Vim spell file
-#define VIMSPELLMAGICL 8
+#define VIMSPELLMAGICL (sizeof(VIMSPELLMAGIC) - 1)
#define VIMSPELLVERSION 50
// Section IDs. Only renumber them when VIMSPELLVERSION changes!
@@ -493,6 +498,64 @@ typedef struct spellinfo_S {
# include "spellfile.c.generated.h"
#endif
+/// Read n bytes from fd to buf, returning on errors
+///
+/// @param[out] buf Buffer to read to, must be at least n bytes long.
+/// @param[in] n Amount of bytes to read.
+/// @param fd FILE* to read from.
+/// @param exit_code Code to run before returning.
+///
+/// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if
+/// there are not enough bytes, returns SP_OTHERERROR if reading failed.
+#define SPELL_READ_BYTES(buf, n, fd, exit_code) \
+ do { \
+ const size_t n__SPRB = (n); \
+ FILE *const fd__SPRB = (fd); \
+ char *const buf__SPRB = (buf); \
+ const size_t read_bytes__SPRB = fread(buf__SPRB, 1, n__SPRB, fd__SPRB); \
+ if (read_bytes__SPRB != n__SPRB) { \
+ exit_code; \
+ return feof(fd__SPRB) ? SP_TRUNCERROR : SP_OTHERERROR; \
+ } \
+ } while (0)
+
+/// Like #SPELL_READ_BYTES, but also error out if NUL byte was read
+///
+/// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if
+/// there are not enough bytes, returns SP_OTHERERROR if reading failed,
+/// returns SP_FORMERROR if read out a NUL byte.
+#define SPELL_READ_NONNUL_BYTES(buf, n, fd, exit_code) \
+ do { \
+ const size_t n__SPRNB = (n); \
+ FILE *const fd__SPRNB = (fd); \
+ char *const buf__SPRNB = (buf); \
+ SPELL_READ_BYTES(buf__SPRNB, n__SPRNB, fd__SPRNB, exit_code); \
+ if (memchr(buf__SPRNB, NUL, (size_t)n__SPRNB)) { \
+ exit_code; \
+ return SP_FORMERROR; \
+ } \
+ } while (0)
+
+/// Check that spell file starts with a magic string
+///
+/// Does not check for version of the file.
+///
+/// @param fd File to check.
+///
+/// @return 0 in case of success, SP_TRUNCERROR if file contains not enough
+/// bytes, SP_FORMERROR if it does not match magic string and
+/// SP_OTHERERROR if reading file failed.
+static inline int spell_check_magic_string(FILE *const fd)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE
+{
+ char buf[VIMSPELLMAGICL];
+ SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ;);
+ if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) {
+ return SP_FORMERROR;
+ }
+ return 0;
+}
+
// Load one spell file and store the info into a slang_T.
//
// This is invoked in three ways:
@@ -513,9 +576,7 @@ spell_load_file (
)
{
FILE *fd;
- char_u buf[VIMSPELLMAGICL];
char_u *p;
- int i;
int n;
int len;
char_u *save_sourcing_name = sourcing_name;
@@ -557,11 +618,20 @@ spell_load_file (
sourcing_lnum = 0;
// <HEADER>: <fileID>
- for (i = 0; i < VIMSPELLMAGICL; ++i)
- buf[i] = getc(fd); // <fileID>
- if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) {
- EMSG(_("E757: This does not look like a spell file"));
- goto endFAIL;
+ const int scms_ret = spell_check_magic_string(fd);
+ switch (scms_ret) {
+ case SP_FORMERROR:
+ case SP_TRUNCERROR: {
+ emsgf(_("E757: This does not look like a spell file"));
+ goto endFAIL;
+ }
+ case SP_OTHERERROR: {
+ emsgf(_("E5042: Failed to read spell file %s: %s"),
+ fname, strerror(ferror(fd)));
+ }
+ case 0: {
+ break;
+ }
}
c = getc(fd); // <versionnr>
if (c < VIMSPELLVERSION) {
@@ -934,12 +1004,10 @@ static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp)
// Return SP_*ERROR flags.
static int read_region_section(FILE *fd, slang_T *lp, int len)
{
- int i;
-
- if (len > 16)
+ if (len > 16) {
return SP_FORMERROR;
- for (i = 0; i < len; ++i)
- lp->sl_regions[i] = getc(fd); // <regionname>
+ }
+ SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ;);
lp->sl_regions[len] = NUL;
return 0;
}
@@ -982,35 +1050,30 @@ static int read_charflags_section(FILE *fd)
// Return SP_*ERROR flags.
static int read_prefcond_section(FILE *fd, slang_T *lp)
{
- int cnt;
- int i;
- int n;
- char_u *p;
- char_u buf[MAXWLEN + 1];
-
// <prefcondcnt> <prefcond> ...
- cnt = get2c(fd); // <prefcondcnt>
- if (cnt <= 0)
+ const int cnt = get2c(fd); // <prefcondcnt>
+ if (cnt <= 0) {
return SP_FORMERROR;
+ }
lp->sl_prefprog = xcalloc(cnt, sizeof(regprog_T *));
lp->sl_prefixcnt = cnt;
- for (i = 0; i < cnt; ++i) {
+ for (int i = 0; i < cnt; i++) {
// <prefcond> : <condlen> <condstr>
- n = getc(fd); // <condlen>
- if (n < 0 || n >= MAXWLEN)
+ const int n = getc(fd); // <condlen>
+ if (n < 0 || n >= MAXWLEN) {
return SP_FORMERROR;
+ }
// When <condlen> is zero we have an empty condition. Otherwise
// compile the regexp program used to check for the condition.
if (n > 0) {
- buf[0] = '^'; // always match at one position only
- p = buf + 1;
- while (n-- > 0)
- *p++ = getc(fd); // <condstr>
- *p = NUL;
- lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING);
+ char buf[MAXWLEN + 1];
+ buf[0] = '^'; // always match at one position only
+ SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ;);
+ buf[n + 1] = NUL;
+ lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING);
}
}
return 0;
@@ -1063,7 +1126,6 @@ static int read_rep_section(FILE *fd, garray_T *gap, int16_t *first)
// Return SP_*ERROR flags.
static int read_sal_section(FILE *fd, slang_T *slang)
{
- int i;
int cnt;
garray_T *gap;
salitem_T *smp;
@@ -1073,13 +1135,16 @@ static int read_sal_section(FILE *fd, slang_T *slang)
slang->sl_sofo = false;
- i = getc(fd); // <salflags>
- if (i & SAL_F0LLOWUP)
+ const int flags = getc(fd); // <salflags>
+ if (flags & SAL_F0LLOWUP) {
slang->sl_followup = true;
- if (i & SAL_COLLAPSE)
+ }
+ if (flags & SAL_COLLAPSE) {
slang->sl_collapse = true;
- if (i & SAL_REM_ACCENTS)
+ }
+ if (flags & SAL_REM_ACCENTS) {
slang->sl_rem_accents = true;
+ }
cnt = get2c(fd); // <salcount>
if (cnt < 0)
@@ -1099,7 +1164,8 @@ static int read_sal_section(FILE *fd, slang_T *slang)
smp->sm_lead = p;
// Read up to the first special char into sm_lead.
- for (i = 0; i < ccnt; ++i) {
+ int i = 0;
+ for (; i < ccnt; ++i) {
c = getc(fd); // <salfrom>
if (vim_strchr((char_u *)"0123456789(-<^$", c) != NULL)
break;
@@ -1125,11 +1191,17 @@ static int read_sal_section(FILE *fd, slang_T *slang)
// Any following chars go in sm_rules.
smp->sm_rules = p;
- if (i < ccnt)
+ if (i < ccnt) {
// store the char we got while checking for end of sm_lead
*p++ = c;
- for (++i; i < ccnt; ++i)
- *p++ = getc(fd); // <salfrom>
+ }
+ i++;
+ if (i < ccnt) {
+ SPELL_READ_NONNUL_BYTES( // <salfrom>
+ (char *)p, (size_t)(ccnt - i), fd, xfree(smp->sm_lead));
+ p += (ccnt - i);
+ i = ccnt;
+ }
*p++ = NUL;
// <saltolen> <salto>
@@ -1569,9 +1641,14 @@ spell_read_tree (
// The tree size was computed when writing the file, so that we can
// allocate it as one long block. <nodecount>
- int len = get4c(fd);
- if (len < 0)
+ long len = get4c(fd);
+ if (len < 0) {
return SP_TRUNCERROR;
+ }
+ if ((size_t)len >= SIZE_MAX / sizeof(int)) {
+ // Invalid length, multiply with sizeof(int) would overflow.
+ return SP_FORMERROR;
+ }
if (len > 0) {
// Allocate the byte array.
bp = xmalloc(len);
diff --git a/src/nvim/state.c b/src/nvim/state.c
index 44c6441e40..210708c3f4 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include "nvim/lib/kvec.h"
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 5dcffe00e0..743b43c2e5 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -198,8 +201,16 @@ char_u *vim_strsave_shellescape(const char_u *string,
/* First count the number of extra bytes required. */
size_t length = STRLEN(string) + 3; // two quotes and a trailing NUL
for (const char_u *p = string; *p != NUL; mb_ptr_adv(p)) {
- if (*p == '\'')
- length += 3; /* ' => '\'' */
+#ifdef WIN32
+ if (!p_ssl) {
+ if (*p == '"') {
+ length++; // " -> ""
+ }
+ } else
+#endif
+ if (*p == '\'') {
+ length += 3; // ' => '\''
+ }
if ((*p == '\n' && (csh_like || do_newline))
|| (*p == '!' && (csh_like || do_special))) {
++length; /* insert backslash */
@@ -216,10 +227,25 @@ char_u *vim_strsave_shellescape(const char_u *string,
escaped_string = xmalloc(length);
d = escaped_string;
- /* add opening quote */
+ // add opening quote
+#ifdef WIN32
+ if (!p_ssl) {
+ *d++ = '"';
+ } else
+#endif
*d++ = '\'';
for (const char_u *p = string; *p != NUL; ) {
+#ifdef WIN32
+ if (!p_ssl) {
+ if (*p == '"') {
+ *d++ = '"';
+ *d++ = '"';
+ p++;
+ continue;
+ }
+ } else
+#endif
if (*p == '\'') {
*d++ = '\'';
*d++ = '\\';
@@ -246,7 +272,12 @@ char_u *vim_strsave_shellescape(const char_u *string,
MB_COPY_CHAR(p, d);
}
- /* add terminating quote and finish with a NUL */
+ // add terminating quote and finish with a NUL
+# ifdef WIN32
+ if (!p_ssl) {
+ *d++ = '"';
+ } else
+# endif
*d++ = '\'';
*d = NUL;
@@ -291,14 +322,15 @@ void vim_strup(char_u *p)
}
}
-/// Make given string all upper-case
+/// Make given string all upper-case or all lower-case
///
-/// Handels multi-byte characters as good as possible.
+/// Handles multi-byte characters as good as possible.
///
/// @param[in] orig Input string.
+/// @param[in] upper If true make uppercase, otherwise lowercase
///
/// @return [allocated] upper-cased string.
-char *strup_save(const char *const orig)
+char *strcase_save(const char *const orig, bool upper)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
{
char *res = xstrdup(orig);
@@ -307,33 +339,25 @@ char *strup_save(const char *const orig)
while (*p != NUL) {
int l;
- if (enc_utf8) {
- int c = utf_ptr2char((const char_u *)p);
- int uc = utf_toupper(c);
-
- // Reallocate string when byte count changes. This is rare,
- // thus it's OK to do another malloc()/free().
- l = utf_ptr2len((const char_u *)p);
- int newl = utf_char2len(uc);
- if (newl != l) {
- // TODO(philix): use xrealloc() in strup_save()
- char *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l));
- memcpy(s, res, (size_t)(p - res));
- STRCPY(s + (p - res) + newl, p + l);
- p = s + (p - res);
- xfree(res);
- res = s;
- }
-
- utf_char2bytes(uc, (char_u *)p);
- p += newl;
- } else if (has_mbyte && (l = (*mb_ptr2len)((const char_u *)p)) > 1) {
- p += l; // Skip multi-byte character.
- } else {
- // note that toupper() can be a macro
- *p = (char)(uint8_t)TOUPPER_LOC(*p);
- p++;
+ int c = utf_ptr2char((const char_u *)p);
+ int uc = upper ? mb_toupper(c) : mb_tolower(c);
+
+ // Reallocate string when byte count changes. This is rare,
+ // thus it's OK to do another malloc()/free().
+ l = utf_ptr2len((const char_u *)p);
+ int newl = utf_char2len(uc);
+ if (newl != l) {
+ // TODO(philix): use xrealloc() in strup_save()
+ char *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l));
+ memcpy(s, res, (size_t)(p - res));
+ STRCPY(s + (p - res) + newl, p + l);
+ p = s + (p - res);
+ xfree(res);
+ res = s;
}
+
+ utf_char2bytes(uc, (char_u *)p);
+ p += newl;
}
return res;
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 4a7b4a0eac..ce48547163 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* syntax.c: code for syntax highlighting
*/
@@ -42,34 +45,38 @@
static bool did_syntax_onoff = false;
-// Structure that stores information about a highlight group.
-// The ID of a highlight group is also called group ID. It is the index in
-// the highlight_ga array PLUS ONE.
+/// Structure that stores information about a highlight group.
+/// The ID of a highlight group is also called group ID. It is the index in
+/// the highlight_ga array PLUS ONE.
struct hl_group {
- char_u *sg_name; // highlight group name
- char_u *sg_name_u; // uppercase of sg_name
- int sg_attr; // Screen attr
- int sg_link; // link to this highlight group ID
- int sg_set; // combination of SG_* flags
- scid_T sg_scriptID; // script in which the group was last set
+ char_u *sg_name; ///< highlight group name
+ char_u *sg_name_u; ///< uppercase of sg_name
+ int sg_attr; ///< Screen attr @see ATTR_ENTRY
+ int sg_link; ///< link to this highlight group ID
+ int sg_set; ///< combination of flags in \ref SG_SET
+ scid_T sg_scriptID; ///< script in which the group was last set
// for terminal UIs
- int sg_cterm; // "cterm=" highlighting attr
- int sg_cterm_fg; // terminal fg color number + 1
- int sg_cterm_bg; // terminal bg color number + 1
- int sg_cterm_bold; // bold attr was set for light color
+ int sg_cterm; ///< "cterm=" highlighting attr
+ int sg_cterm_fg; ///< terminal fg color number + 1
+ int sg_cterm_bg; ///< terminal bg color number + 1
+ int sg_cterm_bold; ///< bold attr was set for light color
// for RGB UIs
- int sg_gui; // "gui=" highlighting attributes
- RgbValue sg_rgb_fg; // RGB foreground color
- RgbValue sg_rgb_bg; // RGB background color
- RgbValue sg_rgb_sp; // RGB special color
- uint8_t *sg_rgb_fg_name; // RGB foreground color name
- uint8_t *sg_rgb_bg_name; // RGB background color name
- uint8_t *sg_rgb_sp_name; // RGB special color name
+ int sg_gui; ///< "gui=" highlighting attributes
+ ///< (combination of \ref HL_ATTRIBUTES)
+ RgbValue sg_rgb_fg; ///< RGB foreground color
+ RgbValue sg_rgb_bg; ///< RGB background color
+ RgbValue sg_rgb_sp; ///< RGB special color
+ uint8_t *sg_rgb_fg_name; ///< RGB foreground color name
+ uint8_t *sg_rgb_bg_name; ///< RGB background color name
+ uint8_t *sg_rgb_sp_name; ///< RGB special color name
};
+/// \addtogroup SG_SET
+/// @{
#define SG_CTERM 2 // cterm has been set
#define SG_GUI 4 // gui has been set
#define SG_LINK 8 // link has been set
+/// @}
// highlight groups for 'highlight' option
static garray_T highlight_ga = GA_EMPTY_INIT_VALUE;
@@ -4242,83 +4249,81 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
if (rest != NULL) {
syn_id = syn_check_group(arg, (int)(group_name_end - arg));
- if (syn_id != 0)
- /* allocate a buffer, for removing backslashes in the keyword */
+ if (syn_id != 0) {
+ // Allocate a buffer, for removing backslashes in the keyword.
keyword_copy = xmalloc(STRLEN(rest) + 1);
- syn_opt_arg.flags = 0;
- syn_opt_arg.keyword = TRUE;
- syn_opt_arg.sync_idx = NULL;
- syn_opt_arg.has_cont_list = FALSE;
- syn_opt_arg.cont_in_list = NULL;
- syn_opt_arg.next_list = NULL;
-
- /*
- * The options given apply to ALL keywords, so all options must be
- * found before keywords can be created.
- * 1: collect the options and copy the keywords to keyword_copy.
- */
- cnt = 0;
- p = keyword_copy;
- for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
- rest = get_syn_options(rest, &syn_opt_arg, &conceal_char);
- if (rest == NULL || ends_excmd(*rest))
- break;
- /* Copy the keyword, removing backslashes, and add a NUL. */
- while (*rest != NUL && !ascii_iswhite(*rest)) {
- if (*rest == '\\' && rest[1] != NUL)
- ++rest;
- *p++ = *rest++;
- }
- *p++ = NUL;
- ++cnt;
}
+ if (keyword_copy != NULL) {
+ syn_opt_arg.flags = 0;
+ syn_opt_arg.keyword = true;
+ syn_opt_arg.sync_idx = NULL;
+ syn_opt_arg.has_cont_list = false;
+ syn_opt_arg.cont_in_list = NULL;
+ syn_opt_arg.next_list = NULL;
+
+ // The options given apply to ALL keywords, so all options must be
+ // found before keywords can be created.
+ // 1: collect the options and copy the keywords to keyword_copy.
+ cnt = 0;
+ p = keyword_copy;
+ for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
+ rest = get_syn_options(rest, &syn_opt_arg, &conceal_char);
+ if (rest == NULL || ends_excmd(*rest)) {
+ break;
+ }
+ // Copy the keyword, removing backslashes, and add a NUL.
+ while (*rest != NUL && !ascii_iswhite(*rest)) {
+ if (*rest == '\\' && rest[1] != NUL) {
+ rest++;
+ }
+ *p++ = *rest++;
+ }
+ *p++ = NUL;
+ cnt++;
+ }
- if (!eap->skip) {
- /* Adjust flags for use of ":syn include". */
- syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
+ if (!eap->skip) {
+ // Adjust flags for use of ":syn include".
+ syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
- /*
- * 2: Add an entry for each keyword.
- */
- for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) {
- for (p = vim_strchr(kw, '[');; ) {
- if (p != NULL)
- *p = NUL;
- add_keyword(kw, syn_id, syn_opt_arg.flags,
- syn_opt_arg.cont_in_list,
- syn_opt_arg.next_list, conceal_char);
- if (p == NULL)
- break;
- if (p[1] == NUL) {
- EMSG2(_("E789: Missing ']': %s"), kw);
- goto error;
- }
- if (p[1] == ']') {
- if (p[2] != NUL) {
- EMSG3(_("E890: trailing char after ']': %s]%s"),
- kw, &p[2]);
+ // 2: Add an entry for each keyword.
+ for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) {
+ for (p = vim_strchr(kw, '[');; ) {
+ if (p != NULL) {
+ *p = NUL;
+ }
+ add_keyword(kw, syn_id, syn_opt_arg.flags,
+ syn_opt_arg.cont_in_list,
+ syn_opt_arg.next_list, conceal_char);
+ if (p == NULL) {
+ break;
+ }
+ if (p[1] == NUL) {
+ emsgf(_("E789: Missing ']': %s"), kw);
goto error;
}
- kw = p + 1;
- break; // skip over the "]"
- }
- if (has_mbyte) {
- int l = (*mb_ptr2len)(p + 1);
+ if (p[1] == ']') {
+ if (p[2] != NUL) {
+ emsgf(_("E890: trailing char after ']': %s]%s"),
+ kw, &p[2]);
+ goto error;
+ }
+ kw = p + 1;
+ break; // skip over the "]"
+ }
+ const int l = (*mb_ptr2len)(p + 1);
memmove(p, p + 1, l);
p += l;
- } else {
- p[0] = p[1];
- ++p;
}
}
}
- }
error:
- xfree(keyword_copy);
- xfree(syn_opt_arg.cont_in_list);
- xfree(syn_opt_arg.next_list);
+ xfree(keyword_copy);
+ xfree(syn_opt_arg.cont_in_list);
+ xfree(syn_opt_arg.next_list);
+ }
}
if (rest != NULL)
@@ -5896,6 +5901,8 @@ static void syntime_report(void)
static char *highlight_init_both[] =
{
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
+ "Cursor guibg=fg guifg=bg",
+ "lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
"ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White",
"IncSearch cterm=reverse gui=reverse",
@@ -5912,6 +5919,7 @@ static char *highlight_init_both[] =
"default link EndOfBuffer NonText",
"default link QuickFixLine Search",
"default link Substitute Search",
+ "default link Whitespace NonText",
NULL
};
@@ -6093,16 +6101,16 @@ int load_colors(char_u *name)
return retval;
}
-/*
- * Handle the ":highlight .." command.
- * When using ":hi clear" this is called recursively for each group with
- * "forceit" and "init" both TRUE.
- */
-void
-do_highlight (
+
+/// Handle the ":highlight .." command.
+/// When using ":hi clear" this is called recursively for each group with
+/// "forceit" and "init" both TRUE.
+/// @param init TRUE when called for initializing
+void
+do_highlight(
char_u *line,
int forceit,
- int init /* TRUE when called for initializing */
+ int init
)
{
char_u *name_end;
@@ -6704,12 +6712,10 @@ static garray_T attr_table = GA_EMPTY_INIT_VALUE;
#define ATTR_ENTRY(idx) ((attrentry_T *)attr_table.ga_data)[idx]
-/*
- * Return the attr number for a set of colors and font.
- * Add a new entry to the term_attr_table, attr_table or gui_attr_table
- * if the combination is new.
- * Return 0 for error.
- */
+/// Return the attr number for a set of colors and font.
+/// Add a new entry to the term_attr_table, attr_table or gui_attr_table
+/// if the combination is new.
+/// @return 0 for error.
int get_attr_entry(attrentry_T *aep)
{
garray_T *table = &attr_table;
@@ -6932,7 +6938,7 @@ static int highlight_list_arg(int id, int didh, int type, int iarg, char_u *sarg
/// Check whether highlight group has attribute
///
-/// @param[in] id Highilght group to check.
+/// @param[in] id Highlight group to check.
/// @param[in] flag Attribute to check.
/// @param[in] modec 'g' for GUI, 'c' for term.
///
@@ -7165,12 +7171,13 @@ int syn_namen2id(char_u *linep, int len)
return id;
}
-/*
- * Find highlight group name in the table and return it's ID.
- * The argument is a pointer to the name and the length of the name.
- * If it doesn't exist yet, a new entry is created.
- * Return 0 for failure.
- */
+/// Find highlight group name in the table and return it's ID.
+/// If it doesn't exist yet, a new entry is created.
+///
+/// @param pp Highlight group name
+/// @param len length of \p pp
+///
+/// @return 0 for failure else the id of the group
int syn_check_group(char_u *pp, int len)
{
char_u *name = vim_strnsave(pp, len);
@@ -8244,7 +8251,14 @@ color_name_table_T color_name_table[] = {
{ NULL, 0 },
};
-RgbValue name_to_color(uint8_t *name)
+
+/// Translate to RgbValue if \p name is an hex value (e.g. #XXXXXX),
+/// else look into color_name_table to translate a color name to its
+/// hex value
+///
+/// @param[in] name string value to convert to RGB
+/// return the hex value or -1 if could not find a correct value
+RgbValue name_to_color(const uint8_t *name)
{
if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2])
diff --git a/src/nvim/syntax.h b/src/nvim/syntax.h
index af2ac719c6..bb733ead30 100644
--- a/src/nvim/syntax.h
+++ b/src/nvim/syntax.h
@@ -4,11 +4,12 @@
#include <stdbool.h>
#include "nvim/buffer_defs.h"
+#include "nvim/ex_cmds_defs.h"
-/*
- * Terminal highlighting attribute bits.
- * Attributes above HL_ALL are used for syntax highlighting.
- */
+/// Terminal highlighting attribute bits.
+/// Attributes above HL_ALL are used for syntax highlighting.
+/// \addtogroup HL_ATTRIBUTES
+/// @{
#define HL_NORMAL 0x00
#define HL_INVERSE 0x01
#define HL_BOLD 0x02
@@ -16,6 +17,7 @@
#define HL_UNDERLINE 0x08
#define HL_UNDERCURL 0x10
#define HL_STANDOUT 0x20
+/// @}
#define HL_CONTAINED 0x01 /* not used on toplevel */
#define HL_TRANSP 0x02 /* has no highlighting */
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index b812dd2ffd..b8b86bf979 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* Code to handle tags and the tag stack
*/
@@ -1222,9 +1225,9 @@ find_tags (
if (has_re && orgpat.regmatch.regprog == NULL)
goto findtag_end;
- /* This is only to avoid a compiler warning for using search_info
- * uninitialised. */
- memset(&search_info, 0, (size_t)1);
+ // This is only to avoid a compiler warning for using search_info
+ // uninitialised.
+ memset(&search_info, 0, 1); // -V512
/*
* When finding a specified number of matches, first try with matching
@@ -1847,14 +1850,14 @@ parse_line:
}
}
} else {
-#define TAG_SEP 0x01
+#define TAG_SEP 0x02
size_t tag_fname_len = STRLEN(tag_fname);
// Save the tag in a buffer.
- // Use 0x01 to separate fields (Can't use NUL, because the
+ // Use 0x02 to separate fields (Can't use NUL, because the
// hash key is terminated by NUL).
- // Emacs tag: <mtt><tag_fname><NUL><ebuf><NUL><lbuf>
- // other tag: <mtt><tag_fname><NUL><NUL><lbuf>
- // without Emacs tags: <mtt><tag_fname><NUL><lbuf>
+ // Emacs tag: <mtt><tag_fname><0x02><ebuf><0x02><lbuf><NUL>
+ // other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL>
+ // without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL>
// Here <mtt> is the "mtt" value plus 1 to avoid NUL.
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
mfp = xmalloc(sizeof(char_u) + len + 1);
@@ -2534,7 +2537,7 @@ jumpto_tag (
}
}
p_ws = save_p_ws;
- p_ic = save_p_ic;
+ p_ic = save_p_ic; // -V519
p_scs = save_p_scs;
/* A search command may have positioned the cursor beyond the end
@@ -2797,11 +2800,9 @@ add_tag_field (
return retval;
}
-/*
- * Add the tags matching the specified pattern to the list "list"
- * as a dictionary
- */
-int get_tags(list_T *list, char_u *pat)
+/// Add the tags matching the specified pattern "pat" to the list "list"
+/// as a dictionary. Use "buf_fname" for priority, unless NULL.
+int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
{
int num_matches, i, ret;
char_u **matches, *p;
@@ -2811,7 +2812,7 @@ int get_tags(list_T *list, char_u *pat)
bool is_static;
ret = find_tags(pat, &num_matches, &matches,
- TAG_REGEXP | TAG_NOIC, (int)MAXCOL, NULL);
+ TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname);
if (ret == OK && num_matches > 0) {
for (i = 0; i < num_matches; ++i) {
int parse_result = parse_match(matches[i], &tp);
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 85c4950b42..c44fe15be5 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// VT220/xterm-like terminal emulator.
// Powered by libvterm http://www.leonerd.org.uk/code/libvterm
//
@@ -630,13 +633,14 @@ static int term_movecursor(VTermPos new, VTermPos old, int visible,
static void buf_set_term_title(buf_T *buf, char *title)
FUNC_ATTR_NONNULL_ALL
{
- Error err;
+ Error err = ERROR_INIT;
dict_set_var(buf->b_vars,
STATIC_CSTR_AS_STRING("term_title"),
STRING_OBJ(cstr_as_string(title)),
false,
false,
&err);
+ api_clear_error(&err);
}
static int term_settermprop(VTermProp prop, VTermValue *val, void *data)
@@ -1217,12 +1221,14 @@ static bool is_focused(Terminal *term)
#define GET_CONFIG_VALUE(k, o) \
do { \
- Error err; \
+ Error err = ERROR_INIT; \
/* Only called from terminal_open where curbuf->terminal is the */ \
/* context */ \
o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \
+ api_clear_error(&err); \
if (o.type == kObjectTypeNil) { \
o = dict_get_value(&globvardict, cstr_as_string(k), &err); \
+ api_clear_error(&err); \
} \
} while (0)
diff --git a/src/nvim/testdir/samples/memfile_test.c b/src/nvim/testdir/samples/memfile_test.c
index 0fa1e14c40..3c8f108255 100644
--- a/src/nvim/testdir/samples/memfile_test.c
+++ b/src/nvim/testdir/samples/memfile_test.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index baf49b7ff7..99d9835996 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/testdir/test_alot.vim
@@ -26,6 +26,7 @@ source test_tabline.vim
" source test_tabpage.vim
source test_tagcase.vim
source test_tagjump.vim
+source test_taglist.vim
source test_true_false.vim
source test_unlet.vim
source test_utf8.vim
diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim
index 976c6b5cd1..46c54e8614 100644
--- a/src/nvim/testdir/test_fold.vim
+++ b/src/nvim/testdir/test_fold.vim
@@ -100,22 +100,6 @@ func! Test_indent_fold2()
bw!
endfunc
-func Test_folds_marker_in_comment()
- new
- call setline(1, ['" foo', 'bar', 'baz'])
- setl fen fdm=marker
- setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s
- norm! zf2j
- setl nofen
- :1y
- call assert_equal(['" foo{{{'], getreg(0,1,1))
- :+2y
- call assert_equal(['baz"}}}'], getreg(0,1,1))
-
- set foldmethod&
- bwipe!
-endfunc
-
func Test_manual_fold_with_filter()
if !executable('cat')
return
@@ -138,6 +122,108 @@ func Test_manual_fold_with_filter()
endfor
endfunc
+func! Test_indent_fold_with_read()
+ new
+ set foldmethod=indent
+ call setline(1, repeat(["\<Tab>a"], 4))
+ for n in range(1, 4)
+ call assert_equal(1, foldlevel(n))
+ endfor
+
+ call writefile(["a", "", "\<Tab>a"], 'Xfile')
+ foldopen
+ 2read Xfile
+ %foldclose
+ call assert_equal(1, foldlevel(1))
+ call assert_equal(2, foldclosedend(1))
+ call assert_equal(0, foldlevel(3))
+ call assert_equal(0, foldlevel(4))
+ call assert_equal(1, foldlevel(5))
+ call assert_equal(7, foldclosedend(5))
+
+ bwipe!
+ set foldmethod&
+ call delete('Xfile')
+endfunc
+
+func Test_combining_folds_indent()
+ new
+ let one = "\<Tab>a"
+ let zero = 'a'
+ call setline(1, [one, one, zero, zero, zero, one, one, one])
+ set foldmethod=indent
+ 3,5d
+ %foldclose
+ call assert_equal(5, foldclosedend(1))
+
+ set foldmethod&
+ bwipe!
+endfunc
+
+func Test_combining_folds_marker()
+ new
+ call setline(1, ['{{{', '}}}', '', '', '', '{{{', '', '}}}'])
+ set foldmethod=marker
+ 3,5d
+ %foldclose
+ call assert_equal(2, foldclosedend(1))
+
+ set foldmethod&
+ bwipe!
+endfunc
+
+func Test_folds_marker_in_comment()
+ new
+ call setline(1, ['" foo', 'bar', 'baz'])
+ setl fen fdm=marker
+ setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s
+ norm! zf2j
+ setl nofen
+ :1y
+ call assert_equal(['" foo{{{'], getreg(0,1,1))
+ :+2y
+ call assert_equal(['baz"}}}'], getreg(0,1,1))
+
+ set foldmethod&
+ bwipe!
+endfunc
+
+func s:TestFoldExpr(lnum)
+ let thisline = getline(a:lnum)
+ if thisline == 'a'
+ return 1
+ elseif thisline == 'b'
+ return 0
+ elseif thisline == 'c'
+ return '<1'
+ elseif thisline == 'd'
+ return '>1'
+ endif
+ return 0
+endfunction
+
+func Test_update_folds_expr_read()
+ new
+ call setline(1, ['a', 'a', 'a', 'a', 'a', 'a'])
+ set foldmethod=expr
+ set foldexpr=s:TestFoldExpr(v:lnum)
+ 2
+ foldopen
+ call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xfile')
+ read Xfile
+ %foldclose
+ call assert_equal(2, foldclosedend(1))
+ call assert_equal(0, foldlevel(3))
+ call assert_equal(0, foldlevel(4))
+ call assert_equal(6, foldclosedend(5))
+ call assert_equal(10, foldclosedend(7))
+ call assert_equal(14, foldclosedend(11))
+
+ call delete('Xfile')
+ bwipe!
+ set foldmethod& foldexpr&
+endfunc
+
func! Test_move_folds_around_manual()
new
let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c")
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 81cb6314ce..3c258299c1 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -29,3 +29,147 @@ func Test_setbufvar_options()
bwipe!
endfunc
+func Test_tolower()
+ call assert_equal("", tolower(""))
+
+ " Test with all printable ASCII characters.
+ call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~',
+ \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
+
+ if !has('multi_byte')
+ return
+ endif
+
+ " Test with a few uppercase diacritics.
+ call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ"))
+ call assert_equal("bḃḇ", tolower("BḂḆ"))
+ call assert_equal("cçćĉċč", tolower("CÇĆĈĊČ"))
+ call assert_equal("dďđḋḏḑ", tolower("DĎĐḊḎḐ"))
+ call assert_equal("eèéêëēĕėęěẻẽ", tolower("EÈÉÊËĒĔĖĘĚẺẼ"))
+ call assert_equal("fḟ ", tolower("FḞ "))
+ call assert_equal("gĝğġģǥǧǵḡ", tolower("GĜĞĠĢǤǦǴḠ"))
+ call assert_equal("hĥħḣḧḩ", tolower("HĤĦḢḦḨ"))
+ call assert_equal("iìíîïĩīĭįiǐỉ", tolower("IÌÍÎÏĨĪĬĮİǏỈ"))
+ call assert_equal("jĵ", tolower("JĴ"))
+ call assert_equal("kķǩḱḵ", tolower("KĶǨḰḴ"))
+ call assert_equal("lĺļľŀłḻ", tolower("LĹĻĽĿŁḺ"))
+ call assert_equal("mḿṁ", tolower("MḾṀ"))
+ call assert_equal("nñńņňṅṉ", tolower("NÑŃŅŇṄṈ"))
+ call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ"))
+ call assert_equal("pṕṗ", tolower("PṔṖ"))
+ call assert_equal("q", tolower("Q"))
+ call assert_equal("rŕŗřṙṟ", tolower("RŔŖŘṘṞ"))
+ call assert_equal("sśŝşšṡ", tolower("SŚŜŞŠṠ"))
+ call assert_equal("tţťŧṫṯ", tolower("TŢŤŦṪṮ"))
+ call assert_equal("uùúûüũūŭůűųưǔủ", tolower("UÙÚÛÜŨŪŬŮŰŲƯǓỦ"))
+ call assert_equal("vṽ", tolower("VṼ"))
+ call assert_equal("wŵẁẃẅẇ", tolower("WŴẀẂẄẆ"))
+ call assert_equal("xẋẍ", tolower("XẊẌ"))
+ call assert_equal("yýŷÿẏỳỷỹ", tolower("YÝŶŸẎỲỶỸ"))
+ call assert_equal("zźżžƶẑẕ", tolower("ZŹŻŽƵẐẔ"))
+
+ " Test with a few lowercase diacritics, which should remain unchanged.
+ call assert_equal("aàáâãäåāăąǎǟǡả", tolower("aàáâãäåāăąǎǟǡả"))
+ call assert_equal("bḃḇ", tolower("bḃḇ"))
+ call assert_equal("cçćĉċč", tolower("cçćĉċč"))
+ call assert_equal("dďđḋḏḑ", tolower("dďđḋḏḑ"))
+ call assert_equal("eèéêëēĕėęěẻẽ", tolower("eèéêëēĕėęěẻẽ"))
+ call assert_equal("fḟ", tolower("fḟ"))
+ call assert_equal("gĝğġģǥǧǵḡ", tolower("gĝğġģǥǧǵḡ"))
+ call assert_equal("hĥħḣḧḩẖ", tolower("hĥħḣḧḩẖ"))
+ call assert_equal("iìíîïĩīĭįǐỉ", tolower("iìíîïĩīĭįǐỉ"))
+ call assert_equal("jĵǰ", tolower("jĵǰ"))
+ call assert_equal("kķǩḱḵ", tolower("kķǩḱḵ"))
+ call assert_equal("lĺļľŀłḻ", tolower("lĺļľŀłḻ"))
+ call assert_equal("mḿṁ ", tolower("mḿṁ "))
+ call assert_equal("nñńņňʼnṅṉ", tolower("nñńņňʼnṅṉ"))
+ call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("oòóôõöøōŏőơǒǫǭỏ"))
+ call assert_equal("pṕṗ", tolower("pṕṗ"))
+ call assert_equal("q", tolower("q"))
+ call assert_equal("rŕŗřṙṟ", tolower("rŕŗřṙṟ"))
+ call assert_equal("sśŝşšṡ", tolower("sśŝşšṡ"))
+ call assert_equal("tţťŧṫṯẗ", tolower("tţťŧṫṯẗ"))
+ call assert_equal("uùúûüũūŭůűųưǔủ", tolower("uùúûüũūŭůűųưǔủ"))
+ call assert_equal("vṽ", tolower("vṽ"))
+ call assert_equal("wŵẁẃẅẇẘ", tolower("wŵẁẃẅẇẘ"))
+ call assert_equal("ẋẍ", tolower("ẋẍ"))
+ call assert_equal("yýÿŷẏẙỳỷỹ", tolower("yýÿŷẏẙỳỷỹ"))
+ call assert_equal("zźżžƶẑẕ", tolower("zźżžƶẑẕ"))
+
+ " According to https://twitter.com/jifa/status/625776454479970304
+ " Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase
+ " in length (2 to 3 bytes) when lowercased. So let's test them.
+ call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ"))
+endfunc
+
+func Test_toupper()
+ call assert_equal("", toupper(""))
+
+ " Test with all printable ASCII characters.
+ call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~',
+ \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'))
+
+ if !has('multi_byte')
+ return
+ endif
+
+ " Test with a few lowercase diacritics.
+ call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả"))
+ call assert_equal("BḂḆ", toupper("bḃḇ"))
+ call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč"))
+ call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ"))
+ call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("eèéêëēĕėęěẻẽ"))
+ call assert_equal("FḞ", toupper("fḟ"))
+ call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("gĝğġģǥǧǵḡ"))
+ call assert_equal("HĤĦḢḦḨẖ", toupper("hĥħḣḧḩẖ"))
+ call assert_equal("IÌÍÎÏĨĪĬĮǏỈ", toupper("iìíîïĩīĭįǐỉ"))
+ call assert_equal("JĴǰ", toupper("jĵǰ"))
+ call assert_equal("KĶǨḰḴ", toupper("kķǩḱḵ"))
+ call assert_equal("LĹĻĽĿŁḺ", toupper("lĺļľŀłḻ"))
+ call assert_equal("MḾṀ ", toupper("mḿṁ "))
+ call assert_equal("NÑŃŅŇʼnṄṈ", toupper("nñńņňʼnṅṉ"))
+ call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("oòóôõöøōŏőơǒǫǭỏ"))
+ call assert_equal("PṔṖ", toupper("pṕṗ"))
+ call assert_equal("Q", toupper("q"))
+ call assert_equal("RŔŖŘṘṞ", toupper("rŕŗřṙṟ"))
+ call assert_equal("SŚŜŞŠṠ", toupper("sśŝşšṡ"))
+ call assert_equal("TŢŤŦṪṮẗ", toupper("tţťŧṫṯẗ"))
+ call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("uùúûüũūŭůűųưǔủ"))
+ call assert_equal("VṼ", toupper("vṽ"))
+ call assert_equal("WŴẀẂẄẆẘ", toupper("wŵẁẃẅẇẘ"))
+ call assert_equal("ẊẌ", toupper("ẋẍ"))
+ call assert_equal("YÝŸŶẎẙỲỶỸ", toupper("yýÿŷẏẙỳỷỹ"))
+ call assert_equal("ZŹŻŽƵẐẔ", toupper("zźżžƶẑẕ"))
+
+ " Test that uppercase diacritics, which should remain unchanged.
+ call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("AÀÁÂÃÄÅĀĂĄǍǞǠẢ"))
+ call assert_equal("BḂḆ", toupper("BḂḆ"))
+ call assert_equal("CÇĆĈĊČ", toupper("CÇĆĈĊČ"))
+ call assert_equal("DĎĐḊḎḐ", toupper("DĎĐḊḎḐ"))
+ call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("EÈÉÊËĒĔĖĘĚẺẼ"))
+ call assert_equal("FḞ ", toupper("FḞ "))
+ call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("GĜĞĠĢǤǦǴḠ"))
+ call assert_equal("HĤĦḢḦḨ", toupper("HĤĦḢḦḨ"))
+ call assert_equal("IÌÍÎÏĨĪĬĮİǏỈ", toupper("IÌÍÎÏĨĪĬĮİǏỈ"))
+ call assert_equal("JĴ", toupper("JĴ"))
+ call assert_equal("KĶǨḰḴ", toupper("KĶǨḰḴ"))
+ call assert_equal("LĹĻĽĿŁḺ", toupper("LĹĻĽĿŁḺ"))
+ call assert_equal("MḾṀ", toupper("MḾṀ"))
+ call assert_equal("NÑŃŅŇṄṈ", toupper("NÑŃŅŇṄṈ"))
+ call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ"))
+ call assert_equal("PṔṖ", toupper("PṔṖ"))
+ call assert_equal("Q", toupper("Q"))
+ call assert_equal("RŔŖŘṘṞ", toupper("RŔŖŘṘṞ"))
+ call assert_equal("SŚŜŞŠṠ", toupper("SŚŜŞŠṠ"))
+ call assert_equal("TŢŤŦṪṮ", toupper("TŢŤŦṪṮ"))
+ call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("UÙÚÛÜŨŪŬŮŰŲƯǓỦ"))
+ call assert_equal("VṼ", toupper("VṼ"))
+ call assert_equal("WŴẀẂẄẆ", toupper("WŴẀẂẄẆ"))
+ call assert_equal("XẊẌ", toupper("XẊẌ"))
+ call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ"))
+ call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ"))
+
+ call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ"))
+endfunc
+
+
diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim
index d937565ce5..7f93ddd56e 100644
--- a/src/nvim/testdir/test_mapping.vim
+++ b/src/nvim/testdir/test_mapping.vim
@@ -35,29 +35,81 @@ func Test_map_ctrl_c_visual()
endfunc
func Test_map_langmap()
- " langmap should not get remapped in insert mode
- inoremap { FAIL_ilangmap
- set langmap=+{ langnoremap
+ if !has('langmap')
+ return
+ endif
+
+ " check langmap applies in normal mode
+ set langmap=+- nolangremap
+ new
+ call setline(1, ['a', 'b', 'c'])
+ 2
+ call assert_equal('b', getline('.'))
+ call feedkeys("+", "xt")
+ call assert_equal('a', getline('.'))
+
+ " check no remapping
+ map x +
+ 2
+ call feedkeys("x", "xt")
+ call assert_equal('c', getline('.'))
+
+ " check with remapping
+ set langremap
+ 2
+ call feedkeys("x", "xt")
+ call assert_equal('a', getline('.'))
+
+ unmap x
+ bwipe!
+
+ " 'langnoremap' follows 'langremap' and vise versa
+ set langremap
+ set langnoremap
+ call assert_equal(0, &langremap)
+ set langremap
+ call assert_equal(0, &langnoremap)
+ set nolangremap
+ call assert_equal(1, &langnoremap)
+
+ " check default values
+ set langnoremap&
+ call assert_equal(1, &langnoremap)
+ call assert_equal(0, &langremap)
+ set langremap&
+ call assert_equal(1, &langnoremap)
+ call assert_equal(0, &langremap)
+
+ " langmap should not apply in insert mode, 'langremap' doesn't matter
+ set langmap=+{ nolangremap
call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$'))
-
- " Insert-mode expr mapping with langmap
- inoremap <expr> { "FAIL_iexplangmap"
+ set langmap=+{ langremap
call feedkeys("Go+\<Esc>", "xt")
call assert_equal('+', getline('$'))
- iunmap <expr> {
- " langmap should not get remapped in Command-line mode
- cnoremap { FAIL_clangmap
+ " langmap used for register name in insert mode.
+ call setreg('a', 'aaaa')
+ call setreg('b', 'bbbb')
+ call setreg('c', 'cccc')
+ set langmap=ab langremap
+ call feedkeys("Go\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+ call feedkeys("Go\<C-R>\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+ " mapping does not apply
+ imap c a
+ call feedkeys("Go\<C-R>c\<Esc>", "xt")
+ call assert_equal('cccc', getline('$'))
+ imap a c
+ call feedkeys("Go\<C-R>a\<Esc>", "xt")
+ call assert_equal('bbbb', getline('$'))
+
+ " langmap should not apply in Command-line mode
+ set langmap=+{ nolangremap
call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
call assert_equal('+', getline('$'))
- cunmap {
- " Command-line mode expr mapping with langmap
- cnoremap <expr> { "FAIL_cexplangmap"
- call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
- call assert_equal('+', getline('$'))
- cunmap {
set nomodified
endfunc
@@ -98,3 +150,11 @@ func Test_break_undo()
call assert_equal('new line here', getline(line('$') - 1))
set nomodified
endfunc
+
+func Test_map_meta_quotes()
+ imap <M-"> foo
+ call feedkeys("Go-\<M-\">-\<Esc>", "xt")
+ call assert_equal("-foo-", getline('$'))
+ set nomodified
+ iunmap <M-">
+endfunc
diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim
index a22dca35cc..6261625801 100644
--- a/src/nvim/testdir/test_normal.vim
+++ b/src/nvim/testdir/test_normal.vim
@@ -1606,6 +1606,52 @@ fun! Test_normal30_changecase()
norm! V~
call assert_equal('THIS IS A simple test: äüöss', getline('.'))
+ " Turkish ASCII turns to multi-byte. On some systems Turkish locale
+ " is available but toupper()/tolower() don't do the right thing.
+ try
+ lang tr_TR.UTF-8
+ set casemap=
+ let iupper = toupper('i')
+ if iupper == "\u0130"
+ call setline(1, 'iI')
+ 1normal gUU
+ call assert_equal("\u0130I", getline(1))
+ call assert_equal("\u0130I", toupper("iI"))
+
+ call setline(1, 'iI')
+ 1normal guu
+ call assert_equal("i\u0131", getline(1))
+ call assert_equal("i\u0131", tolower("iI"))
+ elseif iupper == "I"
+ call setline(1, 'iI')
+ 1normal gUU
+ call assert_equal("II", getline(1))
+ call assert_equal("II", toupper("iI"))
+
+ call setline(1, 'iI')
+ 1normal guu
+ call assert_equal("ii", getline(1))
+ call assert_equal("ii", tolower("iI"))
+ else
+ call assert_true(false, "expected toupper('i') to be either 'I' or '\u0131'")
+ endif
+ set casemap&
+ call setline(1, 'iI')
+ 1normal gUU
+ call assert_equal("II", getline(1))
+ call assert_equal("II", toupper("iI"))
+
+ call setline(1, 'iI')
+ 1normal guu
+ call assert_equal("ii", getline(1))
+ call assert_equal("ii", tolower("iI"))
+
+ lang en_US.UTF-8
+ catch /E197:/
+ " can't use Turkish locale
+ throw 'Skipped: Turkish locale not available'
+ endtry
+
" clean up
bw!
endfunc
diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim
new file mode 100644
index 0000000000..2d1557ebd9
--- /dev/null
+++ b/src/nvim/testdir/test_taglist.vim
@@ -0,0 +1,58 @@
+" test 'taglist' function
+
+func Test_taglist()
+ call writefile([
+ \ "FFoo\tXfoo\t1",
+ \ "FBar\tXfoo\t2",
+ \ "BFoo\tXbar\t1",
+ \ "BBar\tXbar\t2"
+ \ ], 'Xtags')
+ set tags=Xtags
+ split Xtext
+
+ call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name}))
+ call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {i, v -> v.name}))
+ call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name}))
+ call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name}))
+
+ call delete('Xtags')
+ bwipe
+endfunc
+
+func Test_taglist_native_etags()
+ if !has('emacs_tags')
+ return
+ endif
+ call writefile([
+ \ "\x0c",
+ \ "src/os_unix.c,13491",
+ \ "set_signals(\x7f1335,32699",
+ \ "reset_signals(\x7f1407,34136",
+ \ ], 'Xtags')
+
+ set tags=Xtags
+
+ call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
+ \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
+
+ call delete('Xtags')
+endfunc
+
+func Test_taglist_ctags_etags()
+ if !has('emacs_tags')
+ return
+ endif
+ call writefile([
+ \ "\x0c",
+ \ "src/os_unix.c,13491",
+ \ "set_signals(void)\x7fset_signals\x011335,32699",
+ \ "reset_signals(void)\x7freset_signals\x011407,34136",
+ \ ], 'Xtags')
+
+ set tags=Xtags
+
+ call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
+ \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
+
+ call delete('Xtags')
+endfunc
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim
index 56f9feef66..d377062780 100644
--- a/src/nvim/testdir/test_timers.vim
+++ b/src/nvim/testdir/test_timers.vim
@@ -4,8 +4,10 @@ if !has('timers')
finish
endif
+source shared.vim
+
func MyHandler(timer)
- let s:val += 1
+ let g:val += 1
endfunc
func MyHandlerWithLists(lists, timer)
@@ -13,44 +15,159 @@ func MyHandlerWithLists(lists, timer)
endfunc
func Test_oneshot()
- let s:val = 0
+ let g:val = 0
let timer = timer_start(50, 'MyHandler')
- sleep 200m
- call assert_equal(1, s:val)
+ let slept = WaitFor('g:val == 1')
+ call assert_equal(1, g:val)
+ if has('reltime')
+ call assert_inrange(40, 100, slept)
+ else
+ call assert_inrange(20, 100, slept)
+ endif
endfunc
func Test_repeat_three()
- let s:val = 0
+ let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': 3})
- sleep 500m
- call assert_equal(3, s:val)
+ let slept = WaitFor('g:val == 3')
+ call assert_equal(3, g:val)
+ if has('reltime')
+ call assert_inrange(120, 250, slept)
+ else
+ call assert_inrange(80, 200, slept)
+ endif
endfunc
func Test_repeat_many()
- let s:val = 0
+ let g:val = 0
let timer = timer_start(50, 'MyHandler', {'repeat': -1})
sleep 200m
call timer_stop(timer)
- call assert_true(s:val > 1)
- call assert_true(s:val < 5)
+ call assert_inrange(2, 4, g:val)
endfunc
func Test_with_partial_callback()
- let s:val = 0
- let s:meow = {}
- function s:meow.bite(...)
- let s:val += 1
+ let g:val = 0
+ let meow = {'one': 1}
+ function meow.bite(...)
+ let g:val += self.one
endfunction
- call timer_start(50, s:meow.bite)
- sleep 200m
- call assert_equal(1, s:val)
+ call timer_start(50, meow.bite)
+ let slept = WaitFor('g:val == 1')
+ call assert_equal(1, g:val)
+ if has('reltime')
+ call assert_inrange(40, 130, slept)
+ else
+ call assert_inrange(20, 100, slept)
+ endif
endfunc
func Test_retain_partial()
- call timer_start(100, function('MyHandlerWithLists', [['a']]))
+ call timer_start(50, function('MyHandlerWithLists', [['a']]))
call garbagecollect()
+ sleep 100m
+endfunc
+
+func Test_info()
+ let id = timer_start(1000, 'MyHandler')
+ let info = timer_info(id)
+ call assert_equal(id, info[0]['id'])
+ call assert_equal(1000, info[0]['time'])
+ call assert_equal("function('MyHandler')", string(info[0]['callback']))
+
+ let found = 0
+ for info in timer_info()
+ if info['id'] == id
+ let found += 1
+ endif
+ endfor
+ call assert_equal(1, found)
+
+ call timer_stop(id)
+ call assert_equal([], timer_info(id))
+endfunc
+
+func Test_stopall()
+ let id1 = timer_start(1000, 'MyHandler')
+ let id2 = timer_start(2000, 'MyHandler')
+ let info = timer_info()
+ call assert_equal(2, len(info))
+
+ call timer_stopall()
+ let info = timer_info()
+ call assert_equal(0, len(info))
+endfunc
+
+func Test_paused()
+ let g:val = 0
+
+ let id = timer_start(50, 'MyHandler')
+ let info = timer_info(id)
+ call assert_equal(0, info[0]['paused'])
+
+ call timer_pause(id, 1)
+ let info = timer_info(id)
+ call assert_equal(1, info[0]['paused'])
sleep 200m
+ call assert_equal(0, g:val)
+
+ call timer_pause(id, 0)
+ let info = timer_info(id)
+ call assert_equal(0, info[0]['paused'])
+
+ let slept = WaitFor('g:val == 1')
+ call assert_equal(1, g:val)
+ if has('reltime')
+ call assert_inrange(0, 60, slept)
+ else
+ call assert_inrange(0, 10, slept)
+ endif
endfunc
+func StopMyself(timer)
+ let g:called += 1
+ if g:called == 2
+ call timer_stop(a:timer)
+ endif
+endfunc
+
+func Test_delete_myself()
+ let g:called = 0
+ let t = timer_start(10, 'StopMyself', {'repeat': -1})
+ call WaitFor('g:called == 2')
+ call assert_equal(2, g:called)
+ call assert_equal([], timer_info(t))
+endfunc
+
+func StopTimer1(timer)
+ let g:timer2 = timer_start(10, 'StopTimer2')
+ " avoid maxfuncdepth error
+ call timer_pause(g:timer1, 1)
+ sleep 40m
+endfunc
+
+func StopTimer2(timer)
+ call timer_stop(g:timer1)
+endfunc
+
+func Test_stop_in_callback()
+ let g:timer1 = timer_start(10, 'StopTimer1')
+ sleep 40m
+endfunc
+
+func StopTimerAll(timer)
+ call timer_stopall()
+endfunc
+
+func Test_stop_all_in_callback()
+ let g:timer1 = timer_start(10, 'StopTimerAll')
+ let info = timer_info()
+ call assert_equal(1, len(info))
+ sleep 40m
+ let info = timer_info()
+ call assert_equal(0, len(info))
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 8e5adb14f9..b86ab8cf2f 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include "nvim/tui/input.h"
#include "nvim/vim.h"
@@ -220,12 +223,14 @@ static int get_key_code_timeout(void)
{
Integer ms = -1;
// Check 'ttimeout' to determine if we should send ESC after 'ttimeoutlen'.
- // See :help 'ttimeout' for more information
Error err = ERROR_INIT;
if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) {
- ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer;
+ Object rv = nvim_get_option(cstr_as_string("ttimeoutlen"), &err);
+ if (!ERROR_SET(&err)) {
+ ms = rv.data.integer;
+ }
}
-
+ api_clear_error(&err);
return (int)ms;
}
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 55936ad58d..ae7551098d 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// Terminal UI functions. Invoked (by ui_bridge.c) on the TUI thread.
#include <assert.h>
@@ -31,6 +34,8 @@
#include "nvim/ugrid.h"
#include "nvim/tui/input.h"
#include "nvim/tui/tui.h"
+#include "nvim/cursor_shape.h"
+#include "nvim/syntax.h"
// Space reserved in the output buffer to restore the cursor to normal when
// flushing. No existing terminal will require 32 bytes to do that.
@@ -38,6 +43,15 @@
#define OUTBUF_SIZE 0xffff
#define TOO_MANY_EVENTS 1000000
+#define STARTS_WITH(str, prefix) (!memcmp(str, prefix, sizeof(prefix) - 1))
+
+typedef enum TermType {
+ kTermUnknown,
+ kTermGnome,
+ kTermiTerm,
+ kTermKonsole,
+ kTermRxvt,
+} TermType;
typedef struct {
int top, bot, left, right;
@@ -69,18 +83,21 @@ typedef struct {
bool can_use_terminal_scroll;
bool mouse_enabled;
bool busy;
+ cursorentry_T cursor_shapes[SHAPE_IDX_COUNT];
HlAttrs print_attrs;
- int showing_mode;
+ ModeShape showing_mode;
+ TermType term;
struct {
int enable_mouse, disable_mouse;
int enable_bracketed_paste, disable_bracketed_paste;
- int set_cursor_shape_bar, set_cursor_shape_ul, set_cursor_shape_block;
int set_rgb_foreground, set_rgb_background;
+ int set_cursor_color;
int enable_focus_reporting, disable_focus_reporting;
} unibi_ext;
} TUIData;
static bool volatile got_winch = false;
+static bool cursor_style_enabled = false;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "tui/tui.c.generated.h"
@@ -97,6 +114,7 @@ UI *tui_start(void)
ui->clear = tui_clear;
ui->eol_clear = tui_eol_clear;
ui->cursor_goto = tui_cursor_goto;
+ ui->mode_info_set = tui_mode_info_set;
ui->update_menu = tui_update_menu;
ui->busy_start = tui_busy_start;
ui->busy_stop = tui_busy_stop;
@@ -126,14 +144,12 @@ static void terminfo_start(UI *ui)
data->can_use_terminal_scroll = true;
data->bufpos = 0;
data->bufsize = sizeof(data->buf) - CNORM_COMMAND_MAX_SIZE;
- data->showing_mode = 0;
+ data->showing_mode = SHAPE_IDX_N;
data->unibi_ext.enable_mouse = -1;
data->unibi_ext.disable_mouse = -1;
+ data->unibi_ext.set_cursor_color = -1;
data->unibi_ext.enable_bracketed_paste = -1;
data->unibi_ext.disable_bracketed_paste = -1;
- data->unibi_ext.set_cursor_shape_bar = -1;
- data->unibi_ext.set_cursor_shape_ul = -1;
- data->unibi_ext.set_cursor_shape_block = -1;
data->unibi_ext.enable_focus_reporting = -1;
data->unibi_ext.disable_focus_reporting = -1;
data->out_fd = 1;
@@ -146,11 +162,10 @@ static void terminfo_start(UI *ui)
data->ut = unibi_dummy();
}
fix_terminfo(data);
- // Initialize the cursor shape.
- unibi_out(ui, data->unibi_ext.set_cursor_shape_block);
// Set 't_Co' from the result of unibilium & fix_terminfo.
t_colors = unibi_get_num(data->ut, unibi_max_colors);
// Enter alternate screen and clear
+ // NOTE: Do this *before* changing terminal settings. #6433
unibi_out(ui, unibi_enter_ca_mode);
unibi_out(ui, unibi_clear_screen);
// Enable bracketed paste
@@ -171,7 +186,7 @@ static void terminfo_stop(UI *ui)
{
TUIData *data = ui->data;
// Destroy output stuff
- tui_mode_change(ui, NORMAL);
+ tui_mode_change(ui, SHAPE_IDX_N);
tui_mouse_off(ui);
unibi_out(ui, unibi_exit_attribute_mode);
// cursor should be set to normal before exiting alternate screen
@@ -434,6 +449,62 @@ static void tui_cursor_goto(UI *ui, int row, int col)
unibi_goto(ui, row, col);
}
+CursorShape tui_cursor_decode_shape(const char *shape_str)
+{
+ CursorShape shape = 0;
+ if (strequal(shape_str, "block")) {
+ shape = SHAPE_BLOCK;
+ } else if (strequal(shape_str, "vertical")) {
+ shape = SHAPE_VER;
+ } else if (strequal(shape_str, "horizontal")) {
+ shape = SHAPE_HOR;
+ } else {
+ EMSG2(_(e_invarg2), shape_str);
+ }
+ return shape;
+}
+
+static cursorentry_T decode_cursor_entry(Dictionary args)
+{
+ cursorentry_T r;
+
+ for (size_t i = 0; i < args.size; i++) {
+ char *key = args.items[i].key.data;
+ Object value = args.items[i].value;
+
+ if (strequal(key, "cursor_shape")) {
+ r.shape = tui_cursor_decode_shape(args.items[i].value.data.string.data);
+ } else if (strequal(key, "blinkon")) {
+ r.blinkon = (int)value.data.integer;
+ } else if (strequal(key, "blinkoff")) {
+ r.blinkoff = (int)value.data.integer;
+ } else if (strequal(key, "hl_id")) {
+ r.id = (int)value.data.integer;
+ }
+ }
+ return r;
+}
+
+static void tui_mode_info_set(UI *ui, bool guicursor_enabled, Array args)
+{
+ cursor_style_enabled = guicursor_enabled;
+ if (!guicursor_enabled) {
+ return; // Do not send cursor style control codes.
+ }
+ TUIData *data = ui->data;
+
+ assert(args.size);
+
+ // cursor style entries as defined by `shape_table`.
+ for (size_t i = 0; i < args.size; i++) {
+ assert(args.items[i].type == kObjectTypeDictionary);
+ cursorentry_T r = decode_cursor_entry(args.items[i].data.dictionary);
+ data->cursor_shapes[i] = r;
+ }
+
+ tui_set_mode(ui, data->showing_mode);
+}
+
static void tui_update_menu(UI *ui)
{
// Do nothing; menus are for GUI only
@@ -452,44 +523,86 @@ static void tui_busy_stop(UI *ui)
static void tui_mouse_on(UI *ui)
{
TUIData *data = ui->data;
- unibi_out(ui, data->unibi_ext.enable_mouse);
- data->mouse_enabled = true;
+ if (!data->mouse_enabled) {
+ unibi_out(ui, data->unibi_ext.enable_mouse);
+ data->mouse_enabled = true;
+ }
}
static void tui_mouse_off(UI *ui)
{
TUIData *data = ui->data;
- unibi_out(ui, data->unibi_ext.disable_mouse);
- data->mouse_enabled = false;
+ if (data->mouse_enabled) {
+ unibi_out(ui, data->unibi_ext.disable_mouse);
+ data->mouse_enabled = false;
+ }
}
-static void tui_mode_change(UI *ui, int mode)
+static void tui_set_mode(UI *ui, ModeShape mode)
{
+ if (!cursor_style_enabled) {
+ return;
+ }
TUIData *data = ui->data;
+ cursorentry_T c = data->cursor_shapes[mode];
+ int shape = c.shape;
+ bool is_tmux = os_getenv("TMUX") != NULL;
+ unibi_var_t vars[26 + 26] = { { 0 } };
- if (mode == INSERT) {
- if (data->showing_mode != INSERT) {
- unibi_out(ui, data->unibi_ext.set_cursor_shape_bar);
- }
- } else if (mode == CMDLINE) {
- if (data->showing_mode != CMDLINE) {
- unibi_out(ui, data->unibi_ext.set_cursor_shape_bar);
- }
- } else if (mode == REPLACE) {
- if (data->showing_mode != REPLACE) {
- unibi_out(ui, data->unibi_ext.set_cursor_shape_ul);
+# define TMUX_WRAP(seq) (is_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq)
+ // Support changing cursor shape on some popular terminals.
+ const char *vte_version = os_getenv("VTE_VERSION");
+
+ if (data->term == kTermKonsole) {
+ // Konsole uses a proprietary escape code to set the cursor shape
+ // and does not support DECSCUSR.
+ switch (shape) {
+ case SHAPE_BLOCK: shape = 0; break;
+ case SHAPE_VER: shape = 1; break;
+ case SHAPE_HOR: shape = 2; break;
+ default: WLOG("Unknown shape value %d", shape); break;
}
- } else {
- assert(mode == NORMAL);
- if (data->showing_mode != NORMAL) {
- unibi_out(ui, data->unibi_ext.set_cursor_shape_block);
+ data->params[0].i = shape;
+ data->params[1].i = (c.blinkon == 0);
+
+ unibi_format(vars, vars + 26,
+ TMUX_WRAP("\x1b]50;CursorShape=%p1%d;BlinkingCursorEnabled=%p2%d\x07"),
+ data->params, out, ui, NULL, NULL);
+ } else if (!vte_version || atoi(vte_version) >= 3900) {
+ // Assume that the terminal supports DECSCUSR unless it is an
+ // old VTE based terminal. This should not get wrapped for tmux,
+ // which will handle it via its Ss/Se terminfo extension - usually
+ // according to its terminal-overrides.
+
+ switch (shape) {
+ case SHAPE_BLOCK: shape = 1; break;
+ case SHAPE_VER: shape = 5; break;
+ case SHAPE_HOR: shape = 3; break;
+ default: WLOG("Unknown shape value %d", shape); break;
}
+ data->params[0].i = shape + (c.blinkon ==0);
+ unibi_format(vars, vars + 26, "\x1b[%p1%d q",
+ data->params, out, ui, NULL, NULL);
+ }
+
+ if (c.id != 0 && ui->rgb) {
+ int attr = syn_id2attr(c.id);
+ attrentry_T *aep = syn_cterm_attr2entry(attr);
+ data->params[0].i = aep->rgb_bg_color;
+ unibi_out(ui, data->unibi_ext.set_cursor_color);
}
- data->showing_mode = mode;
+}
+
+/// @param mode editor mode
+static void tui_mode_change(UI *ui, int mode_idx)
+{
+ TUIData *data = ui->data;
+ tui_set_mode(ui, (ModeShape)mode_idx);
+ data->showing_mode = (ModeShape)mode_idx;
}
static void tui_set_scroll_region(UI *ui, int top, int bot, int left,
- int right)
+ int right)
{
TUIData *data = ui->data;
ugrid_set_scroll_region(&data->grid, top, bot, left, right);
@@ -817,6 +930,24 @@ static void unibi_set_if_empty(unibi_term *ut, enum unibi_string str,
}
}
+static TermType detect_term(const char *term, const char *colorterm)
+{
+ if (STARTS_WITH(term, "rxvt")) {
+ return kTermRxvt;
+ }
+ if (os_getenv("KONSOLE_PROFILE_NAME") || os_getenv("KONSOLE_DBUS_SESSION")) {
+ return kTermKonsole;
+ }
+ const char *termprg = os_getenv("TERM_PROGRAM");
+ if (termprg && strstr(termprg, "iTerm.app")) {
+ return kTermiTerm;
+ }
+ if (colorterm && strstr(colorterm, "gnome-terminal")) {
+ return kTermGnome;
+ }
+ return kTermUnknown;
+}
+
static void fix_terminfo(TUIData *data)
{
unibi_term *ut = data->ut;
@@ -826,12 +957,9 @@ static void fix_terminfo(TUIData *data)
if (!term) {
goto end;
}
+ data->term = detect_term(term, colorterm);
- bool inside_tmux = os_getenv("TMUX") != NULL;
-
-#define STARTS_WITH(str, prefix) (!memcmp(str, prefix, sizeof(prefix) - 1))
-
- if (STARTS_WITH(term, "rxvt")) {
+ if (data->term == kTermRxvt) {
unibi_set_if_empty(ut, unibi_exit_attribute_mode, "\x1b[m\x1b(B");
unibi_set_if_empty(ut, unibi_flash_screen, "\x1b[?5h$<20/>\x1b[?5l");
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
@@ -843,7 +971,7 @@ static void fix_terminfo(TUIData *data)
unibi_set_if_empty(ut, unibi_from_status_line, "\x1b\\");
}
- if (STARTS_WITH(term, "xterm") || STARTS_WITH(term, "rxvt")) {
+ if (STARTS_WITH(term, "xterm") || data->term == kTermRxvt) {
const char *normal = unibi_get_str(ut, unibi_cursor_normal);
if (!normal) {
unibi_set_str(ut, unibi_cursor_normal, "\x1b[?25h");
@@ -880,48 +1008,21 @@ static void fix_terminfo(TUIData *data)
if ((colorterm && strstr(colorterm, "256"))
|| strstr(term, "256")
|| strstr(term, "xterm")) {
- // Assume TERM~=xterm or COLORTERM~=256 supports 256 colors.
+ // Assume TERM=~xterm or COLORTERM=~256 supports 256 colors.
unibi_set_num(ut, unibi_max_colors, 256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB);
}
- const char * env_cusr_shape = os_getenv("NVIM_TUI_ENABLE_CURSOR_SHAPE");
- if (env_cusr_shape && strncmp(env_cusr_shape, "0", 1) == 0) {
- goto end;
- }
- bool cusr_blink = env_cusr_shape && strncmp(env_cusr_shape, "2", 1) == 0;
-
-#define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq)
- // Support changing cursor shape on some popular terminals.
- const char *term_prog = os_getenv("TERM_PROGRAM");
- const char *vte_version = os_getenv("VTE_VERSION");
-
- if ((term_prog && !strcmp(term_prog, "Konsole"))
- || os_getenv("KONSOLE_DBUS_SESSION") != NULL) {
- // Konsole uses a proprietary escape code to set the cursor shape
- // and does not support DECSCUSR.
- data->unibi_ext.set_cursor_shape_bar = (int)unibi_add_ext_str(ut, NULL,
- TMUX_WRAP("\x1b]50;CursorShape=1\x07"));
- data->unibi_ext.set_cursor_shape_ul = (int)unibi_add_ext_str(ut, NULL,
- TMUX_WRAP("\x1b]50;CursorShape=2\x07"));
- data->unibi_ext.set_cursor_shape_block = (int)unibi_add_ext_str(ut, NULL,
- TMUX_WRAP("\x1b]50;CursorShape=0\x07"));
- } else if (!vte_version || atoi(vte_version) >= 3900) {
- // Assume that the terminal supports DECSCUSR unless it is an
- // old VTE based terminal. This should not get wrapped for tmux,
- // which will handle it via its Ss/Se terminfo extension - usually
- // according to its terminal-overrides.
- data->unibi_ext.set_cursor_shape_bar =
- (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[5 q" : "\x1b[6 q");
- data->unibi_ext.set_cursor_shape_ul =
- (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[3 q" : "\x1b[4 q");
- data->unibi_ext.set_cursor_shape_block =
- (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[1 q" : "\x1b[2 q");
- }
-
end:
// Fill some empty slots with common terminal strings
+ if (data->term == kTermiTerm) {
+ data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(
+ ut, NULL, "\033]Pl%p1%06x\033\\");
+ } else {
+ data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str(
+ ut, NULL, "\033]12;#%p1%06x\007");
+ }
data->unibi_ext.enable_mouse = (int)unibi_add_ext_str(ut, NULL,
"\x1b[?1002h\x1b[?1006h");
data->unibi_ext.disable_mouse = (int)unibi_add_ext_str(ut, NULL,
@@ -1006,15 +1107,15 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value,
stty_erase = tui_get_stty_erase();
}
- if (strcmp(name, "key_backspace") == 0) {
+ if (strequal(name, "key_backspace")) {
ILOG("libtermkey:kbs=%s", value);
if (stty_erase != NULL && stty_erase[0] != 0) {
return stty_erase;
}
- } else if (strcmp(name, "key_dc") == 0) {
+ } else if (strequal(name, "key_dc")) {
ILOG("libtermkey:kdch1=%s", value);
// Vim: "If <BS> and <DEL> are now the same, redefine <DEL>."
- if (stty_erase != NULL && value != NULL && strcmp(stty_erase, value) == 0) {
+ if (stty_erase != NULL && value != NULL && strequal(stty_erase, value)) {
return stty_erase[0] == DEL ? CTRL_H_STR : DEL_STR;
}
}
diff --git a/src/nvim/tui/tui.h b/src/nvim/tui/tui.h
index 07523bc124..2915b0e2f8 100644
--- a/src/nvim/tui/tui.h
+++ b/src/nvim/tui/tui.h
@@ -1,6 +1,8 @@
#ifndef NVIM_TUI_TUI_H
#define NVIM_TUI_TUI_H
+#include "nvim/cursor_shape.h"
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "tui/tui.h.generated.h"
#endif
diff --git a/src/nvim/ugrid.c b/src/nvim/ugrid.c
index 127b18feb6..7a0a16687e 100644
--- a/src/nvim/ugrid.c
+++ b/src/nvim/ugrid.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index ea42e3e357..69916fa4cd 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -29,6 +32,7 @@
#include "nvim/screen.h"
#include "nvim/syntax.h"
#include "nvim/window.h"
+#include "nvim/cursor_shape.h"
#ifdef FEAT_TUI
# include "nvim/tui/tui.h"
#else
@@ -52,6 +56,7 @@ static int current_attr_code = 0;
static bool pending_cursor_update = false;
static int busy = 0;
static int height, width;
+static int old_mode_idx = -1;
// UI_CALL invokes a function on all registered UI instances. The functions can
// have 0-5 arguments (configurable by SELECT_NTH).
@@ -149,12 +154,6 @@ void ui_event(char *name, Array args)
}
}
-// May update the shape of the cursor.
-void ui_cursor_shape(void)
-{
- ui_mode_change();
-}
-
void ui_refresh(void)
{
if (!ui_active()) {
@@ -179,6 +178,9 @@ void ui_refresh(void)
row = col = 0;
screen_resize(width, height);
pum_set_external(pum_external);
+ ui_mode_info_set();
+ old_mode_idx = -1;
+ ui_cursor_shape();
}
static void ui_refresh_event(void **argv)
@@ -376,6 +378,14 @@ void ui_cursor_goto(int new_row, int new_col)
pending_cursor_update = true;
}
+void ui_mode_info_set(void)
+{
+ Array style = mode_style_array();
+ bool enabled = (*p_guicursor != NUL);
+ UI_CALL(mode_info_set, enabled, style);
+ api_free_array(style);
+}
+
void ui_update_menu(void)
{
UI_CALL(update_menu);
@@ -531,25 +541,19 @@ static void flush_cursor_update(void)
}
}
-// Notify that the current mode has changed. Can be used to change cursor
-// shape, for example.
-static void ui_mode_change(void)
+/// Check if current mode has changed.
+/// May update the shape of the cursor.
+void ui_cursor_shape(void)
{
- int mode;
if (!full_screen) {
return;
}
- // Get a simple UI mode out of State.
- if ((State & REPLACE) == REPLACE) {
- mode = REPLACE;
- } else if (State & INSERT) {
- mode = INSERT;
- } else if (State & CMDLINE) {
- mode = CMDLINE;
- } else {
- mode = NORMAL;
+ int mode_idx = cursor_get_mode_idx();
+
+ if (old_mode_idx != mode_idx) {
+ old_mode_idx = mode_idx;
+ UI_CALL(mode_change, mode_idx);
}
- UI_CALL(mode_change, mode);
conceal_check_cursur_line();
}
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index d14bc5812c..fcf52ac9e1 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -6,6 +6,7 @@
#include <stdint.h>
#include "api/private/defs.h"
+#include "nvim/buffer_defs.h"
typedef struct {
bool bold, underline, undercurl, italic, reverse;
@@ -22,12 +23,13 @@ struct ui_t {
void (*clear)(UI *ui);
void (*eol_clear)(UI *ui);
void (*cursor_goto)(UI *ui, int row, int col);
+ void (*mode_info_set)(UI *ui, bool enabled, Array cursor_styles);
void (*update_menu)(UI *ui);
void (*busy_start)(UI *ui);
void (*busy_stop)(UI *ui);
void (*mouse_on)(UI *ui);
void (*mouse_off)(UI *ui);
- void (*mode_change)(UI *ui, int mode);
+ void (*mode_change)(UI *ui, int mode_idx);
void (*set_scroll_region)(UI *ui, int top, int bot, int left, int right);
void (*scroll)(UI *ui, int count);
void (*highlight_set)(UI *ui, HlAttrs attrs);
diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c
index 25861abc1b..5697c765ba 100644
--- a/src/nvim/ui_bridge.c
+++ b/src/nvim/ui_bridge.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
// UI wrapper that sends requests to the UI thread.
// Used by the built-in TUI and libnvim-based UIs.
@@ -13,6 +16,7 @@
#include "nvim/memory.h"
#include "nvim/ui_bridge.h"
#include "nvim/ugrid.h"
+#include "nvim/api/private/helpers.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_bridge.c.generated.h"
@@ -59,6 +63,7 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler)
rv->bridge.clear = ui_bridge_clear;
rv->bridge.eol_clear = ui_bridge_eol_clear;
rv->bridge.cursor_goto = ui_bridge_cursor_goto;
+ rv->bridge.mode_info_set = ui_bridge_mode_info_set;
rv->bridge.update_menu = ui_bridge_update_menu;
rv->bridge.busy_start = ui_bridge_busy_start;
rv->bridge.busy_stop = ui_bridge_busy_stop;
@@ -178,6 +183,25 @@ static void ui_bridge_cursor_goto_event(void **argv)
ui->cursor_goto(ui, PTR2INT(argv[1]), PTR2INT(argv[2]));
}
+static void ui_bridge_mode_info_set(UI *b, bool enabled, Array modes)
+{
+ bool *enabledp = xmalloc(sizeof(*enabledp));
+ Object *modesp = xmalloc(sizeof(*modesp));
+ *enabledp = enabled;
+ *modesp = copy_object(ARRAY_OBJ(modes));
+ UI_CALL(b, mode_info_set, 3, b, enabledp, modesp);
+}
+static void ui_bridge_mode_info_set_event(void **argv)
+{
+ UI *ui = UI(argv[0]);
+ bool *enabled = argv[1];
+ Object *modes = argv[2];
+ ui->mode_info_set(ui, *enabled, modes->data.array);
+ xfree(enabled);
+ api_free_object(*modes);
+ xfree(modes);
+}
+
static void ui_bridge_update_menu(UI *b)
{
UI_CALL(b, update_menu, 1, b);
@@ -228,9 +252,9 @@ static void ui_bridge_mouse_off_event(void **argv)
ui->mouse_off(ui);
}
-static void ui_bridge_mode_change(UI *b, int mode)
+static void ui_bridge_mode_change(UI *b, int mode_idx)
{
- UI_CALL(b, mode_change, 2, b, INT2PTR(mode));
+ UI_CALL(b, mode_change, 2, b, INT2PTR(mode_idx));
}
static void ui_bridge_mode_change_event(void **argv)
{
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 4d4e8d9bb9..290d5d7553 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/*
* undo.c: multi level undo facility
*
@@ -76,6 +79,7 @@
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
+#include <stdint.h>
#include <string.h>
#include <fcntl.h>
@@ -966,12 +970,12 @@ static u_entry_T *unserialize_uep(bufinfo_T * bi, bool *error,
uep->ue_lcount = undo_read_4c(bi);
uep->ue_size = undo_read_4c(bi);
- char_u **array;
+ char_u **array = NULL;
if (uep->ue_size > 0) {
- array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size);
- memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size);
- } else {
- array = NULL;
+ if ((size_t)uep->ue_size < SIZE_MAX / sizeof(char_u *)) {
+ array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size);
+ memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size);
+ }
}
uep->ue_array = array;
@@ -1400,7 +1404,9 @@ void u_read_undo(char *name, char_u *hash, char_u *orig_name)
// sequence numbers of the headers.
// When there are no headers uhp_table is NULL.
if (num_head > 0) {
- uhp_table = xmalloc((size_t)num_head * sizeof(u_header_T *));
+ if ((size_t)num_head < SIZE_MAX / sizeof(*uhp_table)) {
+ uhp_table = xmalloc((size_t)num_head * sizeof(*uhp_table));
+ }
}
long num_read_uhps = 0;
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 9275a2e5bd..b1aa8e2a4b 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
/// @file version.c
///
/// Nvim was forked from Vim 7.4.160.
@@ -82,7 +85,7 @@ static const int included_patches[] = {
2362,
// 2361 NA
// 2360,
- // 2359 NA
+ 2359,
// 2358 NA
2357,
// 2356,
@@ -109,7 +112,7 @@ static const int included_patches[] = {
2335,
2334,
2333,
- // 2332 NA
+ 2332,
2331,
2330,
2329,
@@ -135,9 +138,9 @@ static const int included_patches[] = {
2309,
// 2308 NA
2307,
- // 2306,
+ 2306,
2305,
- // 2304 NA
+ 2304,
2303,
// 2302 NA
// 2301 NA
@@ -160,7 +163,7 @@ static const int included_patches[] = {
2284,
2283,
// 2282 NA
- // 2281 NA
+ 2281,
2280,
2279,
// 2278 NA
@@ -199,13 +202,13 @@ static const int included_patches[] = {
// 2245,
// 2244,
// 2243 NA
- // 2242,
- // 2241,
- // 2240,
+ 2242,
+ 2241,
+ 2240,
// 2239,
// 2238 NA
2237,
- // 2236,
+ 2236,
2235,
// 2234 NA
2233,
@@ -232,7 +235,7 @@ static const int included_patches[] = {
2212,
// 2211 NA
// 2210 NA
- // 2209,
+ 2209,
2208,
// 2207 NA
// 2206 NA
@@ -260,23 +263,23 @@ static const int included_patches[] = {
2184,
2183,
// 2182 NA
- // 2181,
- // 2180,
- // 2179,
+ // 2181 NA
+ 2180,
+ 2179,
2178,
2177,
// 2176 NA
2175,
2174,
- // 2173,
+ 2173,
2172,
- // 2171,
- // 2170,
+ // 2171 NA
+ 2170,
2169,
// 2168 NA
// 2167 NA
// 2166 NA
- // 2165,
+ 2165,
2164,
2163,
2162,
@@ -289,7 +292,7 @@ static const int included_patches[] = {
// 2155 NA
// 2154 NA
// 2153 NA
- // 2152,
+ 2152,
2151,
// 2150 NA
2149,
@@ -337,7 +340,7 @@ static const int included_patches[] = {
2107,
2106,
// 2105 NA
- // 2104,
+ 2104,
2103,
// 2102 NA
2101,
diff --git a/src/nvim/version.h b/src/nvim/version.h
index 1de809e539..a0babfb156 100644
--- a/src/nvim/version.h
+++ b/src/nvim/version.h
@@ -1,6 +1,8 @@
#ifndef NVIM_VERSION_H
#define NVIM_VERSION_H
+#include "nvim/ex_cmds_defs.h"
+
// defined in version.c
extern char* Version;
extern char* longVersion;
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index cc0587fb88..f29ccdd296 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -11,20 +11,16 @@
#define RUNTIME_DIRNAME "runtime"
/* end */
-/* ============ the header file puzzle (ca. 50-100 pieces) ========= */
-
-#ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */
-# include "auto/config.h"
-# define HAVE_PATHDEF
+#include "auto/config.h"
+#define HAVE_PATHDEF
/*
* Check if configure correctly managed to find sizeof(int). If this failed,
* it becomes zero. This is likely a problem of not being able to run the
* test program. Other items from configure may also be wrong then!
*/
-# if (SIZEOF_INT == 0)
-Error: configure did not run properly.Check auto/config.log.
-# endif
+#if (SIZEOF_INT == 0)
+# error Configure did not run properly.
#endif
#include "nvim/os/os_defs.h" /* bring lots of system header files */
@@ -46,11 +42,6 @@ enum { NUMBUFLEN = 65 };
#include "nvim/keymap.h"
#include "nvim/macros.h"
-
-
-
-/* ================ end of the header file puzzle =============== */
-
#include "nvim/gettext.h"
/* special attribute addition: Put message in history */
@@ -213,6 +204,8 @@ enum {
#define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */
+enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
+
/*
* Maximum length of key sequence to be mapped.
* Must be able to hold an Amiga resize report.
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 6020159af9..60bba19b07 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
diff --git a/src/nvim/window.h b/src/nvim/window.h
index 2ac4c00c28..82b3fe5e88 100644
--- a/src/nvim/window.h
+++ b/src/nvim/window.h
@@ -3,6 +3,8 @@
#include <stdbool.h>
+#include "nvim/buffer_defs.h"
+
/* Values for file_name_in_line() */
#define FNAME_MESS 1 /* give error message */
#define FNAME_EXP 2 /* expand to path */
diff --git a/test/README.md b/test/README.md
index df66f24626..2857cc0ecf 100644
--- a/test/README.md
+++ b/test/README.md
@@ -27,8 +27,8 @@ groups by the semantic component they are testing.
Test behaviour is affected by environment variables. Currently supported
(Functional, Unit, Benchmarks) (when Defined; when set to _1_; when defined,
-treated as Integer; when defined, treated as String; !must be defined to
-function properly):
+treated as Integer; when defined, treated as String; when defined, treated as
+Number; !must be defined to function properly):
`GDB` (F) (D): makes nvim instances to be run under `gdbserver`. It will be
accessible on `localhost:7777`: use `gdb build/bin/nvim`, type `target remote
@@ -99,3 +99,12 @@ get backtrace from).
approximately 90% of the tests. Should be used when finding cores is too hard
for some reason. Normally (on OS X or when `NVIM_TEST_CORE_GLOB_DIRECTORY` is
defined and this variable is not) cores are checked for after each test.
+
+`NVIM_TEST_RUN_TESTTEST` (U) (1): allows running `test/unit/testtest_spec.lua`
+used to check how testing infrastructure works.
+
+`NVIM_TEST_TRACE_LEVEL` (U) (N): specifies unit tests tracing level: `0`
+disables tracing (the fastest, but you get no data if tests crash and there was
+no core dump generated), `1` or empty/undefined leaves only C function cals and
+returns in the trace (faster then recording everything), `2` records all
+function calls, returns and lua source lines exuecuted.
diff --git a/test/benchmark/bench_re_freeze_spec.lua b/test/benchmark/bench_re_freeze_spec.lua
index 53041b042b..ea41953014 100644
--- a/test/benchmark/bench_re_freeze_spec.lua
+++ b/test/benchmark/bench_re_freeze_spec.lua
@@ -1,8 +1,8 @@
-- Test for benchmarking RE engine.
-local helpers = require('test.functional.helpers')
+local helpers = require('test.functional.helpers')(after_each)
local insert, source = helpers.insert, helpers.source
-local clear, execute, wait = helpers.clear, helpers.execute, helpers.wait
+local clear, command = helpers.clear, helpers.command
-- Temporary file for gathering benchmarking results for each regexp engine.
local result_file = 'benchmark.out'
@@ -31,7 +31,7 @@ describe('regexp search', function()
clear()
source(measure_script)
insert('" Benchmark_results:')
- execute('write! ' .. result_file)
+ command('write! ' .. result_file)
end)
-- At the end of the test run we just print the contents of the result file
@@ -46,22 +46,19 @@ describe('regexp search', function()
it('is working with regexpengine=0', function()
local regexpengine = 0
- execute(string.format(measure_cmd, regexpengine))
- execute('write')
- wait()
+ command(string.format(measure_cmd, regexpengine))
+ command('write')
end)
it('is working with regexpengine=1', function()
local regexpengine = 1
- execute(string.format(measure_cmd, regexpengine))
- execute('write')
- wait()
+ command(string.format(measure_cmd, regexpengine))
+ command('write')
end)
it('is working with regexpengine=2', function()
local regexpengine = 2
- execute(string.format(measure_cmd, regexpengine))
- execute('write')
- wait()
+ command(string.format(measure_cmd, regexpengine))
+ command('write')
end)
end)
diff --git a/test/config/paths.lua.in b/test/config/paths.lua.in
index 8dd4de75db..7fe5d8ad80 100644
--- a/test/config/paths.lua.in
+++ b/test/config/paths.lua.in
@@ -5,7 +5,8 @@ for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do
table.insert(module.include_paths, p)
end
-module.test_include_path = "${CMAKE_BINARY_DIR}/test/includes/post"
+module.test_build_dir = "${CMAKE_BINARY_DIR}"
+module.test_include_path = module.test_build_dir .. "/test/includes/post"
module.test_libnvim_path = "${TEST_LIBNVIM_PATH}"
module.test_source_path = "${CMAKE_SOURCE_DIR}"
module.test_lua_prg = "${LUA_PRG}"
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index 552e3a8564..9699ea8f85 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -5,7 +5,7 @@ local curbufmeths, ok = helpers.curbufmeths, helpers.ok
local funcs = helpers.funcs
local request = helpers.request
local exc_exec = helpers.exc_exec
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local insert = helpers.insert
local NIL = helpers.NIL
local meth_pcall = helpers.meth_pcall
@@ -246,7 +246,7 @@ describe('api/buf', function()
end)
it("set_line on alternate buffer does not access invalid line (E315)", function()
- execute('set hidden')
+ feed_command('set hidden')
insert('Initial file')
command('enew')
insert([[
@@ -257,7 +257,7 @@ describe('api/buf', function()
The
Other
Buffer]])
- execute('$')
+ feed_command('$')
local retval = exc_exec("call nvim_buf_set_lines(1, 0, 1, v:false, ['test'])")
eq(0, retval)
end)
@@ -271,7 +271,7 @@ describe('api/buf', function()
eq(1, funcs.exists('b:lua'))
curbufmeths.del_var('lua')
eq(0, funcs.exists('b:lua'))
- eq({false, 'Key "lua" doesn\'t exist'}, meth_pcall(curbufmeths.del_var, 'lua'))
+ eq({false, 'Key does not exist: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
curbufmeths.set_var('lua', 1)
command('lockvar b:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
diff --git a/test/functional/api/server_notifications_spec.lua b/test/functional/api/server_notifications_spec.lua
index 78639d7ed7..9d7cfb9b78 100644
--- a/test/functional/api/server_notifications_spec.lua
+++ b/test/functional/api/server_notifications_spec.lua
@@ -1,6 +1,6 @@
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,
+local eq, clear, eval, command, nvim, next_message =
+ helpers.eq, helpers.clear, helpers.eval, helpers.command, helpers.nvim,
helpers.next_message
local meths = helpers.meths
@@ -16,8 +16,8 @@ describe('notify', function()
it('sends the notification/args to the corresponding channel', function()
eval('rpcnotify('..channel..', "test-event", 1, 2, 3)')
eq({'notification', 'test-event', {1, 2, 3}}, next_message())
- execute('au FileType lua call rpcnotify('..channel..', "lua!")')
- execute('set filetype=lua')
+ command('au FileType lua call rpcnotify('..channel..', "lua!")')
+ command('set filetype=lua')
eq({'notification', 'lua!', {}}, next_message())
end)
end)
diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua
index 76a335a8f4..658077b112 100644
--- a/test/functional/api/server_requests_spec.lua
+++ b/test/functional/api/server_requests_spec.lua
@@ -1,6 +1,8 @@
-- Test server -> client RPC scenarios. Note: unlike `rpcnotify`, to evaluate
-- `rpcrequest` calls we need the client event loop to be running.
local helpers = require('test.functional.helpers')(after_each)
+local Paths = require('test.config.paths')
+
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, command, funcs = helpers.nvim_prog, helpers.command, helpers.funcs
@@ -200,7 +202,7 @@ describe('server -> client', function()
\ 'rpc': v:true
\ }
]])
- local lua_prog = arg[-1]
+ local lua_prog = Paths.test_lua_prg
meths.set_var("args", {lua_prog, 'test/functional/api/rpc_fixture.lua'})
jobid = eval("jobstart(g:args, g:job_opts)")
neq(0, 'jobid')
diff --git a/test/functional/api/tabpage_spec.lua b/test/functional/api/tabpage_spec.lua
index d7ef53a88f..260a91a80c 100644
--- a/test/functional/api/tabpage_spec.lua
+++ b/test/functional/api/tabpage_spec.lua
@@ -34,7 +34,7 @@ describe('api/tabpage', function()
eq(1, funcs.exists('t:lua'))
curtabmeths.del_var('lua')
eq(0, funcs.exists('t:lua'))
- eq({false, 'Key "lua" doesn\'t exist'}, meth_pcall(curtabmeths.del_var, 'lua'))
+ eq({false, 'Key does not exist: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
curtabmeths.set_var('lua', 1)
command('lockvar t:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 8f9f155110..5b173f3196 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -119,7 +119,7 @@ describe('api', function()
eq(1, funcs.exists('g:lua'))
meths.del_var('lua')
eq(0, funcs.exists('g:lua'))
- eq({false, 'Key "lua" doesn\'t exist'}, meth_pcall(meths.del_var, 'lua'))
+ eq({false, 'Key does not exist: lua'}, meth_pcall(meths.del_var, 'lua'))
meths.set_var('lua', 1)
command('lockvar lua')
eq({false, 'Key is locked: lua'}, meth_pcall(meths.del_var, 'lua'))
@@ -412,7 +412,7 @@ describe('api', function()
eq(5, meths.get_var('avar'))
end)
- it('throws error on malformated arguments', function()
+ it('throws error on malformed arguments', function()
local req = {
{'nvim_set_var', {'avar', 1}},
{'nvim_set_var'},
@@ -439,7 +439,7 @@ describe('api', function()
}
status, err = pcall(meths.call_atomic, req)
eq(false, status)
- ok(err:match('args must be Array') ~= nil)
+ ok(err:match('Args must be Array') ~= nil)
-- call before was done, but not after
eq(1, meths.get_var('avar'))
eq({''}, meths.buf_get_lines(0, 0, -1, true))
@@ -452,6 +452,13 @@ describe('api', function()
ok(err:match('Invalid option name') ~= nil)
end)
+ it('does not truncate error message <1 MB #5984', function()
+ local very_long_name = 'A'..('x'):rep(10000)..'Z'
+ local status, err = pcall(nvim, 'get_option', very_long_name)
+ eq(false, status)
+ eq(very_long_name, err:match('Ax+Z?'))
+ end)
+
it("doesn't leak memory on incorrect argument types", function()
local status, err = pcall(nvim, 'set_current_dir',{'not', 'a', 'dir'})
eq(false, status)
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index deffc68994..6882f50a3e 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -139,7 +139,7 @@ describe('api/win', function()
eq(1, funcs.exists('w:lua'))
curwinmeths.del_var('lua')
eq(0, funcs.exists('w:lua'))
- eq({false, 'Key "lua" doesn\'t exist'}, meth_pcall(curwinmeths.del_var, 'lua'))
+ eq({false, 'Key does not exist: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
curwinmeths.set_var('lua', 1)
command('lockvar w:lua')
eq({false, 'Key is locked: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
index c38bd75c69..8ee9462a8d 100644
--- a/test/functional/autocmd/autocmd_spec.lua
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -1,9 +1,13 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear = helpers.clear
-local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
+local clear = helpers.clear
+local meths = helpers.meths
+local expect = helpers.expect
+local command = helpers.command
+local exc_exec = helpers.exc_exec
+local curbufmeths = helpers.curbufmeths
describe('autocmds:', function()
before_each(clear)
@@ -33,4 +37,22 @@ describe('autocmds:', function()
it('v:vim_did_enter is 1 after VimEnter', function()
eq(1, eval('v:vim_did_enter'))
end)
+
+ describe('BufLeave autocommand', function()
+ it('can wipe out the buffer created by :edit which triggered autocmd',
+ function()
+ meths.set_option('hidden', true)
+ curbufmeths.set_lines(0, 1, false, {
+ 'start of test file xx',
+ 'end of test file xx'})
+
+ command('autocmd BufLeave * bwipeout yy')
+ eq('Vim(edit):E143: Autocommands unexpectedly deleted new buffer yy',
+ exc_exec('edit yy'))
+
+ expect([[
+ start of test file xx
+ end of test file xx]])
+ end)
+ end)
end)
diff --git a/test/functional/autocmd/bufenter_spec.lua b/test/functional/autocmd/bufenter_spec.lua
index ccbcdf5c5e..fef9838050 100644
--- a/test/functional/autocmd/bufenter_spec.lua
+++ b/test/functional/autocmd/bufenter_spec.lua
@@ -4,7 +4,6 @@ local clear = helpers.clear
local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
-local execute = helpers.execute
local request = helpers.request
local source = helpers.source
@@ -28,7 +27,7 @@ describe('autocmd BufEnter', function()
endtry
endfunction
]])
- execute("call Test()")
+ command("call Test()")
eq(1, eval("exists('g:dir_bufenter')")) -- Did BufEnter for the directory.
eq(2, eval("bufnr('%')")) -- Switched to the dir buffer.
end)
diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua
index ecda1bffb7..d4beab22e4 100644
--- a/test/functional/autocmd/termclose_spec.lua
+++ b/test/functional/autocmd/termclose_spec.lua
@@ -14,17 +14,11 @@ describe('TermClose event', function()
nvim('set_option', 'shellcmdflag', 'EXE')
end)
- local function eq_err(expected, actual)
- if expected ~= actual then
- error('expected: '..tostring(expected)..', actual: '..tostring(actual))
- end
- end
-
it('triggers when terminal job ends', function()
command('autocmd TermClose * let g:test_termclose = 23')
command('terminal')
command('call jobstop(b:terminal_job_id)')
- retry(nil, nil, function() eq_err(23, eval('g:test_termclose')) end)
+ retry(nil, nil, function() eq(23, eval('g:test_termclose')) end)
end)
it('reports the correct <abuf>', function()
@@ -35,12 +29,12 @@ describe('TermClose event', function()
eq(2, eval('bufnr("%")'))
command('terminal')
- retry(nil, nil, function() eq_err(3, eval('bufnr("%")')) end)
+ retry(nil, nil, function() eq(3, eval('bufnr("%")')) end)
command('buffer 1')
- retry(nil, nil, function() eq_err(1, eval('bufnr("%")')) end)
+ retry(nil, nil, function() eq(1, eval('bufnr("%")')) end)
command('3bdelete!')
- retry(nil, nil, function() eq_err('3', eval('g:abuf')) end)
+ retry(nil, nil, function() eq('3', eval('g:abuf')) end)
end)
end)
diff --git a/test/functional/autocmd/textyankpost_spec.lua b/test/functional/autocmd/textyankpost_spec.lua
index bd5f1912c5..486a3346b1 100644
--- a/test/functional/autocmd/textyankpost_spec.lua
+++ b/test/functional/autocmd/textyankpost_spec.lua
@@ -1,6 +1,6 @@
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 feed, command, expect = helpers.feed, helpers.command, helpers.expect
local curbufmeths, funcs, neq = helpers.curbufmeths, helpers.funcs, helpers.neq
describe('TextYankPost', function()
@@ -8,11 +8,11 @@ describe('TextYankPost', function()
clear()
-- emulate the clipboard so system clipboard isn't affected
- execute('let &rtp = "test/functional/fixtures,".&rtp')
+ command('let &rtp = "test/functional/fixtures,".&rtp')
- execute('let g:count = 0')
- execute('autocmd TextYankPost * let g:event = copy(v:event)')
- execute('autocmd TextYankPost * let g:count += 1')
+ command('let g:count = 0')
+ command('autocmd TextYankPost * let g:event = copy(v:event)')
+ command('autocmd TextYankPost * let g:count += 1')
curbufmeths.set_lines(0, -1, true, {
'foo\0bar',
@@ -61,27 +61,27 @@ describe('TextYankPost', function()
regtype = 'V'
}, eval('g:event'))
- execute('set debug=msg')
+ command('set debug=msg')
-- the regcontents should not be changed without copy.
local status, err = pcall(command,'call extend(g:event.regcontents, ["more text"])')
eq(status,false)
neq(nil, string.find(err, ':E742:'))
-- can't mutate keys inside the autocommand
- execute('autocmd! TextYankPost * let v:event.regcontents = 0')
+ command('autocmd! TextYankPost * let v:event.regcontents = 0')
status, err = pcall(command,'normal yy')
eq(status,false)
neq(nil, string.find(err, ':E46:'))
-- can't add keys inside the autocommand
- execute('autocmd! TextYankPost * let v:event.mykey = 0')
+ command('autocmd! TextYankPost * let v:event.mykey = 0')
status, err = pcall(command,'normal yy')
eq(status,false)
neq(nil, string.find(err, ':E742:'))
end)
it('is not invoked recursively', function()
- execute('autocmd TextYankPost * normal "+yy')
+ command('autocmd TextYankPost * normal "+yy')
feed('yy')
eq({
operator = 'y',
@@ -134,7 +134,7 @@ describe('TextYankPost', function()
feed('"_yy')
eq(0, eval('g:count'))
- execute('delete _')
+ command('delete _')
eq(0, eval('g:count'))
end)
@@ -155,7 +155,7 @@ describe('TextYankPost', function()
regtype = 'V'
}, eval('g:event'))
- execute("set clipboard=unnamed")
+ command("set clipboard=unnamed")
-- regname still shows the name the user requested
feed('yy')
@@ -176,7 +176,7 @@ describe('TextYankPost', function()
end)
it('works with Ex commands', function()
- execute('1delete +')
+ command('1delete +')
eq({
operator = 'd',
regcontents = { 'foo\nbar' },
@@ -185,7 +185,7 @@ describe('TextYankPost', function()
}, eval('g:event'))
eq(1, eval('g:count'))
- execute('yank')
+ command('yank')
eq({
operator = 'y',
regcontents = { 'baz text' },
@@ -194,7 +194,7 @@ describe('TextYankPost', function()
}, eval('g:event'))
eq(2, eval('g:count'))
- execute('normal yw')
+ command('normal yw')
eq({
operator = 'y',
regcontents = { 'baz ' },
@@ -203,7 +203,7 @@ describe('TextYankPost', function()
}, eval('g:event'))
eq(3, eval('g:count'))
- execute('normal! dd')
+ command('normal! dd')
eq({
operator = 'd',
regcontents = { 'baz text' },
diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua
index d969d4a487..eb2eeee0da 100644
--- a/test/functional/clipboard/clipboard_provider_spec.lua
+++ b/test/functional/clipboard/clipboard_provider_spec.lua
@@ -3,7 +3,7 @@
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
+local feed_command, expect, eq, eval = helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
local function basic_register_test(noblock)
insert("some words")
@@ -95,7 +95,7 @@ describe('clipboard usage', function()
before_each(function()
reset()
- execute('call getreg("*")') -- force load of provider
+ feed_command('call getreg("*")') -- force load of provider
end)
it('has independent "* and unnamed registers per default', function()
@@ -140,8 +140,8 @@ describe('clipboard usage', function()
end)
it('support autodectection of regtype', function()
- execute("let g:test_clip['*'] = ['linewise stuff','']")
- execute("let g:test_clip['+'] = ['charwise','stuff']")
+ feed_command("let g:test_clip['*'] = ['linewise stuff','']")
+ feed_command("let g:test_clip['+'] = ['charwise','stuff']")
eq("V", eval("getregtype('*')"))
eq("v", eval("getregtype('+')"))
insert("just some text")
@@ -156,7 +156,7 @@ describe('clipboard usage', function()
insert([[
much
text]])
- execute("let g:test_clip['*'] = [['very','block'],'b']")
+ feed_command("let g:test_clip['*'] = [['very','block'],'b']")
feed('gg"*P')
expect([[
very much
@@ -170,15 +170,15 @@ describe('clipboard usage', function()
end)
it('supports setreg', function()
- execute('call setreg("*", "setted\\ntext", "c")')
- execute('call setreg("+", "explicitly\\nlines", "l")')
+ feed_command('call setreg("*", "setted\\ntext", "c")')
+ feed_command('call setreg("+", "explicitly\\nlines", "l")')
feed('"+P"*p')
expect([[
esetted
textxplicitly
lines
]])
- execute('call setreg("+", "blocky\\nindeed", "b")')
+ feed_command('call setreg("+", "blocky\\nindeed", "b")')
feed('"+p')
expect([[
esblockyetted
@@ -188,13 +188,13 @@ describe('clipboard usage', function()
end)
it('supports let @+ (issue #1427)', function()
- execute("let @+ = 'some'")
- execute("let @* = ' other stuff'")
+ feed_command("let @+ = 'some'")
+ feed_command("let @* = ' other stuff'")
eq({{'some'}, 'v'}, eval("g:test_clip['+']"))
eq({{' other stuff'}, 'v'}, eval("g:test_clip['*']"))
feed('"+p"*p')
expect('some other stuff')
- execute("let @+ .= ' more'")
+ feed_command("let @+ .= ' more'")
feed('dd"+p')
expect('some more')
end)
@@ -202,7 +202,7 @@ describe('clipboard usage', function()
it('pastes unnamed register if the provider fails', function()
insert('the text')
feed('yy')
- execute("let g:cliperror = 1")
+ feed_command("let g:cliperror = 1")
feed('"*p')
expect([[
the text
@@ -214,7 +214,7 @@ describe('clipboard usage', function()
-- the basic behavior of unnamed register should be the same
-- even when handled by clipboard provider
before_each(function()
- execute('set clipboard=unnamed')
+ feed_command('set clipboard=unnamed')
end)
it('works', function()
@@ -222,7 +222,7 @@ describe('clipboard usage', function()
end)
it('works with pure text clipboard', function()
- execute("let g:cliplossy = 1")
+ feed_command("let g:cliplossy = 1")
-- expect failure for block mode
basic_register_test(true)
end)
@@ -237,7 +237,7 @@ describe('clipboard usage', function()
-- "+ shouldn't have changed
eq({''}, eval("g:test_clip['+']"))
- execute("let g:test_clip['*'] = ['linewise stuff','']")
+ feed_command("let g:test_clip['*'] = ['linewise stuff','']")
feed('p')
expect([[
words
@@ -247,7 +247,7 @@ describe('clipboard usage', function()
it('does not clobber "0 when pasting', function()
insert('a line')
feed('yy')
- execute("let g:test_clip['*'] = ['b line','']")
+ feed_command("let g:test_clip['*'] = ['b line','']")
feed('"0pp"0p')
expect([[
a line
@@ -258,20 +258,20 @@ describe('clipboard usage', function()
it('supports v:register and getreg() without parameters', function()
eq('*', eval('v:register'))
- execute("let g:test_clip['*'] = [['some block',''], 'b']")
+ feed_command("let g:test_clip['*'] = [['some block',''], 'b']")
eq('some block', eval('getreg()'))
eq('\02210', eval('getregtype()'))
end)
it('yanks visual selection when pasting', function()
insert("indeed visual")
- execute("let g:test_clip['*'] = [['clipboard'], 'c']")
+ feed_command("let g:test_clip['*'] = [['clipboard'], 'c']")
feed("viwp")
eq({{'visual'}, 'v'}, eval("g:test_clip['*']"))
expect("indeed clipboard")
-- explicit "* should do the same
- execute("let g:test_clip['*'] = [['star'], 'c']")
+ feed_command("let g:test_clip['*'] = [['star'], 'c']")
feed('viw"*p')
eq({{'clipboard'}, 'v'}, eval("g:test_clip['*']"))
expect("indeed star")
@@ -280,7 +280,7 @@ describe('clipboard usage', function()
it('unamed operations work even if the provider fails', function()
insert('the text')
feed('yy')
- execute("let g:cliperror = 1")
+ feed_command("let g:cliperror = 1")
feed('p')
expect([[
the text
@@ -294,11 +294,11 @@ describe('clipboard usage', function()
match
text
]])
- execute('g/match/d')
+ feed_command('g/match/d')
eq('match\n', eval('getreg("*")'))
feed('u')
eval('setreg("*", "---")')
- execute('g/test/')
+ feed_command('g/test/')
feed('<esc>')
eq('---', eval('getreg("*")'))
end)
@@ -307,7 +307,7 @@ describe('clipboard usage', function()
describe('with clipboard=unnamedplus', function()
before_each(function()
- execute('set clipboard=unnamedplus')
+ feed_command('set clipboard=unnamedplus')
end)
it('links the "+ and unnamed registers', function()
@@ -320,13 +320,13 @@ describe('clipboard usage', function()
-- "* shouldn't have changed
eq({''}, eval("g:test_clip['*']"))
- execute("let g:test_clip['+'] = ['three']")
+ feed_command("let g:test_clip['+'] = ['three']")
feed('p')
expect('twothree')
end)
it('and unnamed, yanks to both', function()
- execute('set clipboard=unnamedplus,unnamed')
+ feed_command('set clipboard=unnamedplus,unnamed')
insert([[
really unnamed
text]])
@@ -340,8 +340,8 @@ describe('clipboard usage', function()
-- unnamedplus takes predecence when pasting
eq('+', eval('v:register'))
- execute("let g:test_clip['+'] = ['the plus','']")
- execute("let g:test_clip['*'] = ['the star','']")
+ feed_command("let g:test_clip['+'] = ['the plus','']")
+ feed_command("let g:test_clip['*'] = ['the star','']")
feed("p")
expect([[
text
@@ -356,11 +356,11 @@ describe('clipboard usage', function()
match
text
]])
- execute('g/match/d')
+ feed_command('g/match/d')
eq('match\n', eval('getreg("+")'))
feed('u')
eval('setreg("+", "---")')
- execute('g/test/')
+ feed_command('g/test/')
feed('<esc>')
eq('---', eval('getreg("+")'))
end)
@@ -375,13 +375,13 @@ describe('clipboard usage', function()
it('supports :put', function()
insert("a line")
- execute("let g:test_clip['*'] = ['some text']")
- execute("let g:test_clip['+'] = ['more', 'text', '']")
- execute(":put *")
+ feed_command("let g:test_clip['*'] = ['some text']")
+ feed_command("let g:test_clip['+'] = ['more', 'text', '']")
+ feed_command(":put *")
expect([[
a line
some text]])
- execute(":put +")
+ feed_command(":put +")
expect([[
a line
some text
@@ -392,9 +392,9 @@ describe('clipboard usage', function()
it('supports "+ and "* in registers', function()
local screen = Screen.new(60, 10)
screen:attach()
- execute("let g:test_clip['*'] = ['some', 'star data','']")
- execute("let g:test_clip['+'] = ['such', 'plus', 'stuff']")
- execute("registers")
+ feed_command("let g:test_clip['*'] = ['some', 'star data','']")
+ feed_command("let g:test_clip['+'] = ['such', 'plus', 'stuff']")
+ feed_command("registers")
screen:expect([[
~ |
~ |
@@ -418,17 +418,17 @@ describe('clipboard usage', function()
insert('s/s/t/')
feed('gg"*y$:<c-r>*<cr>')
expect('t/s/t/')
- execute("let g:test_clip['*'] = ['s/s/u']")
+ feed_command("let g:test_clip['*'] = ['s/s/u']")
feed(':<c-r>*<cr>')
expect('t/u/t/')
end)
it('supports :redir @*>', function()
- execute("let g:test_clip['*'] = ['stuff']")
- execute('redir @*>')
+ feed_command("let g:test_clip['*'] = ['stuff']")
+ feed_command('redir @*>')
-- it is made empty
eq({{''}, 'v'}, eval("g:test_clip['*']"))
- execute('let g:test = doesnotexist')
+ feed_command('let g:test = doesnotexist')
feed('<cr>')
eq({{
'',
@@ -436,7 +436,7 @@ describe('clipboard usage', function()
'E121: Undefined variable: doesnotexist',
'E15: Invalid expression: doesnotexist',
}, 'v'}, eval("g:test_clip['*']"))
- execute(':echo "Howdy!"')
+ feed_command(':echo "Howdy!"')
eq({{
'',
'',
@@ -448,7 +448,7 @@ describe('clipboard usage', function()
end)
it('handles middleclick correctly', function()
- execute('set mouse=a')
+ feed_command('set mouse=a')
local screen = Screen.new(30, 5)
screen:attach()
@@ -471,7 +471,7 @@ describe('clipboard usage', function()
the a target]])
-- on error, fall back to unnamed register
- execute("let g:cliperror = 1")
+ feed_command("let g:cliperror = 1")
feed('<MiddleMouse><6,1>')
expect([[
the source
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 9ee91f2fe9..b98169b067 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, eq, eval, exc_exec, execute, feed, insert, neq, next_msg, nvim,
+local clear, eq, eval, exc_exec, feed_command, feed, insert, neq, next_msg, nvim,
nvim_dir, ok, source, write_file, mkdir, rmdir = helpers.clear,
- helpers.eq, helpers.eval, helpers.exc_exec, helpers.execute, helpers.feed,
+ helpers.eq, helpers.eval, helpers.exc_exec, helpers.feed_command, helpers.feed,
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
helpers.nvim_dir, helpers.ok, helpers.source,
helpers.write_file, helpers.mkdir, helpers.rmdir
@@ -94,7 +94,7 @@ describe('jobs', function()
it('returns 0 when it fails to start', function()
eq("", eval("v:errmsg"))
- execute("let g:test_jobid = jobstart([])")
+ feed_command("let g:test_jobid = jobstart([])")
eq(0, eval("g:test_jobid"))
eq("E474:", string.match(eval("v:errmsg"), "E%d*:"))
end)
@@ -470,7 +470,7 @@ describe('jobs', function()
end)
it('will return -2 when interrupted', function()
- execute('call rpcnotify(g:channel, "ready") | '..
+ feed_command('call rpcnotify(g:channel, "ready") | '..
'call rpcnotify(g:channel, "wait", '..
'jobwait([jobstart("sleep 10; exit 55")]))')
eq({'notification', 'ready', {}}, next_msg())
@@ -514,7 +514,7 @@ describe('jobs', function()
\ ])
endfunction
]])
- execute('call Run()')
+ feed_command('call Run()')
local r
for i = 10, 1, -1 do
r = next_msg()
@@ -668,7 +668,7 @@ describe("pty process teardown", function()
it("does not prevent/delay exit. #4798 #4900", function()
if helpers.pending_win32(pending) then return end
-- Use a nested nvim (in :term) to test without --headless.
- execute(":terminal '"..helpers.nvim_prog
+ feed_command(":terminal '"..helpers.nvim_prog
-- Use :term again in the _nested_ nvim to get a PTY process.
-- Use `sleep` to simulate a long-running child of the PTY.
.."' +terminal +'!(sleep 300 &)' +qa")
diff --git a/test/functional/eval/api_functions_spec.lua b/test/functional/eval/api_functions_spec.lua
index 21dd228145..7f6f53d226 100644
--- a/test/functional/eval/api_functions_spec.lua
+++ b/test/functional/eval/api_functions_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local lfs = require('lfs')
-local neq, eq, execute = helpers.neq, helpers.eq, helpers.execute
+local neq, eq, command = helpers.neq, helpers.eq, helpers.command
local clear, curbufmeths = helpers.clear, helpers.curbufmeths
local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval
local insert = helpers.insert
@@ -10,17 +10,17 @@ describe('api functions', function()
before_each(clear)
it("work", function()
- execute("call nvim_command('let g:test = 1')")
+ command("call nvim_command('let g:test = 1')")
eq(1, eval("nvim_get_var('test')"))
local buf = eval("nvim_get_current_buf()")
- execute("call nvim_buf_set_lines("..buf..", 0, -1, v:true, ['aa', 'bb'])")
+ command("call nvim_buf_set_lines("..buf..", 0, -1, v:true, ['aa', 'bb'])")
expect([[
aa
bb]])
- execute("call nvim_win_set_cursor(0, [1, 1])")
- execute("call nvim_input('ax<esc>')")
+ command("call nvim_win_set_cursor(0, [1, 1])")
+ command("call nvim_input('ax<esc>')")
expect([[
aax
bb]])
@@ -57,7 +57,7 @@ describe('api functions', function()
eq(bnr, bhnd)
eq(wid, whnd)
- execute("new") -- creates new buffer and new window
+ command("new") -- creates new buffer and new window
local bnr2 = eval("bufnr('')")
local bhnd2 = eval("nvim_get_current_buf()")
local wid2 = eval("win_getid()")
@@ -69,7 +69,7 @@ describe('api functions', function()
-- 0 is synonymous to the current buffer
eq(bnr2, eval("nvim_buf_get_number(0)"))
- execute("bn") -- show old buffer in new window
+ command("bn") -- show old buffer in new window
eq(bnr, eval("nvim_get_current_buf()"))
eq(bnr, eval("bufnr('')"))
eq(bnr, eval("nvim_buf_get_number(0)"))
@@ -81,7 +81,7 @@ describe('api functions', function()
curbufmeths.set_lines(0, -1, true, {"aa\0", "b\0b"})
eq({'aa\n', 'b\nb'}, eval("nvim_buf_get_lines(0, 0, -1, 1)"))
- execute('call nvim_buf_set_lines(0, 1, 2, v:true, ["xx", "\\nyy"])')
+ command('call nvim_buf_set_lines(0, 1, 2, v:true, ["xx", "\\nyy"])')
eq({'aa\0', 'xx', '\0yy'}, curbufmeths.get_lines(0, -1, 1))
end)
@@ -124,9 +124,9 @@ describe('api functions', function()
[5] = {bold = true, foreground = Screen.colors.Blue},
})
- execute("set ft=vim")
- execute("let &rtp='build/runtime/,'.&rtp")
- execute("syntax on")
+ command("set ft=vim")
+ command("let &rtp='build/runtime/,'.&rtp")
+ command("syntax on")
insert([[
call bufnr('%')
call nvim_input('typing...')
diff --git a/test/functional/eval/glob_spec.lua b/test/functional/eval/glob_spec.lua
index 599b3dcdc3..b8807ecfcc 100644
--- a/test/functional/eval/glob_spec.lua
+++ b/test/functional/eval/glob_spec.lua
@@ -1,13 +1,13 @@
local lfs = require('lfs')
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, eval, eq = helpers.clear, helpers.execute, helpers.eval, helpers.eq
+local clear, command, eval, eq = helpers.clear, helpers.command, helpers.eval, helpers.eq
before_each(function()
clear()
lfs.mkdir('test-glob')
-- Long path might cause "Press ENTER" prompt; use :silent to avoid it.
- execute('silent cd test-glob')
+ command('silent cd test-glob')
end)
after_each(function()
diff --git a/test/functional/eval/hostname_spec.lua b/test/functional/eval/hostname_spec.lua
new file mode 100644
index 0000000000..f1867846c4
--- /dev/null
+++ b/test/functional/eval/hostname_spec.lua
@@ -0,0 +1,17 @@
+local helpers = require('test.functional.helpers')(after_each)
+local ok = helpers.ok
+local call = helpers.call
+local clear = helpers.clear
+
+describe('hostname()', function()
+ before_each(clear)
+
+ it('returns hostname string', function()
+ local actual = call('hostname')
+ ok(string.len(actual) > 1)
+ if call('executable', 'hostname') == 1 then
+ local expected = string.gsub(call('system', 'hostname'), '[\n\r]', '')
+ helpers.eq(expected, actual)
+ end
+ end)
+end)
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index fc0a19bdfa..4d34cde849 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -4,16 +4,17 @@ local funcs = helpers.funcs
local meths = helpers.meths
local eq = helpers.eq
local eval = helpers.eval
-local execute = helpers.execute
+local command = helpers.command
local exc_exec = helpers.exc_exec
local redir_exec = helpers.redir_exec
local NIL = helpers.NIL
+local source = helpers.source
describe('json_decode() function', function()
local restart = function(...)
clear(...)
- execute('language C')
- execute([[
+ source([[
+ language C
function Eq(exp, act)
let act = a:act
let exp = a:exp
@@ -45,8 +46,6 @@ describe('json_decode() function', function()
endif
return 1
endfunction
- ]])
- execute([[
function EvalEq(exp, act_expr)
let act = eval(a:act_expr)
if Eq(a:exp, act)
@@ -441,7 +440,7 @@ describe('json_decode() function', function()
local sp_decode_eq = function(expected, json)
meths.set_var('__json', json)
speq(expected, 'json_decode(g:__json)')
- execute('unlet! g:__json')
+ command('unlet! g:__json')
end
it('parses strings with NUL properly', function()
@@ -527,7 +526,7 @@ end)
describe('json_encode() function', function()
before_each(function()
clear()
- execute('language C')
+ command('language C')
end)
it('dumps strings', function()
@@ -576,94 +575,94 @@ describe('json_encode() function', function()
it('cannot dump generic mapping with generic mapping keys and values',
function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('call add(todump._VAL, [todumpv1, todumpv2])')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('call add(todump._VAL, [todumpv1, todumpv2])')
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
end)
it('cannot dump generic mapping with ext key', function()
- execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
end)
it('cannot dump generic mapping with array key', function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
end)
it('cannot dump generic mapping with UINT64_MAX key', function()
- execute('let todump = {"_TYPE": v:msgpack_types.integer}')
- execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.integer}')
+ command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
end)
it('cannot dump generic mapping with floating-point key', function()
- execute('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('Vim(call):E474: Invalid key in special dictionary', exc_exec('call json_encode(todump)'))
end)
it('can dump generic mapping with STR special key and NUL', function()
- execute('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n"]}')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n"]}')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
end)
it('can dump generic mapping with BIN special key and NUL', function()
- execute('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n"]}')
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n"]}')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[todump, 1]]}')
eq('{"\\u0000": 1}', eval('json_encode(todump)'))
end)
it('can dump STR special mapping with NUL and NL', function()
- execute('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n", ""]}')
+ command('let todump = {"_TYPE": v:msgpack_types.string, "_VAL": ["\\n", ""]}')
eq('"\\u0000\\n"', eval('json_encode(todump)'))
end)
it('can dump BIN special mapping with NUL and NL', function()
- execute('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n", ""]}')
+ command('let todump = {"_TYPE": v:msgpack_types.binary, "_VAL": ["\\n", ""]}')
eq('"\\u0000\\n"', eval('json_encode(todump)'))
end)
it('cannot dump special ext mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
eq('Vim(call):E474: Unable to convert EXT string to JSON', exc_exec('call json_encode(todump)'))
end)
it('can dump special array mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
eq('[5, [""]]', eval('json_encode(todump)'))
end)
it('can dump special UINT64_MAX mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.integer}')
- execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
+ command('let todump = {"_TYPE": v:msgpack_types.integer}')
+ command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
eq('18446744073709551615', eval('json_encode(todump)'))
end)
it('can dump special INT64_MIN mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.integer}')
- execute('let todump._VAL = [-1, 2, 0, 0]')
+ command('let todump = {"_TYPE": v:msgpack_types.integer}')
+ command('let todump._VAL = [-1, 2, 0, 0]')
eq('-9223372036854775808', eval('json_encode(todump)'))
end)
it('can dump special BOOLEAN true mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
+ command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
eq('true', eval('json_encode(todump)'))
end)
it('can dump special BOOLEAN false mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
+ command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
eq('false', eval('json_encode(todump)'))
end)
it('can dump special NIL mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
+ command('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
eq('null', eval('json_encode(todump)'))
end)
@@ -673,7 +672,7 @@ describe('json_encode() function', function()
end)
it('fails to dump a partial', function()
- execute('function T() dict\nendfunction')
+ command('function T() dict\nendfunction')
eq('Vim(call):E474: Error while dumping encode_tv2json() argument, itself: attempt to dump function reference',
exc_exec('call json_encode(function("T", [1, 2], {}))'))
end)
@@ -684,56 +683,56 @@ describe('json_encode() function', function()
end)
it('fails to dump a recursive list', function()
- execute('let todump = [[[]]]')
- execute('call add(todump[0][0], todump)')
+ command('let todump = [[[]]]')
+ command('call add(todump[0][0], todump)')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode(todump)'))
end)
it('fails to dump a recursive dict', function()
- execute('let todump = {"d": {"d": {}}}')
- execute('call extend(todump.d.d, {"d": todump})')
+ command('let todump = {"d": {"d": {}}}')
+ command('call extend(todump.d.d, {"d": todump})')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode([todump])'))
end)
it('can dump dict with two same dicts inside', function()
- execute('let inter = {}')
- execute('let todump = {"a": inter, "b": inter}')
+ command('let inter = {}')
+ command('let todump = {"a": inter, "b": inter}')
eq('{"a": {}, "b": {}}', eval('json_encode(todump)'))
end)
it('can dump list with two same lists inside', function()
- execute('let inter = []')
- execute('let todump = [inter, inter]')
+ command('let inter = []')
+ command('let todump = [inter, inter]')
eq('[[], []]', eval('json_encode(todump)'))
end)
it('fails to dump a recursive list in a special dict', function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
- execute('call add(todump._VAL, todump)')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
+ command('call add(todump._VAL, todump)')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode(todump)'))
end)
it('fails to dump a recursive (val) map in a special dict', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('call add(todump._VAL, ["", todump])')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('call add(todump._VAL, ["", todump])')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode([todump])'))
end)
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [["", []]]}')
- execute('call add(todump._VAL[0][1], todump._VAL)')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [["", []]]}')
+ command('call add(todump._VAL[0][1], todump._VAL)')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode(todump)'))
end)
it('fails to dump a recursive (val) special list in a special dict',
function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
- execute('call add(todump._VAL, ["", todump._VAL])')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
+ command('call add(todump._VAL, ["", todump._VAL])')
eq('Vim(call):E724: unable to correctly dump variable with self-referencing container',
exc_exec('call json_encode(todump)'))
end)
diff --git a/test/functional/eval/modeline_spec.lua b/test/functional/eval/modeline_spec.lua
index 0be7210a76..c5bb798f4a 100644
--- a/test/functional/eval/modeline_spec.lua
+++ b/test/functional/eval/modeline_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, write_file = helpers.clear, helpers.execute, helpers.write_file
+local clear, command, write_file = helpers.clear, helpers.command, helpers.write_file
local eq, eval = helpers.eq, helpers.eval
describe("modeline", function()
@@ -12,7 +12,7 @@ describe("modeline", function()
it('does not crash with a large version number', function()
write_file(tempfile, 'vim100000000000000000000000')
- execute('e! ' .. tempfile)
+ command('e! ' .. tempfile)
eq(2, eval('1+1')) -- Still alive?
end)
diff --git a/test/functional/eval/msgpack_functions_spec.lua b/test/functional/eval/msgpack_functions_spec.lua
index 44c01d2226..c5520deb73 100644
--- a/test/functional/eval/msgpack_functions_spec.lua
+++ b/test/functional/eval/msgpack_functions_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local funcs = helpers.funcs
local eval, eq = helpers.eval, helpers.eq
-local execute = helpers.execute
+local command = helpers.command
local nvim = helpers.nvim
local exc_exec = helpers.exc_exec
@@ -331,9 +331,9 @@ describe('msgpack*() functions', function()
obj_test('are able to dump and restore floating-point value', {0.125})
it('can restore and dump UINT64_MAX', function()
- execute('let dumped = ["\\xCF" . repeat("\\xFF", 8)]')
- execute('let parsed = msgpackparse(dumped)')
- execute('let dumped2 = msgpackdump(parsed)')
+ command('let dumped = ["\\xCF" . repeat("\\xFF", 8)]')
+ command('let parsed = msgpackparse(dumped)')
+ command('let dumped2 = msgpackdump(parsed)')
eq(1, eval('type(parsed[0]) == type(0) ' ..
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
if eval('type(parsed[0]) == type(0)') == 1 then
@@ -345,9 +345,9 @@ describe('msgpack*() functions', function()
end)
it('can restore and dump INT64_MIN', function()
- execute('let dumped = ["\\xD3\\x80" . repeat("\\n", 7)]')
- execute('let parsed = msgpackparse(dumped)')
- execute('let dumped2 = msgpackdump(parsed)')
+ command('let dumped = ["\\xD3\\x80" . repeat("\\n", 7)]')
+ command('let parsed = msgpackparse(dumped)')
+ command('let dumped2 = msgpackdump(parsed)')
eq(1, eval('type(parsed[0]) == type(0) ' ..
'|| parsed[0]._TYPE is v:msgpack_types.integer'))
if eval('type(parsed[0]) == type(0)') == 1 then
@@ -359,33 +359,33 @@ describe('msgpack*() functions', function()
end)
it('can restore and dump BIN string with zero byte', function()
- execute('let dumped = ["\\xC4\\x01\\n"]')
- execute('let parsed = msgpackparse(dumped)')
- execute('let dumped2 = msgpackdump(parsed)')
+ command('let dumped = ["\\xC4\\x01\\n"]')
+ command('let parsed = msgpackparse(dumped)')
+ command('let dumped2 = msgpackdump(parsed)')
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.binary'))
eq(1, eval('dumped ==# dumped2'))
end)
it('can restore and dump STR string with zero byte', function()
- execute('let dumped = ["\\xA1\\n"]')
- execute('let parsed = msgpackparse(dumped)')
- execute('let dumped2 = msgpackdump(parsed)')
+ command('let dumped = ["\\xA1\\n"]')
+ command('let parsed = msgpackparse(dumped)')
+ command('let dumped2 = msgpackdump(parsed)')
eq({{_TYPE={}, _VAL={'\n'}}}, eval('parsed'))
eq(1, eval('parsed[0]._TYPE is v:msgpack_types.string'))
eq(1, eval('dumped ==# dumped2'))
end)
it('can restore and dump BIN string with NL', function()
- execute('let dumped = ["\\xC4\\x01", ""]')
- execute('let parsed = msgpackparse(dumped)')
- execute('let dumped2 = msgpackdump(parsed)')
+ command('let dumped = ["\\xC4\\x01", ""]')
+ command('let parsed = msgpackparse(dumped)')
+ command('let dumped2 = msgpackdump(parsed)')
eq({"\n"}, eval('parsed'))
eq(1, eval('dumped ==# dumped2'))
end)
it('dump and restore special mapping with floating-point value', function()
- execute('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
+ command('let todump = {"_TYPE": v:msgpack_types.float, "_VAL": 0.125}')
eq({0.125}, eval('msgpackparse(msgpackdump([todump]))'))
end)
end)
@@ -394,52 +394,53 @@ describe('msgpackparse() function', function()
before_each(clear)
it('restores nil as v:null', function()
- execute('let dumped = ["\\xC0"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\xC0"]')
+ command('let parsed = msgpackparse(dumped)')
eq('[v:null]', eval('string(parsed)'))
end)
it('restores boolean false as v:false', function()
- execute('let dumped = ["\\xC2"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\xC2"]')
+ command('let parsed = msgpackparse(dumped)')
eq({false}, eval('parsed'))
end)
it('restores boolean true as v:true', function()
- execute('let dumped = ["\\xC3"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\xC3"]')
+ command('let parsed = msgpackparse(dumped)')
eq({true}, eval('parsed'))
end)
it('restores FIXSTR as special dict', function()
- execute('let dumped = ["\\xa2ab"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\xa2ab"]')
+ command('let parsed = msgpackparse(dumped)')
eq({{_TYPE={}, _VAL={'ab'}}}, eval('parsed'))
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.string'))
end)
it('restores BIN 8 as string', function()
- execute('let dumped = ["\\xC4\\x02ab"]')
+ command('let dumped = ["\\xC4\\x02ab"]')
eq({'ab'}, eval('msgpackparse(dumped)'))
end)
it('restores FIXEXT1 as special dictionary', function()
- execute('let dumped = ["\\xD4\\x10", ""]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\xD4\\x10", ""]')
+ command('let parsed = msgpackparse(dumped)')
eq({{_TYPE={}, _VAL={0x10, {"", ""}}}}, eval('parsed'))
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.ext'))
end)
it('restores MAP with BIN key as special dictionary', function()
- execute('let dumped = ["\\x81\\xC4\\x01a\\xC4\\n"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\x81\\xC4\\x01a\\xC4\\n"]')
+ command('let parsed = msgpackparse(dumped)')
eq({{_TYPE={}, _VAL={{'a', ''}}}}, eval('parsed'))
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
end)
it('restores MAP with duplicate STR keys as special dictionary', function()
- execute('let dumped = ["\\x82\\xA1a\\xC4\\n\\xA1a\\xC4\\n"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\x82\\xA1a\\xC4\\n\\xA1a\\xC4\\n"]')
+ -- FIXME Internal error bug
+ command('silent! let parsed = msgpackparse(dumped)')
eq({{_TYPE={}, _VAL={ {{_TYPE={}, _VAL={'a'}}, ''},
{{_TYPE={}, _VAL={'a'}}, ''}}} }, eval('parsed'))
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
@@ -448,8 +449,8 @@ describe('msgpackparse() function', function()
end)
it('restores MAP with MAP key as special dictionary', function()
- execute('let dumped = ["\\x81\\x80\\xC4\\n"]')
- execute('let parsed = msgpackparse(dumped)')
+ command('let dumped = ["\\x81\\x80\\xC4\\n"]')
+ command('let parsed = msgpackparse(dumped)')
eq({{_TYPE={}, _VAL={{{}, ''}}}}, eval('parsed'))
eq(1, eval('g:parsed[0]._TYPE is v:msgpack_types.map'))
end)
@@ -494,7 +495,7 @@ describe('msgpackparse() function', function()
end)
it('fails to parse a partial', function()
- execute('function T() dict\nendfunction')
+ command('function T() dict\nendfunction')
eq('Vim(call):E686: Argument of msgpackparse() must be a List',
exc_exec('call msgpackparse(function("T", [1, 2], {}))'))
end)
@@ -514,10 +515,10 @@ describe('msgpackdump() function', function()
end)
it('can dump generic mapping with generic mapping keys and values', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('call add(todump._VAL, [todumpv1, todumpv2])')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('let todumpv1 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('let todumpv2 = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('call add(todump._VAL, [todumpv1, todumpv2])')
eq({'\129\128\128'}, eval('msgpackdump([todump])'))
end)
@@ -530,130 +531,130 @@ describe('msgpackdump() function', function()
end)
it('can v:null', function()
- execute('let todump = v:null')
+ command('let todump = v:null')
end)
it('can dump special bool mapping (true)', function()
- execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
+ command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 1}')
eq({'\195'}, eval('msgpackdump([todump])'))
end)
it('can dump special bool mapping (false)', function()
- execute('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
+ command('let todump = {"_TYPE": v:msgpack_types.boolean, "_VAL": 0}')
eq({'\194'}, eval('msgpackdump([todump])'))
end)
it('can dump special nil mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
+ command('let todump = {"_TYPE": v:msgpack_types.nil, "_VAL": 0}')
eq({'\192'}, eval('msgpackdump([todump])'))
end)
it('can dump special ext mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.ext, "_VAL": [5, ["",""]]}')
eq({'\212\005', ''}, eval('msgpackdump([todump])'))
end)
it('can dump special array mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": [5, [""]]}')
eq({'\146\005\145\196\n'}, eval('msgpackdump([todump])'))
end)
it('can dump special UINT64_MAX mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.integer}')
- execute('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
+ command('let todump = {"_TYPE": v:msgpack_types.integer}')
+ command('let todump._VAL = [1, 3, 0x7FFFFFFF, 0x7FFFFFFF]')
eq({'\207\255\255\255\255\255\255\255\255'}, eval('msgpackdump([todump])'))
end)
it('can dump special INT64_MIN mapping', function()
- execute('let todump = {"_TYPE": v:msgpack_types.integer}')
- execute('let todump._VAL = [-1, 2, 0, 0]')
+ command('let todump = {"_TYPE": v:msgpack_types.integer}')
+ command('let todump._VAL = [-1, 2, 0, 0]')
eq({'\211\128\n\n\n\n\n\n\n'}, eval('msgpackdump([todump])'))
end)
it('fails to dump a function reference', function()
- execute('let Todump = function("tr")')
+ command('let Todump = function("tr")')
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
exc_exec('call msgpackdump([Todump])'))
end)
it('fails to dump a partial', function()
- execute('function T() dict\nendfunction')
- execute('let Todump = function("T", [1, 2], {})')
+ command('function T() dict\nendfunction')
+ command('let Todump = function("T", [1, 2], {})')
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, itself: attempt to dump function reference',
exc_exec('call msgpackdump([Todump])'))
end)
it('fails to dump a function reference in a list', function()
- execute('let todump = [function("tr")]')
+ command('let todump = [function("tr")]')
eq('Vim(call):E5004: Error while dumping msgpackdump() argument, index 0, index 0: attempt to dump function reference',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive list', function()
- execute('let todump = [[[]]]')
- execute('call add(todump[0][0], todump)')
+ command('let todump = [[[]]]')
+ command('call add(todump[0][0], todump)')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 0, index 0',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive dict', function()
- execute('let todump = {"d": {"d": {}}}')
- execute('call extend(todump.d.d, {"d": todump})')
+ command('let todump = {"d": {"d": {}}}')
+ command('call extend(todump.d.d, {"d": todump})')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key \'d\', key \'d\', key \'d\'',
exc_exec('call msgpackdump([todump])'))
end)
it('can dump dict with two same dicts inside', function()
- execute('let inter = {}')
- execute('let todump = {"a": inter, "b": inter}')
+ command('let inter = {}')
+ command('let todump = {"a": inter, "b": inter}')
eq({"\130\161a\128\161b\128"}, eval('msgpackdump([todump])'))
end)
it('can dump list with two same lists inside', function()
- execute('let inter = []')
- execute('let todump = [inter, inter]')
+ command('let inter = []')
+ command('let todump = [inter, inter]')
eq({"\146\144\144"}, eval('msgpackdump([todump])'))
end)
it('fails to dump a recursive list in a special dict', function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
- execute('call add(todump._VAL, todump)')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
+ command('call add(todump._VAL, todump)')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive (key) map in a special dict', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('call add(todump._VAL, [todump, 0])')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('call add(todump._VAL, [todump, 0])')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 1',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive (val) map in a special dict', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
- execute('call add(todump._VAL, [0, todump])')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": []}')
+ command('call add(todump._VAL, [0, todump])')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key 0 at index 0 from special map',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive (key) map in a special dict, _VAL reference', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
- execute('call add(todump._VAL[0][0], todump._VAL)')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
+ command('call add(todump._VAL[0][0], todump._VAL)')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [[[[...@0], []]]] at index 0 from special map, index 0',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive (val) map in a special dict, _VAL reference', function()
- execute('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
- execute('call add(todump._VAL[0][1], todump._VAL)')
+ command('let todump = {"_TYPE": v:msgpack_types.map, "_VAL": [[[], []]]}')
+ command('call add(todump._VAL[0][1], todump._VAL)')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in key [] at index 0 from special map, index 0',
exc_exec('call msgpackdump([todump])'))
end)
it('fails to dump a recursive (val) special list in a special dict',
function()
- execute('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
- execute('call add(todump._VAL, [0, todump._VAL])')
+ command('let todump = {"_TYPE": v:msgpack_types.array, "_VAL": []}')
+ command('call add(todump._VAL, [0, todump._VAL])')
eq('Vim(call):E5005: Unable to dump msgpackdump() argument, index 0: container references itself in index 0, index 1',
exc_exec('call msgpackdump([todump])'))
end)
@@ -689,7 +690,7 @@ describe('msgpackdump() function', function()
end)
it('fails to dump a partial', function()
- execute('function T() dict\nendfunction')
+ command('function T() dict\nendfunction')
eq('Vim(call):E686: Argument of msgpackdump() must be a List',
exc_exec('call msgpackdump(function("T", [1, 2], {}))'))
end)
diff --git a/test/functional/eval/reltime_spec.lua b/test/functional/eval/reltime_spec.lua
index 0b19d372ec..0181f09024 100644
--- a/test/functional/eval/reltime_spec.lua
+++ b/test/functional/eval/reltime_spec.lua
@@ -1,6 +1,6 @@
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 neq, command, funcs = helpers.neq, helpers.command, helpers.funcs
local reltime, reltimestr, reltimefloat = funcs.reltime, funcs.reltimestr, funcs.reltimefloat
describe('reltimestr(), reltimefloat()', function()
@@ -8,7 +8,7 @@ describe('reltimestr(), reltimefloat()', function()
it('Checks', function()
local now = reltime()
- execute('sleep 10m')
+ command('sleep 10m')
local later = reltime()
local elapsed = reltime(now)
diff --git a/test/functional/eval/setpos_spec.lua b/test/functional/eval/setpos_spec.lua
index 2e27cd8ac0..6a8b3a8732 100644
--- a/test/functional/eval/setpos_spec.lua
+++ b/test/functional/eval/setpos_spec.lua
@@ -3,7 +3,7 @@ local setpos = helpers.funcs.setpos
local getpos = helpers.funcs.getpos
local insert = helpers.insert
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local eval = helpers.eval
local eq = helpers.eq
local exc_exec = helpers.exc_exec
@@ -16,7 +16,7 @@ describe('setpos() function', function()
First line of text
Second line of text
Third line of text]])
- execute('new')
+ command('new')
insert([[
Line of text 1
Line of text 2
@@ -34,7 +34,8 @@ describe('setpos() function', function()
it('can set lowercase marks in the current buffer', function()
setpos("'d", {0, 2, 1, 0})
eq(getpos("'d"), {0, 2, 1, 0})
- execute('undo', 'call setpos("\'d", [2, 3, 1, 0])')
+ command('undo')
+ command('call setpos("\'d", [2, 3, 1, 0])')
eq(getpos("'d"), {0, 3, 1, 0})
end)
it('can set lowercase marks in other buffers', function()
@@ -42,7 +43,7 @@ describe('setpos() function', function()
eq(0, retval)
setpos("'d", {1, 2, 1, 0})
eq(getpos("'d"), {0, 0, 0, 0})
- execute('wincmd w')
+ command('wincmd w')
eq(eval('bufnr("%")'), 1)
eq(getpos("'d"), {0, 2, 1, 0})
end)
diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua
index 4c5d63ce23..3d9358447e 100644
--- a/test/functional/eval/special_vars_spec.lua
+++ b/test/functional/eval/special_vars_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local exc_exec = helpers.exc_exec
-local execute = helpers.execute
+local command = helpers.command
local funcs = helpers.funcs
local clear = helpers.clear
local eval = helpers.eval
@@ -12,7 +12,7 @@ describe('Special values', function()
before_each(clear)
it('do not cause error when freed', function()
- execute([[
+ command([[
function Test()
try
return v:true
@@ -109,7 +109,7 @@ describe('Special values', function()
it('does not work with +=/-=/.=', function()
meths.set_var('true', true)
meths.set_var('false', false)
- execute('let null = v:null')
+ command('let null = v:null')
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let true += 1'))
eq('Vim(let):E734: Wrong variable type for +=', exc_exec('let false += 1'))
diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua
index ee75b593ff..7e213e2156 100644
--- a/test/functional/eval/system_spec.lua
+++ b/test/functional/eval/system_spec.lua
@@ -1,7 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
-local eq, call, clear, eval, execute, feed, nvim =
- helpers.eq, helpers.call, helpers.clear, helpers.eval, helpers.execute,
+
+local nvim_dir = helpers.nvim_dir
+local eq, call, clear, eval, feed_command, feed, nvim =
+ helpers.eq, helpers.call, helpers.clear, helpers.eval, helpers.feed_command,
helpers.feed, helpers.nvim
+local command = helpers.command
+local iswin = helpers.iswin
local Screen = require('test.functional.ui.screen')
@@ -31,8 +35,7 @@ describe('system()', function()
describe('command passed as a List', function()
local function printargs_path()
- return helpers.nvim_dir..'/printargs-test'
- .. (helpers.os_name() == 'windows' and '.exe' or '')
+ return nvim_dir..'/printargs-test' .. (iswin() and '.exe' or '')
end
it('sets v:shell_error if cmd[0] is not executable', function()
@@ -43,10 +46,10 @@ describe('system()', function()
it('parameter validation does NOT modify v:shell_error', function()
-- 1. Call system() with invalid parameters.
-- 2. Assert that v:shell_error was NOT set.
- execute('call system({})')
+ feed_command('call system({})')
eq('E475: Invalid argument: expected String or List', eval('v:errmsg'))
eq(0, eval('v:shell_error'))
- execute('call system([])')
+ feed_command('call system([])')
eq('E474: Invalid argument', eval('v:errmsg'))
eq(0, eval('v:shell_error'))
@@ -57,9 +60,9 @@ describe('system()', function()
-- 1. Call system() with invalid parameters.
-- 2. Assert that v:shell_error was NOT modified.
- execute('call system({})')
+ feed_command('call system({})')
eq(old_val, eval('v:shell_error'))
- execute('call system([])')
+ feed_command('call system([])')
eq(old_val, eval('v:shell_error'))
end)
@@ -86,23 +89,32 @@ describe('system()', function()
end)
it('does NOT run in shell', function()
- if helpers.os_name() ~= 'windows' then
+ if not iswin() then
eq("* $PATH %PATH%\n", eval("system(['echo', '*', '$PATH', '%PATH%'])"))
end
end)
end)
- if helpers.pending_win32(pending) then return end
-
it('sets v:shell_error', function()
- eval([[system("sh -c 'exit'")]])
- eq(0, eval('v:shell_error'))
- eval([[system("sh -c 'exit 1'")]])
- eq(1, eval('v:shell_error'))
- eval([[system("sh -c 'exit 5'")]])
- eq(5, eval('v:shell_error'))
- eval([[system('this-should-not-exist')]])
- eq(127, eval('v:shell_error'))
+ if iswin() then
+ eval([[system("cmd.exe /c exit")]])
+ eq(0, eval('v:shell_error'))
+ eval([[system("cmd.exe /c exit 1")]])
+ eq(1, eval('v:shell_error'))
+ eval([[system("cmd.exe /c exit 5")]])
+ eq(5, eval('v:shell_error'))
+ eval([[system('this-should-not-exist')]])
+ eq(1, eval('v:shell_error'))
+ else
+ eval([[system("sh -c 'exit'")]])
+ eq(0, eval('v:shell_error'))
+ eval([[system("sh -c 'exit 1'")]])
+ eq(1, eval('v:shell_error'))
+ eval([[system("sh -c 'exit 5'")]])
+ eq(5, eval('v:shell_error'))
+ eval([[system('this-should-not-exist')]])
+ eq(127, eval('v:shell_error'))
+ end
end)
describe('executes shell function if passed a string', function()
@@ -118,6 +130,40 @@ describe('system()', function()
screen:detach()
end)
+ if iswin() then
+ it('with shell=cmd.exe', function()
+ command('set shell=cmd.exe')
+ eq('""\n', eval([[system('echo ""')]]))
+ eq('"a b"\n', eval([[system('echo "a b"')]]))
+ eq('a \nb\n', eval([[system('echo a & echo b')]]))
+ eq('a \n', eval([[system('echo a 2>&1')]]))
+ eval([[system('cd "C:\Program Files"')]])
+ eq(0, eval('v:shell_error'))
+ end)
+
+ it('with shell=cmd', function()
+ command('set shell=cmd')
+ eq('"a b"\n', eval([[system('echo "a b"')]]))
+ end)
+
+ it('with shell=$COMSPEC', function()
+ local comspecshell = eval("fnamemodify($COMSPEC, ':t')")
+ if comspecshell == 'cmd.exe' then
+ command('set shell=$COMSPEC')
+ eq('"a b"\n', eval([[system('echo "a b"')]]))
+ else
+ pending('$COMSPEC is not cmd.exe: ' .. comspecshell)
+ end
+ end)
+
+ it('works with powershell', function()
+ helpers.set_shell_powershell()
+ eq('a\nb\n', eval([[system('echo a b')]]))
+ eq('C:\\\n', eval([[system('cd c:\; (Get-Location).Path')]]))
+ eq('a b\n', eval([[system('echo "a b"')]]))
+ end)
+ end
+
it('`echo` and waits for its return', function()
feed(':call system("echo")<cr>')
screen:expect([[
@@ -178,11 +224,15 @@ describe('system()', function()
describe('passing no input', function()
it('returns the program output', function()
- eq("echoed", eval('system("echo -n echoed")'))
+ if iswin() then
+ eq("echoed\n", eval('system("echo echoed")'))
+ else
+ eq("echoed", eval('system("echo -n echoed")'))
+ end
end)
it('to backgrounded command does not crash', function()
-- This is indeterminate, just exercise the codepath. May get E5677.
- execute('call system("echo -n echoed &")')
+ feed_command('call system("echo -n echoed &")')
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
if v_errnum then
eq("E5677:", v_errnum)
@@ -197,7 +247,7 @@ describe('system()', function()
end)
it('to backgrounded command does not crash', function()
-- This is indeterminate, just exercise the codepath. May get E5677.
- execute('call system("cat - &")')
+ feed_command('call system("cat - &")')
local v_errnum = string.match(eval("v:errmsg"), "^E%d*:")
if v_errnum then
eq("E5677:", v_errnum)
@@ -275,21 +325,30 @@ describe('system()', function()
end)
end)
-if helpers.pending_win32(pending) then return end
-
describe('systemlist()', function()
-- Similar to `system()`, but returns List instead of String.
before_each(clear)
- it('sets the v:shell_error variable', function()
- eval([[systemlist("sh -c 'exit'")]])
- eq(0, eval('v:shell_error'))
- eval([[systemlist("sh -c 'exit 1'")]])
- eq(1, eval('v:shell_error'))
- eval([[systemlist("sh -c 'exit 5'")]])
- eq(5, eval('v:shell_error'))
- eval([[systemlist('this-should-not-exist')]])
- eq(127, eval('v:shell_error'))
+ it('sets v:shell_error', function()
+ if iswin() then
+ eval([[systemlist("cmd.exe /c exit")]])
+ eq(0, eval('v:shell_error'))
+ eval([[systemlist("cmd.exe /c exit 1")]])
+ eq(1, eval('v:shell_error'))
+ eval([[systemlist("cmd.exe /c exit 5")]])
+ eq(5, eval('v:shell_error'))
+ eval([[systemlist('this-should-not-exist')]])
+ eq(1, eval('v:shell_error'))
+ else
+ eval([[systemlist("sh -c 'exit'")]])
+ eq(0, eval('v:shell_error'))
+ eval([[systemlist("sh -c 'exit 1'")]])
+ eq(1, eval('v:shell_error'))
+ eval([[systemlist("sh -c 'exit 5'")]])
+ eq(5, eval('v:shell_error'))
+ eval([[systemlist('this-should-not-exist')]])
+ eq(127, eval('v:shell_error'))
+ end
end)
describe('exectues shell function', function()
@@ -387,6 +446,7 @@ describe('systemlist()', function()
after_each(delete_file(fname))
it('replaces NULs by newline characters', function()
+ if helpers.pending_win32(pending) then return end
eq({'part1\npart2\npart3'}, eval('systemlist("cat '..fname..'")'))
end)
end)
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index b3c4cd07eb..2dd9968a01 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -2,7 +2,7 @@ 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
-local clear, execute, funcs = helpers.clear, helpers.execute, helpers.funcs
+local clear, command, funcs = helpers.clear, helpers.command, helpers.funcs
local curbufmeths = helpers.curbufmeths
describe('timers', function()
@@ -17,14 +17,14 @@ describe('timers', function()
end)
it('works one-shot', function()
- execute("call timer_start(50, 'MyHandler')")
+ command("call timer_start(50, 'MyHandler')")
eq(0,eval("g:val"))
run(nil, nil, nil, 200)
eq(1,eval("g:val"))
end)
it('works one-shot when repeat=0', function()
- execute("call timer_start(50, 'MyHandler', {'repeat': 0})")
+ command("call timer_start(50, 'MyHandler', {'repeat': 0})")
eq(0,eval("g:val"))
run(nil, nil, nil, 200)
eq(1,eval("g:val"))
@@ -32,14 +32,14 @@ describe('timers', function()
it('works with repeat two', function()
- execute("call timer_start(50, 'MyHandler', {'repeat': 2})")
+ command("call timer_start(50, 'MyHandler', {'repeat': 2})")
eq(0,eval("g:val"))
run(nil, nil, nil, 300)
eq(2,eval("g:val"))
end)
it('are triggered during sleep', function()
- execute("call timer_start(50, 'MyHandler', {'repeat': 2})")
+ command("call timer_start(50, 'MyHandler', {'repeat': 2})")
nvim_async("command", "sleep 10")
eq(0,eval("g:val"))
run(nil, nil, nil, 300)
@@ -63,12 +63,12 @@ describe('timers', function()
end)
it('are paused when event processing is disabled', function()
- execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
+ command("call timer_start(50, 'MyHandler', {'repeat': -1})")
run(nil, nil, nil, 100)
local count = eval("g:val")
-- shows two line error message and thus invokes the return prompt.
-- if we start to allow event processing here, we need to change this test.
- execute("throw 'fatal error'")
+ feed(':throw "fatal error"<CR>')
run(nil, nil, nil, 300)
feed("<cr>")
local diff = eval("g:val") - count
@@ -76,7 +76,7 @@ describe('timers', function()
end)
it('are triggered in blocking getchar() call', function()
- execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
+ command("call timer_start(50, 'MyHandler', {'repeat': -1})")
nvim_async("command", "let g:c = getchar()")
run(nil, nil, nil, 300)
feed("c")
@@ -157,7 +157,7 @@ describe('timers', function()
endif
endfunc
]])
- execute("call timer_start(50, 'MyHandler', {'repeat': -1})")
+ command("call timer_start(50, 'MyHandler', {'repeat': -1})")
eq(0,eval("g:val"))
run(nil, nil, nil, 300)
eq(3,eval("g:val"))
@@ -170,8 +170,8 @@ describe('timers', function()
let g:val2 += 1
endfunc
]])
- execute("call timer_start(50, 'MyHandler', {'repeat': 3})")
- execute("call timer_start(100, 'MyHandler2', {'repeat': 2})")
+ command("call timer_start(50, 'MyHandler', {'repeat': 3})")
+ command("call timer_start(100, 'MyHandler2', {'repeat': 2})")
run(nil, nil, nil, 300)
eq(3,eval("g:val"))
eq(2,eval("g:val2"))
@@ -186,7 +186,7 @@ describe('timers', function()
let g:val += 1
endfunc
]])
- execute("call timer_start(5, 'MyHandler', {'repeat': 1})")
+ command("call timer_start(5, 'MyHandler', {'repeat': 1})")
run(nil, nil, nil, 300)
eq(1,eval("g:val"))
end)
@@ -201,7 +201,7 @@ describe('timers', function()
echo "evil"
endfunc
]])
- execute("call timer_start(100, 'MyHandler', {'repeat': 1})")
+ command("call timer_start(100, 'MyHandler', {'repeat': 1})")
feed(":good")
screen:sleep(200)
screen:expect([[
diff --git a/test/functional/eval/writefile_spec.lua b/test/functional/eval/writefile_spec.lua
index 3052c616e0..2f84114b9b 100644
--- a/test/functional/eval/writefile_spec.lua
+++ b/test/functional/eval/writefile_spec.lua
@@ -80,6 +80,13 @@ describe('writefile()', function()
eq('a\0\0\0b', read_file(fname))
end)
+ it('writes with s and S', function()
+ eq(0, funcs.writefile({'\na\nb\n'}, fname, 'bs'))
+ eq('\0a\0b\0', read_file(fname))
+ eq(0, funcs.writefile({'a\n\n\nb'}, fname, 'bS'))
+ eq('a\0\0\0b', read_file(fname))
+ end)
+
it('correctly overwrites file', function()
eq(0, funcs.writefile({'\na\nb\n'}, fname, 'b'))
eq('\0a\0b\0', read_file(fname))
@@ -115,6 +122,8 @@ describe('writefile()', function()
eq('\nE729: using Funcref as a String',
redir_exec(('call writefile(%s)'):format(args:format('function("tr")'))))
end
+ eq('\nE5060: Unknown flag: «»',
+ redir_exec(('call writefile([], "%s", "bs«»")'):format(fname)))
eq('TEST', read_file(fname))
end)
diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua
index e11b90532f..6d31f05c2a 100644
--- a/test/functional/ex_cmds/arg_spec.lua
+++ b/test/functional/ex_cmds/arg_spec.lua
@@ -1,5 +1,5 @@
local helpers = require("test.functional.helpers")(after_each)
-local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
+local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
local ok = helpers.ok
local clear = helpers.clear
@@ -9,15 +9,15 @@ describe(":argument", function()
end)
it("does not restart :terminal buffer", function()
- execute("terminal")
+ command("terminal")
helpers.feed([[<C-\><C-N>]])
- execute("argadd")
+ command("argadd")
helpers.feed([[<C-\><C-N>]])
local bufname_before = funcs.bufname("%")
local bufnr_before = funcs.bufnr("%")
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
- execute("argument 1")
+ command("argument 1")
helpers.feed([[<C-\><C-N>]])
local bufname_after = funcs.bufname("%")
diff --git a/test/functional/ex_cmds/bang_filter_spec.lua b/test/functional/ex_cmds/bang_filter_spec.lua
index a320e6d018..aaec983b73 100644
--- a/test/functional/ex_cmds/bang_filter_spec.lua
+++ b/test/functional/ex_cmds/bang_filter_spec.lua
@@ -1,7 +1,7 @@
-- Specs for bang/filter commands
local helpers = require('test.functional.helpers')(after_each)
-local feed, execute, clear = helpers.feed, helpers.execute, helpers.clear
+local feed, command, clear = helpers.feed, helpers.command, helpers.clear
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
if helpers.pending_win32(pending) then return end
@@ -28,7 +28,7 @@ describe('issues', function()
end)
it('#3269 Last line of shell output is not truncated', function()
- execute([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
+ command([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
feed([[\l]])
screen:expect([[
~ |
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 5bf4d22d0f..059cb26d5d 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -6,7 +6,7 @@ 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 command = helpers.command
local exc_exec = helpers.exc_exec
if helpers.pending_win32(pending) then return end
@@ -58,7 +58,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin))
eq(0, lwd(globalwin, tabnr))
- execute('bot split')
+ command('bot split')
local localwin = call('winnr')
-- Initial window is still using globalDir
eq(globalDir, cwd(localwin))
@@ -66,7 +66,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin))
eq(0, lwd(globalwin, tabnr))
- execute('silent l' .. cmd .. ' ' .. directories.window)
+ command('silent l' .. cmd .. ' ' .. directories.window)
-- From window with local dir, the original window
-- is still reporting the global dir
eq(globalDir, cwd(globalwin))
@@ -80,7 +80,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(1, lwd(localwin))
eq(1, lwd(localwin, tabnr))
- execute('tabnew')
+ command('tabnew')
-- From new tab page, original window reports global dir
eq(globalDir, cwd(globalwin, tabnr))
eq(0, lwd(globalwin, tabnr))
@@ -100,8 +100,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(-1, 0))
eq(0, lwd(-1, globaltab))
- execute('tabnew')
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('tabnew')
+ command('silent t' .. cmd .. ' ' .. directories.tab)
local localtab = call('tabpagenr')
-- From local tab page, original tab reports globalDir
@@ -114,7 +114,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(1, lwd(-1, 0))
eq(1, lwd(-1, localtab))
- execute('tabnext')
+ command('tabnext')
-- From original tab page, local reports as such
eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, localtab))
@@ -128,13 +128,13 @@ for _, cmd in ipairs {'cd', 'chdir'} do
end)
it('works with tab-local pwd', function()
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('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)
+ command('silent l' .. cmd .. ' ' .. directories.window)
eq(directories.start, cwd(-1, -1))
eq(0, lwd(-1, -1))
end)
@@ -145,18 +145,18 @@ for _, cmd in ipairs {'cd', 'chdir'} do
local globalDir = directories.start
-- Create a new tab and change directory
- execute('tabnew')
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('tabnew')
+ command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, tcwd())
-- Create a new tab and verify it has inherited the directory
- execute('tabnew')
+ command('tabnew')
eq(globalDir .. '/' .. directories.tab, tcwd())
-- Change tab and change back, verify that directories are correct
- execute('tabnext')
+ command('tabnext')
eq(globalDir, tcwd())
- execute('tabprevious')
+ command('tabprevious')
eq(globalDir .. '/' .. directories.tab, tcwd())
end)
end)
@@ -164,7 +164,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
it('works', function()
local globalDir = directories.start
-- Create a new tab first and verify that is has the same working dir
- execute('tabnew')
+ command('tabnew')
eq(globalDir, cwd())
eq(globalDir, tcwd()) -- has no tab-local directory
eq(0, tlwd())
@@ -172,7 +172,7 @@ 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.tab)
+ command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, cwd())
eq(cwd(), tcwd()) -- working directory maches tab directory
eq(1, tlwd())
@@ -180,46 +180,46 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, wlwd())
-- Create a new window in this tab to test `:lcd`
- execute('new')
+ command('new')
eq(1, tlwd()) -- Still tab-local working directory
eq(0, wlwd()) -- Still no window-local working directory
eq(globalDir .. '/' .. directories.tab, cwd())
- execute('silent l' .. cmd .. ' ../' .. directories.window)
+ command('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')
+ command('wincmd w')
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
- execute('tabnext')
+ command('tabnext')
eq(globalDir, cwd() )
eq(0, tlwd())
eq(0, wlwd())
-- Verify global changes don't affect local ones
- execute('silent ' .. cmd .. ' ' .. directories.global)
+ command('silent ' .. cmd .. ' ' .. directories.global)
eq(globalDir .. '/' .. directories.global, cwd())
- execute('tabnext')
+ command('tabnext')
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
- execute('silent ' .. cmd .. ' ..')
+ command('silent ' .. cmd .. ' ..')
eq(globalDir, cwd() )
eq(0 , tlwd())
eq(0 , wlwd())
-- Which also affects the first tab
- execute('tabnext')
+ command('tabnext')
eq(globalDir, cwd())
-- But not in a window with its own local directory
- execute('tabnext | wincmd w')
+ command('tabnext | wincmd w')
eq(globalDir .. '/' .. directories.window, cwd() )
eq(0 , tlwd())
eq(globalDir .. '/' .. directories.window, wcwd())
@@ -280,8 +280,8 @@ describe("getcwd()", function ()
end)
it("returns empty string if working directory does not exist", function()
- execute("cd "..directories.global)
- execute("call delete('../"..directories.global.."', 'd')")
+ command("cd "..directories.global)
+ command("call delete('../"..directories.global.."', 'd')")
eq("", helpers.eval("getcwd()"))
end)
end)
diff --git a/test/functional/ex_cmds/ctrl_c_spec.lua b/test/functional/ex_cmds/ctrl_c_spec.lua
index 072fd2ad10..091a008814 100644
--- a/test/functional/ex_cmds/ctrl_c_spec.lua
+++ b/test/functional/ex_cmds/ctrl_c_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
-local execute = helpers.execute
+local command = helpers.command
describe("CTRL-C (mapped)", function()
before_each(function()
@@ -20,7 +20,7 @@ describe("CTRL-C (mapped)", function()
nnoremap <C-C> <NOP>
]])
- execute("silent edit! test/functional/fixtures/bigfile.txt")
+ command("silent edit! test/functional/fixtures/bigfile.txt")
local screen = Screen.new(52, 6)
screen:attach()
screen:set_default_attr_ids({
@@ -41,13 +41,13 @@ describe("CTRL-C (mapped)", function()
local function test_ctrl_c(ms)
feed(":global/^/p<CR>")
- helpers.sleep(ms)
+ screen:sleep(ms)
feed("<C-C>")
screen:expect([[Interrupt]], nil, nil, nil, true)
end
-- The test is time-sensitive. Try different sleep values.
- local ms_values = {1, 10, 100}
+ local ms_values = {1, 10, 100, 1000, 10000}
for i, ms in ipairs(ms_values) do
if i < #ms_values then
local status, _ = pcall(test_ctrl_c, ms)
diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua
index 99db5ea333..9105b84367 100644
--- a/test/functional/ex_cmds/drop_spec.lua
+++ b/test/functional/ex_cmds/drop_spec.lua
@@ -1,6 +1,6 @@
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 clear, feed, feed_command = helpers.clear, helpers.feed, helpers.feed_command
describe(":drop", function()
local screen
@@ -15,7 +15,7 @@ describe(":drop", function()
[2] = {reverse = true},
[3] = {bold = true},
})
- execute("set laststatus=2")
+ feed_command("set laststatus=2")
end)
after_each(function()
@@ -23,7 +23,7 @@ describe(":drop", function()
end)
it("works like :e when called with only one window open", function()
- execute("drop tmp1.vim")
+ feed_command("drop tmp1.vim")
screen:expect([[
^ |
{0:~ }|
@@ -39,10 +39,10 @@ describe(":drop", function()
end)
it("switches to an open window showing the buffer", function()
- execute("edit tmp1")
- execute("vsplit")
- execute("edit tmp2")
- execute("drop tmp1")
+ feed_command("edit tmp1")
+ feed_command("vsplit")
+ feed_command("edit tmp2")
+ feed_command("drop tmp1")
screen:expect([[
{2:|}^ |
{0:~ }{2:|}{0:~ }|
@@ -58,11 +58,11 @@ describe(":drop", function()
end)
it("splits off a new window when a buffer can't be abandoned", function()
- execute("edit tmp1")
- execute("vsplit")
- execute("edit tmp2")
+ feed_command("edit tmp1")
+ feed_command("vsplit")
+ feed_command("edit tmp2")
feed("iABC<esc>")
- execute("drop tmp3")
+ feed_command("drop tmp3")
screen:expect([[
^ {2:|} |
{0:~ }{2:|}{0:~ }|
diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua
index 3cc5f5fb95..6ed500a293 100644
--- a/test/functional/ex_cmds/edit_spec.lua
+++ b/test/functional/ex_cmds/edit_spec.lua
@@ -1,7 +1,8 @@
local helpers = require("test.functional.helpers")(after_each)
-local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
+local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
local ok = helpers.ok
local clear = helpers.clear
+local feed = helpers.feed
describe(":edit", function()
before_each(function()
@@ -9,13 +10,13 @@ describe(":edit", function()
end)
it("without arguments does not restart :terminal buffer", function()
- execute("terminal")
- helpers.feed([[<C-\><C-N>]])
+ command("terminal")
+ feed([[<C-\><C-N>]])
local bufname_before = funcs.bufname("%")
local bufnr_before = funcs.bufnr("%")
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
- execute("edit")
+ command("edit")
local bufname_after = funcs.bufname("%")
local bufnr_after = funcs.bufnr("%")
diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua
index 87ed7a2d0a..0769259be4 100644
--- a/test/functional/ex_cmds/encoding_spec.lua
+++ b/test/functional/ex_cmds/encoding_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, feed = helpers.clear, helpers.execute, helpers.feed
+local clear, feed_command, feed = helpers.clear, helpers.feed_command, helpers.feed
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
describe('&encoding', function()
@@ -12,7 +12,7 @@ describe('&encoding', function()
end)
it('cannot be changed after setup', function()
- execute('set encoding=latin1')
+ feed_command('set encoding=latin1')
-- error message expected
feed('<cr>')
neq(nil, string.find(eval('v:errmsg'), '^E474:'))
@@ -31,7 +31,7 @@ describe('&encoding', function()
end)
it('can be set to utf-8 without error', function()
- execute('set encoding=utf-8')
+ feed_command('set encoding=utf-8')
eq("", eval('v:errmsg'))
clear('--cmd', 'set enc=utf-8')
diff --git a/test/functional/ex_cmds/file_spec.lua b/test/functional/ex_cmds/file_spec.lua
new file mode 100644
index 0000000000..771c283134
--- /dev/null
+++ b/test/functional/ex_cmds/file_spec.lua
@@ -0,0 +1,35 @@
+local helpers = require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
+local clear = helpers.clear
+local command = helpers.command
+local eq = helpers.eq
+local funcs = helpers.funcs
+local rmdir = helpers.rmdir
+
+describe(':file', function()
+ local swapdir = lfs.currentdir()..'/Xtest-file_spec'
+ before_each(function()
+ clear()
+ rmdir(swapdir)
+ lfs.mkdir(swapdir)
+ end)
+ after_each(function()
+ command('%bwipeout!')
+ rmdir(swapdir)
+ end)
+
+ it("rename does not lose swapfile #6487", function()
+ local testfile = 'test-file_spec'
+ local testfile_renamed = testfile..'-renamed'
+ -- Note: `set swapfile` *must* go after `set directory`: otherwise it may
+ -- attempt to create a swapfile in different directory.
+ command('set directory^='..swapdir..'//')
+ command('set swapfile fileformat=unix undolevels=-1')
+
+ command('edit! '..testfile)
+ -- Before #6487 this gave "E301: Oops, lost the swap file !!!" on Windows.
+ command('file '..testfile_renamed)
+ eq(testfile_renamed..'.swp',
+ string.match(funcs.execute('swapname'), '[^%%]+$'))
+ end)
+end)
diff --git a/test/functional/ex_cmds/grep_spec.lua b/test/functional/ex_cmds/grep_spec.lua
index 13f88b7e03..43ef1bd424 100644
--- a/test/functional/ex_cmds/grep_spec.lua
+++ b/test/functional/ex_cmds/grep_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, feed, ok, eval =
- helpers.clear, helpers.execute, helpers.feed, helpers.ok, helpers.eval
+local clear, feed_command, feed, ok, eval =
+ helpers.clear, helpers.feed_command, helpers.feed, helpers.ok, helpers.eval
describe(':grep', function()
before_each(clear)
@@ -11,10 +11,10 @@ describe(':grep', function()
return
end
- execute([[set grepprg=grep\ -r]])
+ feed_command([[set grepprg=grep\ -r]])
-- Change to test directory so that the test does not run too long.
- execute('cd test')
- execute('grep a **/*')
+ feed_command('cd test')
+ feed_command('grep a **/*')
feed('<cr>') -- Press ENTER
ok(eval('len(getqflist())') > 9000) -- IT'S OVER 9000!!1
end)
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua
index 52df9e1592..57198600b9 100644
--- a/test/functional/ex_cmds/menu_spec.lua
+++ b/test/functional/ex_cmds/menu_spec.lua
@@ -1,23 +1,23 @@
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 clear, command, nvim = helpers.clear, helpers.command, helpers.nvim
+local expect, feed = helpers.expect, helpers.feed
local eq, eval = helpers.eq, helpers.eval
describe(':emenu', function()
before_each(function()
clear()
- execute('nnoremenu Test.Test inormal<ESC>')
- execute('inoremenu Test.Test insert')
- execute('vnoremenu Test.Test x')
- execute('cnoremenu Test.Test cmdmode')
+ command('nnoremenu Test.Test inormal<ESC>')
+ command('inoremenu Test.Test insert')
+ command('vnoremenu Test.Test x')
+ command('cnoremenu Test.Test cmdmode')
- execute('nnoremenu Edit.Paste p')
- execute('cnoremenu Edit.Paste <C-R>"')
+ command('nnoremenu Edit.Paste p')
+ command('cnoremenu Edit.Paste <C-R>"')
end)
it('executes correct bindings in normal mode without using API', function()
- execute('emenu Test.Test')
+ command('emenu Test.Test')
expect('normal')
end)
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index a161e49fc6..656b3f9bae 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -1,7 +1,7 @@
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
-local buf, eq, execute = helpers.curbufmeths, helpers.eq, helpers.execute
+local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command
local feed, nvim_prog, wait = helpers.feed, helpers.nvim_prog, helpers.wait
local ok, set_session, spawn = helpers.ok, helpers.set_session, helpers.spawn
@@ -27,12 +27,12 @@ describe(':oldfiles', function()
it('shows most recently used files', function()
local screen = Screen.new(100, 5)
screen:attach()
- execute('edit testfile1')
- execute('edit testfile2')
- execute('wshada ' .. shada_file)
- execute('rshada! ' .. shada_file)
+ feed_command('edit testfile1')
+ feed_command('edit testfile2')
+ feed_command('wshada ' .. shada_file)
+ feed_command('rshada! ' .. shada_file)
local oldfiles = helpers.meths.get_vvar('oldfiles')
- execute('oldfiles')
+ feed_command('oldfiles')
screen:expect([[
testfile2 |
1: ]].. add_padding(oldfiles[1]) ..[[ |
@@ -50,14 +50,14 @@ describe(':browse oldfiles', function()
before_each(function()
_clear()
- execute('edit testfile1')
+ feed_command('edit testfile1')
filename = buf.get_name()
- execute('edit testfile2')
+ feed_command('edit testfile2')
filename2 = buf.get_name()
- execute('wshada ' .. shada_file)
+ feed_command('wshada ' .. shada_file)
wait()
_clear()
- execute('rshada! ' .. shada_file)
+ feed_command('rshada! ' .. shada_file)
-- Ensure nvim is out of "Press ENTER..." prompt.
feed('<cr>')
@@ -70,7 +70,7 @@ describe(':browse oldfiles', function()
ok(filename == oldfiles[1] or filename == oldfiles[2])
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
- execute('browse oldfiles')
+ feed_command('browse oldfiles')
end)
after_each(function()
diff --git a/test/functional/ex_cmds/print_commands_spec.lua b/test/functional/ex_cmds/print_commands_spec.lua
new file mode 100644
index 0000000000..98c0f74635
--- /dev/null
+++ b/test/functional/ex_cmds/print_commands_spec.lua
@@ -0,0 +1,12 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, eq, command, funcs =
+ helpers.clear, helpers.eq, helpers.command, helpers.funcs
+
+describe(':z^', function()
+ before_each(clear)
+
+ it('correctly sets the cursor after :z^', function()
+ command('z^')
+ eq(1, funcs.line('.'))
+ end)
+end)
diff --git a/test/functional/ex_cmds/recover_spec.lua b/test/functional/ex_cmds/recover_spec.lua
index af1296c94c..cb68c29b9a 100644
--- a/test/functional/ex_cmds/recover_spec.lua
+++ b/test/functional/ex_cmds/recover_spec.lua
@@ -1,19 +1,18 @@
--- Tests for :recover
-
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,
+local feed_command, eq, clear, eval, feed, expect, source =
+ helpers.feed_command, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
helpers.expect, helpers.source
-
-if helpers.pending_win32(pending) then return end
+local command = helpers.command
+local ok = helpers.ok
+local rmdir = helpers.rmdir
describe(':recover', function()
before_each(clear)
it('fails if given a non-existent swapfile', function()
local swapname = 'bogus-swapfile'
- execute('recover '..swapname) -- This should not segfault. #2117
+ feed_command('recover '..swapname) -- This should not segfault. #2117
eq('E305: No swap file found for '..swapname, eval('v:errmsg'))
end)
@@ -23,30 +22,29 @@ describe(':preserve', function()
local swapdir = lfs.currentdir()..'/testdir_recover_spec'
before_each(function()
clear()
- helpers.rmdir(swapdir)
+ rmdir(swapdir)
lfs.mkdir(swapdir)
end)
after_each(function()
- helpers.rmdir(swapdir)
+ command('%bwipeout!')
+ rmdir(swapdir)
end)
it("saves to custom 'directory' and (R)ecovers (issue #1836)", function()
local testfile = 'testfile_recover_spec'
+ -- Put swapdir at the start of the 'directory' list. #1836
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
-- attempt to create a swapfile in different directory.
local init = [[
- set directory^=]]..swapdir..[[//
+ set directory^=]]..swapdir:gsub([[\]], [[\\]])..[[//
set swapfile fileformat=unix undolevels=-1
]]
source(init)
- execute('set swapfile fileformat=unix undolevels=-1')
- -- Put swapdir at the start of the 'directory' list. #1836
- execute('set directory^='..swapdir..'//')
- execute('edit '..testfile)
+ command('edit! '..testfile)
feed('isometext<esc>')
- execute('preserve')
- source('redir => g:swapname | swapname | redir END')
+ command('preserve')
+ source('redir => g:swapname | silent swapname | redir END')
local swappath1 = eval('g:swapname')
@@ -59,19 +57,20 @@ describe(':preserve', function()
source(init)
-- Use the "SwapExists" event to choose the (R)ecover choice at the dialog.
- execute('autocmd SwapExists * let v:swapchoice = "r"')
- execute('silent edit '..testfile)
- source('redir => g:swapname | swapname | redir END')
+ command('autocmd SwapExists * let v:swapchoice = "r"')
+ command('silent edit! '..testfile)
+ source('redir => g:swapname | silent swapname | redir END')
local swappath2 = eval('g:swapname')
+ expect('sometext')
-- swapfile from session 1 should end in .swp
- assert(testfile..'.swp' == string.match(swappath1, '[^%%]+$'))
-
+ eq(testfile..'.swp', string.match(swappath1, '[^%%]+$'))
-- swapfile from session 2 should end in .swo
- assert(testfile..'.swo' == string.match(swappath2, '[^%%]+$'))
-
- expect('sometext')
+ eq(testfile..'.swo', string.match(swappath2, '[^%%]+$'))
+ -- Verify that :swapname was not truncated (:help 'shortmess').
+ ok(nil == string.find(swappath1, '%.%.%.'))
+ ok(nil == string.find(swappath2, '%.%.%.'))
end)
end)
diff --git a/test/functional/ex_cmds/syntax_spec.lua b/test/functional/ex_cmds/syntax_spec.lua
new file mode 100644
index 0000000000..c9e96703de
--- /dev/null
+++ b/test/functional/ex_cmds/syntax_spec.lua
@@ -0,0 +1,17 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local eq = helpers.eq
+local clear = helpers.clear
+local exc_exec = helpers.exc_exec
+
+describe(':syntax', function()
+ before_each(clear)
+
+ describe('keyword', function()
+ it('does not crash when group name contains unprintable characters',
+ function()
+ eq('Vim(syntax):E669: Unprintable character in group name',
+ exc_exec('syntax keyword \024 foo bar'))
+ end)
+ end)
+end)
diff --git a/test/functional/ex_cmds/undojoin_spec.lua b/test/functional/ex_cmds/undojoin_spec.lua
index ba1e46ceb3..7803906619 100644
--- a/test/functional/ex_cmds/undojoin_spec.lua
+++ b/test/functional/ex_cmds/undojoin_spec.lua
@@ -5,7 +5,7 @@ local clear = helpers.clear
local insert = helpers.insert
local feed = helpers.feed
local expect = helpers.expect
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local exc_exec = helpers.exc_exec
describe(':undojoin command', function()
@@ -14,10 +14,10 @@ describe(':undojoin command', function()
insert([[
Line of text 1
Line of text 2]])
- execute('goto 1')
+ feed_command('goto 1')
end)
it('joins changes in a buffer', function()
- execute('undojoin | delete')
+ feed_command('undojoin | delete')
expect([[
Line of text 2]])
feed('u')
@@ -26,7 +26,7 @@ describe(':undojoin command', function()
end)
it('does not corrupt undolist when connected with redo', function()
feed('ixx<esc>')
- execute('undojoin | redo')
+ feed_command('undojoin | redo')
expect([[
xxLine of text 1
Line of text 2]])
diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua
index 4ac9f312ef..863d439080 100644
--- a/test/functional/ex_cmds/write_spec.lua
+++ b/test/functional/ex_cmds/write_spec.lua
@@ -1,15 +1,29 @@
local helpers = require('test.functional.helpers')(after_each)
-local eq, eval, clear, write_file, execute, source, insert =
+local lfs = require('lfs')
+local eq, eval, clear, write_file, source, insert =
helpers.eq, helpers.eval, helpers.clear, helpers.write_file,
- helpers.execute, helpers.source, helpers.insert
+ helpers.source, helpers.insert
+local redir_exec = helpers.redir_exec
+local exc_exec = helpers.exc_exec
+local command = helpers.command
+local feed_command = helpers.feed_command
+local funcs = helpers.funcs
+local meths = helpers.meths
if helpers.pending_win32(pending) then return end
+local fname = 'Xtest-functional-ex_cmds-write'
+local fname_bak = fname .. '~'
+local fname_broken = fname_bak .. 'broken'
+
describe(':write', function()
local function cleanup()
os.remove('test_bkc_file.txt')
os.remove('test_bkc_link.txt')
os.remove('test_fifo')
+ os.remove(fname)
+ os.remove(fname_bak)
+ os.remove(fname_broken)
end
before_each(function()
clear()
@@ -20,9 +34,9 @@ describe(':write', function()
end)
it('&backupcopy=auto preserves symlinks', function()
- execute('set backupcopy=auto')
+ command('set backupcopy=auto')
write_file('test_bkc_file.txt', 'content0')
- execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
+ command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
source([[
edit test_bkc_link.txt
call setline(1, ['content1'])
@@ -33,9 +47,9 @@ describe(':write', function()
end)
it('&backupcopy=no replaces symlink with new file', function()
- execute('set backupcopy=no')
+ command('set backupcopy=no')
write_file('test_bkc_file.txt', 'content0')
- execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
+ command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
source([[
edit test_bkc_link.txt
call setline(1, ['content1'])
@@ -56,11 +70,41 @@ describe(':write', function()
insert(text)
-- Blocks until a consumer reads the FIFO.
- execute("write >> test_fifo")
+ feed_command("write >> test_fifo")
-- Read the FIFO, this will unblock the :write above.
local fifo = assert(io.open("test_fifo"))
eq(text.."\n", fifo:read("*all"))
fifo:close()
end)
+
+ it('errors out correctly', function()
+ command('let $HOME=""')
+ eq(funcs.fnamemodify('.', ':p:h'), funcs.fnamemodify('.', ':p:h:~'))
+ -- Message from check_overwrite
+ eq(('\nE17: "'..funcs.fnamemodify('.', ':p:h')..'" is a directory'),
+ redir_exec('write .'))
+ meths.set_option('writeany', true)
+ -- Message from buf_write
+ eq(('\nE502: "." is a directory'),
+ redir_exec('write .'))
+ funcs.mkdir(fname_bak)
+ meths.set_option('backupdir', '.')
+ meths.set_option('backup', true)
+ write_file(fname, 'content0')
+ eq(0, exc_exec('edit ' .. fname))
+ funcs.setline(1, 'TTY')
+ eq('Vim(write):E510: Can\'t make backup file (add ! to override)',
+ exc_exec('write'))
+ meths.set_option('backup', false)
+ funcs.setfperm(fname, 'r--------')
+ eq('Vim(write):E505: "Xtest-functional-ex_cmds-write" is read-only (add ! to override)',
+ exc_exec('write'))
+ os.remove(fname)
+ os.remove(fname_bak)
+ write_file(fname_bak, 'TTYX')
+ lfs.link(fname_bak .. ('/xxxxx'):rep(20), fname, true)
+ eq('Vim(write):E166: Can\'t open linked file for writing',
+ exc_exec('write!'))
+ end)
end)
diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua
index e1216fa5d4..b6fcae0cf4 100644
--- a/test/functional/ex_cmds/wundo_spec.lua
+++ b/test/functional/ex_cmds/wundo_spec.lua
@@ -1,20 +1,21 @@
-- Specs for :wundo and underlying functions
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,
+local command, clear, eval, spawn, nvim_prog, set_session =
+ helpers.command, helpers.clear, helpers.eval, helpers.spawn,
helpers.nvim_prog, helpers.set_session
describe(':wundo', function()
before_each(clear)
+ after_each(function()
+ os.remove(eval('getcwd()') .. '/foo')
+ end)
it('safely fails on new, non-empty buffer', function()
- feed('iabc<esc>')
- execute('wundo foo') -- This should not segfault. #1027
+ command('normal! iabc')
+ command('wundo foo') -- This should not segfault. #1027
--TODO: check messages for error message
-
- os.remove(eval('getcwd()') .. '/foo') --cleanup
end)
end)
@@ -23,7 +24,7 @@ describe('u_* functions', function()
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
'-c', 'set undodir=. undofile'})
set_session(session)
- execute('echo "True"') -- Should not error out due to crashed Neovim
+ command('echo "True"') -- Should not error out due to crashed Neovim
session:close()
end)
end)
diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua
index 37f45da2d4..eebbd70f2b 100644
--- a/test/functional/ex_cmds/wviminfo_spec.lua
+++ b/test/functional/ex_cmds/wviminfo_spec.lua
@@ -1,8 +1,8 @@
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
+local command, eq, neq, spawn, nvim_prog, set_session, write_file =
+ helpers.command, helpers.eq, helpers.neq, helpers.spawn,
+ helpers.nvim_prog, helpers.set_session, helpers.write_file
describe(':wshada', function()
local shada_file = 'wshada_test'
@@ -24,8 +24,7 @@ describe(':wshada', function()
it('creates a shada file', function()
-- file should _not_ exist
eq(nil, lfs.attributes(shada_file))
- execute('wsh! '..shada_file)
- wait()
+ command('wsh! '..shada_file)
-- file _should_ exist
neq(nil, lfs.attributes(shada_file))
end)
@@ -40,8 +39,7 @@ describe(':wshada', function()
eq(text, io.open(shada_file):read())
neq(nil, lfs.attributes(shada_file))
- execute('wsh! '..shada_file)
- wait()
+ command('wsh! '..shada_file)
-- File should have been overwritten with a shada file.
local fp = io.open(shada_file, 'r')
diff --git a/test/functional/fixtures/printargs-test.c b/test/functional/fixtures/printargs-test.c
index 2c25cf8447..be54605817 100644
--- a/test/functional/fixtures/printargs-test.c
+++ b/test/functional/fixtures/printargs-test.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdio.h>
int main(int argc, char **argv)
diff --git a/test/functional/fixtures/shell-test.c b/test/functional/fixtures/shell-test.c
index 3f3976ece5..8dbec2aaee 100644
--- a/test/functional/fixtures/shell-test.c
+++ b/test/functional/fixtures/shell-test.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdio.h>
#include <string.h>
#include <stdint.h>
diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c
index 778e7f3cd3..3406b3a202 100644
--- a/test/functional/fixtures/tty-test.c
+++ b/test/functional/fixtures/tty-test.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index ab36508262..0f30910450 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -8,6 +8,7 @@ local Session = require('nvim.session')
local TcpStream = require('nvim.tcp_stream')
local SocketStream = require('nvim.socket_stream')
local ChildProcessStream = require('nvim.child_process_stream')
+local Paths = require('test.config.paths')
local check_cores = global_helpers.check_cores
local check_logs = global_helpers.check_logs
@@ -16,30 +17,30 @@ local eq = global_helpers.eq
local ok = global_helpers.ok
local map = global_helpers.map
local filter = global_helpers.filter
+local dedent = global_helpers.dedent
local start_dir = lfs.currentdir()
-- XXX: NVIM_PROG takes precedence, QuickBuild sets it.
-local nvim_prog = os.getenv('NVIM_PROG') or os.getenv('NVIM_PRG') or 'build/bin/nvim'
+local nvim_prog = (
+ os.getenv('NVIM_PROG')
+ or os.getenv('NVIM_PRG')
+ or Paths.test_build_dir .. '/bin/nvim'
+)
-- Default settings for the test session.
local nvim_set = 'set shortmess+=I background=light noswapfile noautoindent'
..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.'
..' belloff= noshowcmd noruler nomore'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', nvim_set, '--embed'}
-
-local mpack = require('mpack')
-
-local tmpname = global_helpers.tmpname
-local uname = global_helpers.uname
-
--- Formulate a path to the directory containing nvim. We use this to
--- help run test executables. It helps to keep the tests working, even
--- when the build is not in the default location.
+-- Directory containing nvim.
local nvim_dir = nvim_prog:gsub("[/\\][^/\\]+$", "")
if nvim_dir == nvim_prog then
nvim_dir = "."
end
+local mpack = require('mpack')
+local tmpname = global_helpers.tmpname
+local uname = global_helpers.uname
local prepend_argv
if os.getenv('VALGRIND') then
@@ -191,28 +192,6 @@ local function nvim_feed(input)
end
end
-local function dedent(str)
- -- find minimum common indent across lines
- local indent = nil
- for line in str:gmatch('[^\n]+') do
- local line_indent = line:match('^%s+') or ''
- if indent == nil or #line_indent < #indent then
- indent = line_indent
- end
- end
- if indent == nil or #indent == 0 then
- -- no minimum common indent
- return str
- end
- -- create a pattern for the indent
- indent = indent:gsub('%s', '[ \t]')
- -- strip it from the first line
- str = str:gsub('^'..indent, '')
- -- strip it from the remaining lines
- str = str:gsub('[\n]'..indent, '\n')
- return str
-end
-
local function feed(...)
for _, v in ipairs({...}) do
nvim_feed(dedent(v))
@@ -267,12 +246,13 @@ local function retry(max, max_ms, fn)
return result
end
if (max and tries >= max) or (luv.now() - start_time > timeout) then
- break
+ if type(result) == "string" then
+ result = "\nretry() attempts: "..tostring(tries).."\n"..result
+ end
+ error(result)
end
tries = tries + 1
end
- -- Do not use pcall() for the final attempt, let the failure bubble up.
- return fn()
end
local function clear(...)
@@ -325,7 +305,7 @@ end
-- Executes an ex-command by user input. Because nvim_input() is used, VimL
-- errors will not manifest as client (lua) errors. Use command() for that.
-local function execute(...)
+local function feed_command(...)
for _, v in ipairs({...}) do
if v:sub(1, 1) ~= '/' then
-- not a search command, prefix with colon
@@ -368,7 +348,7 @@ end
local function set_shell_powershell()
source([[
set shell=powershell shellquote=\" shellpipe=\| shellredir=>
- set shellcmdflag=\ -ExecutionPolicy\ RemoteSigned\ -Command
+ set shellcmdflag=\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
let &shellxquote=' '
]])
end
@@ -412,7 +392,14 @@ end
-- sleeps the test runner (_not_ the nvim instance)
local function sleep(ms)
- run(nil, nil, nil, ms)
+ local function notification_cb(method, _)
+ if method == "redraw" then
+ error("Screen is attached; use screen:sleep() instead.")
+ end
+ return true
+ end
+
+ run(nil, notification_cb, nil, ms)
end
local function curbuf_contents()
@@ -445,21 +432,27 @@ end
local function do_rmdir(path)
if lfs.attributes(path, 'mode') ~= 'directory' then
- return nil
+ return -- Don't complain.
end
for file in lfs.dir(path) do
if file ~= '.' and file ~= '..' then
local abspath = path..'/'..file
if lfs.attributes(abspath, 'mode') == 'directory' then
- local ret = do_rmdir(abspath) -- recurse
- if not ret then
- return nil
- end
+ do_rmdir(abspath) -- recurse
else
local ret, err = os.remove(abspath)
if not ret then
- error('os.remove: '..err)
- return nil
+ if not session then
+ error('os.remove: '..err)
+ else
+ -- Try Nvim delete(): it handles `readonly` attribute on Windows,
+ -- and avoids Lua cross-version/platform incompatibilities.
+ if -1 == nvim_call('delete', abspath) then
+ local hint = (os_name() == 'windows'
+ and ' (hint: try :%bwipeout! before rmdir())' or '')
+ error('delete() failed'..hint..': '..abspath)
+ end
+ end
end
end
end
@@ -468,7 +461,6 @@ local function do_rmdir(path)
if not ret then
error('lfs.rmdir('..path..'): '..err)
end
- return ret
end
local function rmdir(path)
@@ -586,7 +578,7 @@ local M = {
insert = insert,
iswin = iswin,
feed = feed,
- execute = execute,
+ feed_command = feed_command,
eval = nvim_eval,
call = nvim_call,
command = nvim_command,
diff --git a/test/functional/insert/ctrl_r_spec.lua b/test/functional/insert/ctrl_r_spec.lua
new file mode 100644
index 0000000000..adc3c4b406
--- /dev/null
+++ b/test/functional/insert/ctrl_r_spec.lua
@@ -0,0 +1,19 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, feed = helpers.clear, helpers.feed
+local expect, command = helpers.expect, helpers.command
+
+describe('insert-mode Ctrl-R', function()
+ before_each(clear)
+
+ it('works', function()
+ command("let @@ = 'test'")
+ feed('i<C-r>"')
+ expect('test')
+ end)
+
+ it('works with multi-byte text', function()
+ command("let @@ = 'påskägg'")
+ feed('i<C-r>"')
+ expect('påskägg')
+ end)
+end)
diff --git a/test/functional/legacy/002_filename_recognition_spec.lua b/test/functional/legacy/002_filename_recognition_spec.lua
index 5a833281e7..26a62d92fe 100644
--- a/test/functional/legacy/002_filename_recognition_spec.lua
+++ b/test/functional/legacy/002_filename_recognition_spec.lua
@@ -3,7 +3,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('filename recognition', function()
setup(clear)
@@ -17,17 +17,17 @@ describe('filename recognition', function()
fourth test for URL:\\machine.name\tmp\vimtest2d, and other text]])
-- Go to the first URL and append it to the beginning
- execute('/^first', '/tmp', 'call append(0, expand("<cfile>"))')
+ feed_command('/^first', '/tmp', 'call append(0, expand("<cfile>"))')
-- Repeat for the second URL
-- this time, navigate to the word "URL" instead of "tmp"
- execute('/^second', '/URL', 'call append(1, expand("<cfile>"))')
+ feed_command('/^second', '/URL', 'call append(1, expand("<cfile>"))')
-- Repeat for the remaining URLs. This time, the 'isfname' option must be
-- set to allow '\' in filenames
- execute('set isf=@,48-57,/,.,-,_,+,,,$,:,~,\\')
- execute('/^third', '/name', 'call append(2, expand("<cfile>"))')
- execute('/^fourth', '/URL', 'call append(3, expand("<cfile>"))')
+ feed_command('set isf=@,48-57,/,.,-,_,+,,,$,:,~,\\')
+ feed_command('/^third', '/name', 'call append(2, expand("<cfile>"))')
+ feed_command('/^fourth', '/URL', 'call append(3, expand("<cfile>"))')
-- Delete the initial text, which now starts at line 5
feed('5GdG')
diff --git a/test/functional/legacy/003_cindent_spec.lua b/test/functional/legacy/003_cindent_spec.lua
index 83388bd1eb..27835fea28 100644
--- a/test/functional/legacy/003_cindent_spec.lua
+++ b/test/functional/legacy/003_cindent_spec.lua
@@ -5,14 +5,14 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
-- Inserts text as usual, and additionally positions the cursor on line 1 and
-- sets 'cindent' and tab settings. (In the original "test3.in" the modeline at
-- the top of the file takes care of this.)
local function insert_(content)
insert(content)
- execute('1', 'set cin ts=4 sw=4')
+ feed_command('1', 'set cin ts=4 sw=4')
end
describe('cindent', function()
@@ -20,21 +20,21 @@ describe('cindent', function()
it('1 is working', function()
insert_([=[
-
+
/* start of AUTO matically checked vim: set ts=4 : */
{
if (test)
cmd1;
cmd2;
}
-
+
{
if (test)
cmd1;
else
cmd2;
}
-
+
{
if (test)
{
@@ -42,7 +42,7 @@ describe('cindent', function()
cmd2;
}
}
-
+
{
if (test)
{
@@ -50,14 +50,14 @@ describe('cindent', function()
else
}
}
-
+
{
while (this)
if (test)
cmd1;
cmd2;
}
-
+
{
while (this)
if (test)
@@ -65,25 +65,25 @@ describe('cindent', function()
else
cmd2;
}
-
+
{
if (test)
{
cmd;
}
-
+
if (test)
cmd;
}
-
+
{
if (test) {
cmd;
}
-
+
if (test) cmd;
}
-
+
{
cmd1;
for (blah)
@@ -92,7 +92,7 @@ describe('cindent', function()
cmd2;
cmd3;
}
-
+
{
cmd1;
for (blah)
@@ -100,7 +100,7 @@ describe('cindent', function()
if (test)
cmd2;
cmd3;
-
+
if (test)
{
cmd1;
@@ -108,23 +108,23 @@ describe('cindent', function()
cmd3;
}
}
-
-
+
+
/* Test for 'cindent' do/while mixed with if/else: */
-
+
{
do
if (asdf)
asdfasd;
while (cond);
-
+
do
if (asdf)
while (asdf)
asdf;
while (asdf);
}
-
+
/* Test for 'cindent' with two ) on a continuation line */
{
if (asdfasdf;asldkfj asdlkfj as;ldkfj sal;d
@@ -132,14 +132,14 @@ describe('cindent', function()
al;sdjfka ;slkdf ) sa;ldkjfsa dlk;)
line up here;
}
-
-
+
+
/* C++ tests: */
-
+
// foo() these three lines should remain in column 0
// {
// }
-
+
/* Test for continuation and unterminated lines: */
{
i = 99 + 14325 +
@@ -151,12 +151,12 @@ describe('cindent', function()
1234;
c = 1;
}
-
+
/*
testje for indent with empty line
-
+
here */
-
+
{
if (testing &&
not a joke ||
@@ -171,8 +171,8 @@ describe('cindent', function()
line up here))
hay;
}
-
-
+
+
{
switch (c)
{
@@ -191,7 +191,7 @@ describe('cindent', function()
testing;
}
}
-
+
{
if (cond) {
foo;
@@ -201,7 +201,7 @@ describe('cindent', function()
bar;
}
}
-
+
{
if (alskdfj ;alsdkfjal;skdjf (;sadlkfsa ;dlkf j;alksdfj ;alskdjf
alsdkfj (asldk;fj
@@ -210,7 +210,7 @@ describe('cindent', function()
asdfasdf;)))
asdfasdf;
}
-
+
int
func(a, b)
int a;
@@ -223,7 +223,7 @@ describe('cindent', function()
(c2 || c3)
)
}
-
+
{
while (asd)
{
@@ -245,13 +245,13 @@ describe('cindent', function()
asdf;
}
}
-
+
{
s = "/*"; b = ';'
s = "/*"; b = ';';
a = b;
}
-
+
{
switch (a)
{
@@ -285,7 +285,7 @@ describe('cindent', function()
break;
}
}
-
+
{
if (!(vim_strchr(p_cpo, CPO_BUFOPTGLOB) != NULL && entering) &&
(bp_to->b_p_initialized ||
@@ -297,57 +297,57 @@ describe('cindent', function()
asdf = asdf ?
asdf: asdf;
}
-
+
/* Special Comments : This function has the added complexity (compared */
/* : to addtolist) of having to check for a detail */
/* : texture and add that to the list first. */
-
+
char *(array[100]) = {
"testje",
"foo",
"bar",
}
-
+
enum soppie
{
yes = 0,
no,
maybe
};
-
+
typedef enum soppie
{
yes = 0,
no,
maybe
};
-
+
static enum
{
yes = 0,
no,
maybe
} soppie;
-
+
public static enum
{
yes = 0,
no,
maybe
} soppie;
-
+
static private enum
{
yes = 0,
no,
maybe
} soppie;
-
+
{
int a,
b;
}
-
+
{
struct Type
{
@@ -360,7 +360,7 @@ describe('cindent', function()
2, "two",
3, "three"
};
-
+
float matrix[3][3] =
{
{
@@ -380,14 +380,14 @@ describe('cindent', function()
}
};
}
-
+
{
/* blah ( blah */
/* where does this go? */
-
+
/* blah ( blah */
cmd;
-
+
func(arg1,
/* comment */
arg2);
@@ -398,7 +398,7 @@ describe('cindent', function()
c; /* Hey, NOW it indents?! */
}
}
-
+
{
func(arg1,
arg2,
@@ -406,7 +406,7 @@ describe('cindent', function()
/* Hey, what am I doing here? Is this coz of the ","? */
}
}
-
+
main ()
{
if (cond)
@@ -420,7 +420,7 @@ describe('cindent', function()
a = d;
return;
}
-
+
{
case 2: if (asdf &&
asdfasdf)
@@ -431,42 +431,42 @@ describe('cindent', function()
a = 9;
case 4: x = 1;
y = 2;
-
+
label: if (asdf)
here;
-
+
label: if (asdf &&
asdfasdf)
{
}
-
+
label: if (asdf &&
asdfasdf) {
there;
}
-
+
label: if (asdf &&
asdfasdf)
there;
}
-
+
{
/*
hello with ":set comments= cino=c5"
*/
-
+
/*
hello with ":set comments= cino="
*/
}
-
-
+
+
{
if (a < b) {
a = a + 1;
} else
a = a + 2;
-
+
if (a)
do {
testing;
@@ -474,7 +474,7 @@ describe('cindent', function()
a = b + 1;
asdfasdf
}
-
+
{
for ( int i = 0;
i < 10; i++ )
@@ -482,13 +482,13 @@ describe('cindent', function()
}
i = 0;
}
-
+
class bob
{
int foo() {return 1;}
int bar;
}
-
+
main()
{
while(1)
@@ -501,32 +501,32 @@ describe('cindent', function()
}
misplacedline;
}
-
+
{
if (clipboard.state == SELECT_DONE
&& ((row == clipboard.start.lnum
&& col >= clipboard.start.col)
|| row > clipboard.start.lnum))
}
-
+
{
if (1) {i += 4;}
where_am_i;
return 0;
}
-
+
{
{
} // sdf(asdf
if (asdf)
asd;
}
-
+
{
label1:
label2:
}
-
+
{
int fooRet = foo(pBar1, false /*fKB*/,
true /*fPTB*/, 3 /*nT*/, false /*fDF*/);
@@ -538,12 +538,12 @@ describe('cindent', function()
}
}
}
-
+
{
f1(/*comment*/);
f2();
}
-
+
{
do {
if (foo) {
@@ -552,25 +552,25 @@ describe('cindent', function()
} while (foo);
foo(); // was wrong
}
-
+
int x; // no extra indent because of the ;
void func()
{
}
-
+
char *tab[] = {"aaa",
"};", /* }; */ NULL}
int indented;
{}
-
+
char *a[] = {"aaa", "bbb",
"ccc", NULL};
// here
-
+
char *tab[] = {"aaa",
"xx", /* xx */}; /* asdf */
int not_indented;
-
+
{
do {
switch (bla)
@@ -581,23 +581,23 @@ describe('cindent', function()
} while (boo);
wrong;
}
-
+
int foo,
bar;
int foo;
-
+
#if defined(foo) \
&& defined(bar)
char * xx = "asdf\
foo\
bor";
int x;
-
+
char *foo = "asdf\
asdf\
asdf",
*bar;
-
+
void f()
{
#if defined(foo) \
@@ -616,19 +616,19 @@ describe('cindent', function()
#endif
}
#endif
-
+
int y; // comment
// comment
-
+
// comment
-
+
{
Constructor(int a,
int b ) : BaseClass(a)
{
}
}
-
+
void foo()
{
char one,
@@ -645,13 +645,13 @@ describe('cindent', function()
kees,
jan;
}
-
+
{
t(int f,
int d); // )
d();
}
-
+
Constructor::Constructor(int a,
int b
) :
@@ -661,33 +661,33 @@ describe('cindent', function()
mMember(b),
{
}
-
+
Constructor::Constructor(int a,
int b ) :
BaseClass(a)
{
}
-
+
Constructor::Constructor(int a,
int b ) /*x*/ : /*x*/ BaseClass(a),
member(b)
{
}
-
+
A::A(int a, int b)
: aa(a),
bb(b),
cc(c)
{
}
-
+
class CAbc :
public BaseClass1,
protected BaseClass2
{
int Test() { return FALSE; }
int Test1() { return TRUE; }
-
+
CAbc(int a, int b ) :
BaseClass(a)
{
@@ -696,24 +696,24 @@ describe('cindent', function()
case abc:
asdf();
break;
-
+
case 999:
baer();
break;
}
}
-
+
public: // <-- this was incoreectly indented before!!
void testfall();
protected:
void testfall();
};
-
+
class CAbc : public BaseClass1,
protected BaseClass2
{
};
-
+
static struct
{
int a;
@@ -729,7 +729,7 @@ describe('cindent', function()
456
}
};
-
+
static struct
{
int a;
@@ -739,7 +739,7 @@ describe('cindent', function()
{ 123, 456 },
{ 123, 456 }
};
-
+
void asdf() /* ind_maxparen may cause trouble here */
{
if ((0
@@ -769,17 +769,17 @@ describe('cindent', function()
&& 1
&& 1)) break;
}
-
+
foo()
{
a = cond ? foo() : asdf
+ asdf;
-
+
a = cond ?
foo() : asdf
+ asdf;
}
-
+
int main(void)
{
if (a)
@@ -788,7 +788,7 @@ describe('cindent', function()
else 3;
next_line_of_code();
}
-
+
barry()
{
Foo::Foo (int one,
@@ -796,14 +796,14 @@ describe('cindent', function()
: something(4)
{}
}
-
+
barry()
{
Foo::Foo (int one, int two)
: something(4)
{}
}
-
+
Constructor::Constructor(int a,
int b
) :
@@ -822,7 +822,7 @@ describe('cindent', function()
&& lele);
lulu;
}
-
+
int main ()
{
switch (c)
@@ -832,13 +832,13 @@ describe('cindent', function()
}
}
}
-
+
main()
{
(void) MyFancyFuasdfadsfnction(
argument);
}
-
+
main()
{
char foo[] = "/*";
@@ -846,7 +846,7 @@ describe('cindent', function()
df */
hello
}
-
+
/* valid namespaces with normal indent */
namespace
{
@@ -885,7 +885,7 @@ describe('cindent', function()
22222222222222222;
}
}
-
+
/* invalid namespaces use block indent */
namespace test test2 {
111111111111111111111;
@@ -925,7 +925,7 @@ describe('cindent', function()
}
)foo";
}
-
+
{
int a[4] = {
[0] = 0,
@@ -934,12 +934,12 @@ describe('cindent', function()
[3] = 3,
};
}
-
+
{
a = b[2]
+ 3;
}
-
+
{
if (1)
/* aaaaa
@@ -947,7 +947,7 @@ describe('cindent', function()
*/
a = 1;
}
-
+
void func()
{
switch (foo)
@@ -974,29 +974,29 @@ describe('cindent', function()
break;
}
}
-
+
/* end of AUTO */
]=])
- execute('/start of AUTO')
+ feed_command('/start of AUTO')
feed('=/end of AUTO<cr>')
expect([=[
-
+
/* start of AUTO matically checked vim: set ts=4 : */
{
if (test)
cmd1;
cmd2;
}
-
+
{
if (test)
cmd1;
else
cmd2;
}
-
+
{
if (test)
{
@@ -1004,7 +1004,7 @@ describe('cindent', function()
cmd2;
}
}
-
+
{
if (test)
{
@@ -1012,14 +1012,14 @@ describe('cindent', function()
else
}
}
-
+
{
while (this)
if (test)
cmd1;
cmd2;
}
-
+
{
while (this)
if (test)
@@ -1027,25 +1027,25 @@ describe('cindent', function()
else
cmd2;
}
-
+
{
if (test)
{
cmd;
}
-
+
if (test)
cmd;
}
-
+
{
if (test) {
cmd;
}
-
+
if (test) cmd;
}
-
+
{
cmd1;
for (blah)
@@ -1054,7 +1054,7 @@ describe('cindent', function()
cmd2;
cmd3;
}
-
+
{
cmd1;
for (blah)
@@ -1062,7 +1062,7 @@ describe('cindent', function()
if (test)
cmd2;
cmd3;
-
+
if (test)
{
cmd1;
@@ -1070,23 +1070,23 @@ describe('cindent', function()
cmd3;
}
}
-
-
+
+
/* Test for 'cindent' do/while mixed with if/else: */
-
+
{
do
if (asdf)
asdfasd;
while (cond);
-
+
do
if (asdf)
while (asdf)
asdf;
while (asdf);
}
-
+
/* Test for 'cindent' with two ) on a continuation line */
{
if (asdfasdf;asldkfj asdlkfj as;ldkfj sal;d
@@ -1094,14 +1094,14 @@ describe('cindent', function()
al;sdjfka ;slkdf ) sa;ldkjfsa dlk;)
line up here;
}
-
-
+
+
/* C++ tests: */
-
+
// foo() these three lines should remain in column 0
// {
// }
-
+
/* Test for continuation and unterminated lines: */
{
i = 99 + 14325 +
@@ -1113,12 +1113,12 @@ describe('cindent', function()
1234;
c = 1;
}
-
+
/*
testje for indent with empty line
-
+
here */
-
+
{
if (testing &&
not a joke ||
@@ -1133,8 +1133,8 @@ describe('cindent', function()
line up here))
hay;
}
-
-
+
+
{
switch (c)
{
@@ -1153,7 +1153,7 @@ describe('cindent', function()
testing;
}
}
-
+
{
if (cond) {
foo;
@@ -1163,7 +1163,7 @@ describe('cindent', function()
bar;
}
}
-
+
{
if (alskdfj ;alsdkfjal;skdjf (;sadlkfsa ;dlkf j;alksdfj ;alskdjf
alsdkfj (asldk;fj
@@ -1172,7 +1172,7 @@ describe('cindent', function()
asdfasdf;)))
asdfasdf;
}
-
+
int
func(a, b)
int a;
@@ -1185,7 +1185,7 @@ describe('cindent', function()
(c2 || c3)
)
}
-
+
{
while (asd)
{
@@ -1207,13 +1207,13 @@ describe('cindent', function()
asdf;
}
}
-
+
{
s = "/*"; b = ';'
s = "/*"; b = ';';
a = b;
}
-
+
{
switch (a)
{
@@ -1247,7 +1247,7 @@ describe('cindent', function()
break;
}
}
-
+
{
if (!(vim_strchr(p_cpo, CPO_BUFOPTGLOB) != NULL && entering) &&
(bp_to->b_p_initialized ||
@@ -1259,57 +1259,57 @@ describe('cindent', function()
asdf = asdf ?
asdf: asdf;
}
-
+
/* Special Comments : This function has the added complexity (compared */
/* : to addtolist) of having to check for a detail */
/* : texture and add that to the list first. */
-
+
char *(array[100]) = {
"testje",
"foo",
"bar",
}
-
+
enum soppie
{
yes = 0,
no,
maybe
};
-
+
typedef enum soppie
{
yes = 0,
no,
maybe
};
-
+
static enum
{
yes = 0,
no,
maybe
} soppie;
-
+
public static enum
{
yes = 0,
no,
maybe
} soppie;
-
+
static private enum
{
yes = 0,
no,
maybe
} soppie;
-
+
{
int a,
b;
}
-
+
{
struct Type
{
@@ -1322,7 +1322,7 @@ describe('cindent', function()
2, "two",
3, "three"
};
-
+
float matrix[3][3] =
{
{
@@ -1342,14 +1342,14 @@ describe('cindent', function()
}
};
}
-
+
{
/* blah ( blah */
/* where does this go? */
-
+
/* blah ( blah */
cmd;
-
+
func(arg1,
/* comment */
arg2);
@@ -1360,7 +1360,7 @@ describe('cindent', function()
c; /* Hey, NOW it indents?! */
}
}
-
+
{
func(arg1,
arg2,
@@ -1368,7 +1368,7 @@ describe('cindent', function()
/* Hey, what am I doing here? Is this coz of the ","? */
}
}
-
+
main ()
{
if (cond)
@@ -1382,7 +1382,7 @@ describe('cindent', function()
a = d;
return;
}
-
+
{
case 2: if (asdf &&
asdfasdf)
@@ -1393,42 +1393,42 @@ describe('cindent', function()
a = 9;
case 4: x = 1;
y = 2;
-
+
label: if (asdf)
here;
-
+
label: if (asdf &&
asdfasdf)
{
}
-
+
label: if (asdf &&
asdfasdf) {
there;
}
-
+
label: if (asdf &&
asdfasdf)
there;
}
-
+
{
/*
hello with ":set comments= cino=c5"
*/
-
+
/*
hello with ":set comments= cino="
*/
}
-
-
+
+
{
if (a < b) {
a = a + 1;
} else
a = a + 2;
-
+
if (a)
do {
testing;
@@ -1436,7 +1436,7 @@ describe('cindent', function()
a = b + 1;
asdfasdf
}
-
+
{
for ( int i = 0;
i < 10; i++ )
@@ -1444,13 +1444,13 @@ describe('cindent', function()
}
i = 0;
}
-
+
class bob
{
int foo() {return 1;}
int bar;
}
-
+
main()
{
while(1)
@@ -1463,32 +1463,32 @@ describe('cindent', function()
}
misplacedline;
}
-
+
{
if (clipboard.state == SELECT_DONE
&& ((row == clipboard.start.lnum
&& col >= clipboard.start.col)
|| row > clipboard.start.lnum))
}
-
+
{
if (1) {i += 4;}
where_am_i;
return 0;
}
-
+
{
{
} // sdf(asdf
if (asdf)
asd;
}
-
+
{
label1:
label2:
}
-
+
{
int fooRet = foo(pBar1, false /*fKB*/,
true /*fPTB*/, 3 /*nT*/, false /*fDF*/);
@@ -1500,12 +1500,12 @@ describe('cindent', function()
}
}
}
-
+
{
f1(/*comment*/);
f2();
}
-
+
{
do {
if (foo) {
@@ -1514,25 +1514,25 @@ describe('cindent', function()
} while (foo);
foo(); // was wrong
}
-
+
int x; // no extra indent because of the ;
void func()
{
}
-
+
char *tab[] = {"aaa",
"};", /* }; */ NULL}
int indented;
{}
-
+
char *a[] = {"aaa", "bbb",
"ccc", NULL};
// here
-
+
char *tab[] = {"aaa",
"xx", /* xx */}; /* asdf */
int not_indented;
-
+
{
do {
switch (bla)
@@ -1543,23 +1543,23 @@ describe('cindent', function()
} while (boo);
wrong;
}
-
+
int foo,
bar;
int foo;
-
+
#if defined(foo) \
&& defined(bar)
char * xx = "asdf\
foo\
bor";
int x;
-
+
char *foo = "asdf\
asdf\
asdf",
*bar;
-
+
void f()
{
#if defined(foo) \
@@ -1578,19 +1578,19 @@ describe('cindent', function()
#endif
}
#endif
-
+
int y; // comment
// comment
-
+
// comment
-
+
{
Constructor(int a,
int b ) : BaseClass(a)
{
}
}
-
+
void foo()
{
char one,
@@ -1607,13 +1607,13 @@ describe('cindent', function()
kees,
jan;
}
-
+
{
t(int f,
int d); // )
d();
}
-
+
Constructor::Constructor(int a,
int b
) :
@@ -1623,33 +1623,33 @@ describe('cindent', function()
mMember(b),
{
}
-
+
Constructor::Constructor(int a,
int b ) :
BaseClass(a)
{
}
-
+
Constructor::Constructor(int a,
int b ) /*x*/ : /*x*/ BaseClass(a),
member(b)
{
}
-
+
A::A(int a, int b)
: aa(a),
bb(b),
cc(c)
{
}
-
+
class CAbc :
public BaseClass1,
protected BaseClass2
{
int Test() { return FALSE; }
int Test1() { return TRUE; }
-
+
CAbc(int a, int b ) :
BaseClass(a)
{
@@ -1658,24 +1658,24 @@ describe('cindent', function()
case abc:
asdf();
break;
-
+
case 999:
baer();
break;
}
}
-
+
public: // <-- this was incoreectly indented before!!
void testfall();
protected:
void testfall();
};
-
+
class CAbc : public BaseClass1,
protected BaseClass2
{
};
-
+
static struct
{
int a;
@@ -1691,7 +1691,7 @@ describe('cindent', function()
456
}
};
-
+
static struct
{
int a;
@@ -1701,7 +1701,7 @@ describe('cindent', function()
{ 123, 456 },
{ 123, 456 }
};
-
+
void asdf() /* ind_maxparen may cause trouble here */
{
if ((0
@@ -1731,17 +1731,17 @@ describe('cindent', function()
&& 1
&& 1)) break;
}
-
+
foo()
{
a = cond ? foo() : asdf
+ asdf;
-
+
a = cond ?
foo() : asdf
+ asdf;
}
-
+
int main(void)
{
if (a)
@@ -1750,7 +1750,7 @@ describe('cindent', function()
else 3;
next_line_of_code();
}
-
+
barry()
{
Foo::Foo (int one,
@@ -1758,14 +1758,14 @@ describe('cindent', function()
: something(4)
{}
}
-
+
barry()
{
Foo::Foo (int one, int two)
: something(4)
{}
}
-
+
Constructor::Constructor(int a,
int b
) :
@@ -1784,7 +1784,7 @@ describe('cindent', function()
&& lele);
lulu;
}
-
+
int main ()
{
switch (c)
@@ -1794,13 +1794,13 @@ describe('cindent', function()
}
}
}
-
+
main()
{
(void) MyFancyFuasdfadsfnction(
argument);
}
-
+
main()
{
char foo[] = "/*";
@@ -1808,7 +1808,7 @@ describe('cindent', function()
df */
hello
}
-
+
/* valid namespaces with normal indent */
namespace
{
@@ -1847,7 +1847,7 @@ describe('cindent', function()
22222222222222222;
}
}
-
+
/* invalid namespaces use block indent */
namespace test test2 {
111111111111111111111;
@@ -1887,7 +1887,7 @@ describe('cindent', function()
}
)foo";
}
-
+
{
int a[4] = {
[0] = 0,
@@ -1896,12 +1896,12 @@ describe('cindent', function()
[3] = 3,
};
}
-
+
{
a = b[2]
+ 3;
}
-
+
{
if (1)
/* aaaaa
@@ -1909,7 +1909,7 @@ describe('cindent', function()
*/
a = 1;
}
-
+
void func()
{
switch (foo)
@@ -1936,16 +1936,16 @@ describe('cindent', function()
break;
}
}
-
+
/* end of AUTO */
]=])
end)
it('2 is working', function()
insert_([=[
-
+
{
-
+
/* this is
* a real serious important big
* comment
@@ -1954,14 +1954,14 @@ describe('cindent', function()
}
]=])
- execute('set tw=0 wm=60 columns=80 noai fo=croq')
- execute('/serious/e')
+ feed_command('set tw=0 wm=60 columns=80 noai fo=croq')
+ feed_command('/serious/e')
feed('a about life, the universe, and the rest<esc>')
expect([=[
-
+
{
-
+
/* this is
* a real serious
* about life, the
@@ -1976,48 +1976,48 @@ describe('cindent', function()
it('3 is working', function()
insert_([=[
-
+
{
/*
* Testing for comments, without 'cin' set
*/
-
+
/*
* what happens here?
*/
-
+
/*
the end of the comment, try inserting a line below */
-
+
/* how about
this one */
}
]=])
- execute('set nocin')
- execute('/comments')
+ feed_command('set nocin')
+ feed_command('/comments')
feed('joabout life<esc>/happens<cr>')
feed('jothere<esc>/below<cr>')
feed('oline<esc>/this<cr>')
feed('Ohello<esc>')
expect([=[
-
+
{
/*
* Testing for comments, without 'cin' set
*/
about life
-
+
/*
* what happens here?
*/
there
-
+
/*
the end of the comment, try inserting a line below */
line
-
+
/* how about
hello
this one */
@@ -2027,19 +2027,19 @@ describe('cindent', function()
it('4 is working', function()
insert_([=[
-
+
{
var = this + that + vec[0] * vec[0]
+ vec[1] * vec[1]
+ vec2[2] * vec[2];
}
]=])
- execute('set cin')
- execute('/vec2')
+ feed_command('set cin')
+ feed_command('/vec2')
feed('==<cr>')
expect([=[
-
+
{
var = this + that + vec[0] * vec[0]
+ vec[1] * vec[1]
@@ -2050,7 +2050,7 @@ describe('cindent', function()
it('5 is working', function()
insert_([=[
-
+
{
asdf asdflkajds f;
if (tes & ting) {
@@ -2067,14 +2067,14 @@ describe('cindent', function()
}
]=])
- execute('set cin')
- execute('set cino=}4')
- execute('/testing1')
+ feed_command('set cin')
+ feed_command('set cino=}4')
+ feed_command('/testing1')
feed('k2==/testing2<cr>')
feed('k2==<cr>')
expect([=[
-
+
{
asdf asdflkajds f;
if (tes & ting) {
@@ -2094,7 +2094,7 @@ describe('cindent', function()
it('6 is working', function()
insert_([=[
-
+
main ( int first_par, /*
* Comment for
* first par
@@ -2114,17 +2114,17 @@ describe('cindent', function()
* second par
*/
);
-
+
}
]=])
- execute('set cin')
- execute('set cino=(0,)20')
- execute('/main')
+ feed_command('set cin')
+ feed_command('set cino=(0,)20')
+ feed_command('/main')
feed('=][<cr>')
expect([=[
-
+
main ( int first_par, /*
* Comment for
* first par
@@ -2144,14 +2144,14 @@ describe('cindent', function()
* second par
*/
);
-
+
}
]=])
end)
it('7 is working', function()
insert_([=[
-
+
main(void)
{
/* Make sure that cino=X0s is not parsed like cino=Xs. */
@@ -2164,13 +2164,13 @@ describe('cindent', function()
}
]=])
- execute('set cin')
- execute('set cino=es,n0s')
- execute('/main')
+ feed_command('set cin')
+ feed_command('set cino=es,n0s')
+ feed_command('/main')
feed('=][<cr>')
expect([=[
-
+
main(void)
{
/* Make sure that cino=X0s is not parsed like cino=Xs. */
@@ -2186,7 +2186,7 @@ describe('cindent', function()
it('8 is working', function()
insert_([=[
-
+
{
do
{
@@ -2202,12 +2202,12 @@ describe('cindent', function()
}
]=])
- execute('set cin')
- execute('set cino=')
+ feed_command('set cin')
+ feed_command('set cino=')
feed(']]=][<cr>')
expect([=[
-
+
{
do
{
@@ -2226,16 +2226,16 @@ describe('cindent', function()
it('9 is working', function()
insert_([=[
-
+
void f()
{
if ( k() ) {
l();
-
+
} else { /* Start (two words) end */
m();
}
-
+
n();
}
]=])
@@ -2243,16 +2243,16 @@ describe('cindent', function()
feed(']]=][<cr>')
expect([=[
-
+
void f()
{
if ( k() ) {
l();
-
+
} else { /* Start (two words) end */
m();
}
-
+
n();
}
]=])
@@ -2267,7 +2267,7 @@ describe('cindent', function()
-- indented properly. And that's why we've had to add one explicitly.
insert_([=[
{ <= THIS IS THE CURLY BRACKET EXPLAINED IN THE COMMENT.
-
+
void f()
{
if ( k() )
@@ -2280,12 +2280,12 @@ describe('cindent', function()
}
]=])
- execute('set cino={s,e-s')
+ feed_command('set cino={s,e-s')
feed(']]=][<cr>')
expect([=[
{ <= THIS IS THE CURLY BRACKET EXPLAINED IN THE COMMENT.
-
+
void f()
{
if ( k() )
@@ -2301,7 +2301,7 @@ describe('cindent', function()
it('11 is working', function()
insert_([=[
-
+
void bar(void)
{
static array[2][2] =
@@ -2309,12 +2309,12 @@ describe('cindent', function()
{ 1, 2 },
{ 3, 4 },
}
-
+
while (a)
{
foo(&a);
}
-
+
{
int a;
{
@@ -2323,7 +2323,7 @@ describe('cindent', function()
}
b = a;
}
-
+
void func(void)
{
a = 1;
@@ -2336,11 +2336,11 @@ describe('cindent', function()
/* foo */
]=])
- execute('set cino={s,fs')
+ feed_command('set cino={s,fs')
feed(']]=/ foo<cr>')
expect([=[
-
+
void bar(void)
{
static array[2][2] =
@@ -2348,12 +2348,12 @@ describe('cindent', function()
{ 1, 2 },
{ 3, 4 },
}
-
+
while (a)
{
foo(&a);
}
-
+
{
int a;
{
@@ -2362,7 +2362,7 @@ describe('cindent', function()
}
b = a;
}
-
+
void func(void)
{
a = 1;
@@ -2378,7 +2378,7 @@ describe('cindent', function()
it('12 is working', function()
insert_([=[
-
+
a()
{
do {
@@ -2390,12 +2390,12 @@ describe('cindent', function()
}
]=])
- execute('set cino=')
- execute('/while')
+ feed_command('set cino=')
+ feed_command('/while')
feed('ohere<esc>')
expect([=[
-
+
a()
{
do {
@@ -2411,7 +2411,7 @@ describe('cindent', function()
it('13 is working', function()
insert_([=[
-
+
a()
{
label1:
@@ -2420,12 +2420,12 @@ describe('cindent', function()
}
]=])
- execute('set cino= com=')
- execute('/comment')
+ feed_command('set cino= com=')
+ feed_command('/comment')
feed('olabel2: b();<cr>label3 /* post */:<cr>/* pre */ label4:<cr>f(/*com*/);<cr>if (/*com*/)<cr>cmd();<esc>')
expect([=[
-
+
a()
{
label1:
@@ -2443,26 +2443,26 @@ describe('cindent', function()
it('14 is working', function()
insert_([=[
-
+
/*
* A simple comment
*/
-
+
/*
** A different comment
*/
]=])
- execute('set comments& comments^=s:/*,m:**,ex:*/')
- execute('/simple')
+ feed_command('set comments& comments^=s:/*,m:**,ex:*/')
+ feed_command('/simple')
feed('=5j<cr>')
expect([=[
-
+
/*
* A simple comment
*/
-
+
/*
** A different comment
*/
@@ -2471,26 +2471,26 @@ describe('cindent', function()
it('15 is working', function()
insert_([=[
-
-
+
+
void f()
{
-
+
/*********
A comment.
*********/
}
]=])
- execute('set cino=c0')
- execute('set comments& comments-=s1:/* comments^=s0:/*')
+ feed_command('set cino=c0')
+ feed_command('set comments& comments-=s1:/* comments^=s0:/*')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
-
+
/*********
A comment.
*********/
@@ -2500,26 +2500,26 @@ describe('cindent', function()
it('16 is working', function()
insert_([=[
-
-
+
+
void f()
{
-
+
/*********
A comment.
*********/
}
]=])
- execute('set cino=c0,C1')
- execute('set comments& comments-=s1:/* comments^=s0:/*')
+ feed_command('set cino=c0,C1')
+ feed_command('set comments& comments-=s1:/* comments^=s0:/*')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
-
+
/*********
A comment.
*********/
@@ -2529,7 +2529,7 @@ describe('cindent', function()
it('17 is working', function()
insert_([=[
-
+
void f()
{
c = c1 &&
@@ -2540,11 +2540,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=')
+ feed_command('set cino=')
feed(']]=][<cr>')
expect([=[
-
+
void f()
{
c = c1 &&
@@ -2558,8 +2558,8 @@ describe('cindent', function()
it('18 is working', function()
insert_([=[
-
-
+
+
void f()
{
c = c1 &&
@@ -2570,11 +2570,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(s')
+ feed_command('set cino=(s')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
c = c1 &&
@@ -2588,8 +2588,8 @@ describe('cindent', function()
it('19 is working', function()
insert_([=[
-
-
+
+
void f()
{
c = c1 &&
@@ -2600,11 +2600,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(s,U1 ')
+ feed_command('set cino=(s,U1 ')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
c = c1 &&
@@ -2618,8 +2618,8 @@ describe('cindent', function()
it('20 is working', function()
insert_([=[
-
-
+
+
void f()
{
if ( c1
@@ -2629,11 +2629,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0')
+ feed_command('set cino=(0')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
if ( c1
@@ -2646,8 +2646,8 @@ describe('cindent', function()
it('21 is working', function()
insert_([=[
-
-
+
+
void f()
{
if ( c1
@@ -2657,11 +2657,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0,w1 ')
+ feed_command('set cino=(0,w1 ')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
if ( c1
@@ -2674,8 +2674,8 @@ describe('cindent', function()
it('22 is working', function()
insert_([=[
-
-
+
+
void f()
{
c = c1 && (
@@ -2689,11 +2689,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(s')
+ feed_command('set cino=(s')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
c = c1 && (
@@ -2710,8 +2710,8 @@ describe('cindent', function()
it('23 is working', function()
insert_([=[
-
-
+
+
void f()
{
c = c1 && (
@@ -2725,11 +2725,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(s,m1 ')
+ feed_command('set cino=(s,m1 ')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
c = c1 && (
@@ -2746,8 +2746,8 @@ describe('cindent', function()
it('24 is working', function()
insert_([=[
-
-
+
+
void f()
{
switch (x)
@@ -2762,11 +2762,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=b1')
+ feed_command('set cino=b1')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
switch (x)
@@ -2784,8 +2784,8 @@ describe('cindent', function()
it('25 is working', function()
insert_([=[
-
-
+
+
void f()
{
invokeme(
@@ -2801,11 +2801,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0,W5')
+ feed_command('set cino=(0,W5')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
invokeme(
@@ -2824,8 +2824,8 @@ describe('cindent', function()
it('26 is working', function()
insert_([=[
-
-
+
+
void f()
{
statement;
@@ -2834,11 +2834,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=/6')
+ feed_command('set cino=/6')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void f()
{
statement;
@@ -2850,8 +2850,8 @@ describe('cindent', function()
it('27 is working', function()
insert_([=[
-
-
+
+
void f()
{
statement;
@@ -2860,12 +2860,12 @@ describe('cindent', function()
}
]=])
- execute('set cino=')
+ feed_command('set cino=')
feed('2kdd]]/comment 1/+1<cr>')
feed('==<cr>')
expect([=[
-
+
void f()
{
statement;
@@ -2877,12 +2877,12 @@ describe('cindent', function()
it('28 is working', function()
insert_([=[
-
-
+
+
class CAbc
{
int Test() { return FALSE; }
-
+
public: // comment
void testfall();
protected:
@@ -2890,15 +2890,15 @@ describe('cindent', function()
};
]=])
- execute('set cino=g0')
+ feed_command('set cino=g0')
feed('2kdd]]=][<cr>')
expect([=[
-
+
class CAbc
{
int Test() { return FALSE; }
-
+
public: // comment
void testfall();
protected:
@@ -2909,8 +2909,8 @@ describe('cindent', function()
it('29 is working', function()
insert_([=[
-
-
+
+
class Foo : public Bar
{
public:
@@ -2921,11 +2921,11 @@ describe('cindent', function()
};
]=])
- execute('set cino=(0,gs,hs')
+ feed_command('set cino=(0,gs,hs')
feed('2kdd]]=][<cr>')
expect([=[
-
+
class Foo : public Bar
{
public:
@@ -2939,8 +2939,8 @@ describe('cindent', function()
it('30 is working', function()
insert_([=[
-
-
+
+
void
foo()
{
@@ -2951,11 +2951,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=+20')
+ feed_command('set cino=+20')
feed('2kdd]]=][<cr>')
expect([=[
-
+
void
foo()
{
@@ -2969,8 +2969,8 @@ describe('cindent', function()
it('31 is working', function()
insert_([=[
-
-
+
+
{
averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
asdasdf,
@@ -2978,9 +2978,9 @@ describe('cindent', function()
asdfadsf),
asdfasdf
);
-
+
/* those are ugly, but consequent */
-
+
func()->asd(asdasdf,
averylongfunctionname(
abc,
@@ -2994,7 +2994,7 @@ describe('cindent', function()
),
asdasdf
);
-
+
averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
abc,
dec)->asdfasdfasdf(
@@ -3009,11 +3009,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0,W2s')
+ feed_command('set cino=(0,W2s')
feed('2kdd]]=][<cr>')
expect([=[
-
+
{
averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd(
asdasdf,
@@ -3021,9 +3021,9 @@ describe('cindent', function()
asdfadsf),
asdfasdf
);
-
+
/* those are ugly, but consequent */
-
+
func()->asd(asdasdf,
averylongfunctionname(
abc,
@@ -3037,7 +3037,7 @@ describe('cindent', function()
),
asdasdf
);
-
+
averylongfunctionnameaverylongfunctionnameavery()->asd(fasdf(
abc,
dec)->asdfasdfasdf(
@@ -3055,8 +3055,8 @@ describe('cindent', function()
it('32 is working', function()
insert_([=[
-
-
+
+
int main ()
{
if (cond1 &&
@@ -3066,11 +3066,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=M1')
+ feed_command('set cino=M1')
feed('2kdd]]=][<cr>')
expect([=[
-
+
int main ()
{
if (cond1 &&
@@ -3083,8 +3083,8 @@ describe('cindent', function()
it('33 is working', function()
insert_([=[
-
-
+
+
void func(int a
#if defined(FOO)
, int b
@@ -3095,11 +3095,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0,ts')
+ feed_command('set cino=(0,ts')
feed('2kdd2j=][<cr>')
expect([=[
-
+
void func(int a
#if defined(FOO)
, int b
@@ -3113,9 +3113,9 @@ describe('cindent', function()
it('34 is working', function()
insert_([=[
-
-
-
+
+
+
void
func(int a
#if defined(FOO)
@@ -3127,12 +3127,12 @@ describe('cindent', function()
}
]=])
- execute('set cino=(0')
+ feed_command('set cino=(0')
feed('2kdd2j=][<cr>')
expect([=[
-
-
+
+
void
func(int a
#if defined(FOO)
@@ -3147,8 +3147,8 @@ describe('cindent', function()
it('35 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if(x==y)
@@ -3159,7 +3159,7 @@ describe('cindent', function()
}
printf("Foo!\n");
}
-
+
void func1(void)
{
char* tab[] = {"foo", "bar",
@@ -3167,37 +3167,37 @@ describe('cindent', function()
"this line used", "to be indented incorrectly"};
foo();
}
-
+
void func2(void)
{
int tab[] =
{1, 2,
3, 4,
5, 6};
-
+
printf("This line used to be indented incorrectly.\n");
}
-
+
int foo[]
#ifdef BAR
-
+
= { 1, 2, 3,
4, 5, 6 }
-
+
#endif
;
int baz;
-
+
void func3(void)
{
int tab[] = {
1, 2,
3, 4,
5, 6};
-
+
printf("Don't you dare indent this line incorrectly!\n");
}
-
+
void
func4(a, b,
c)
@@ -3206,14 +3206,14 @@ describe('cindent', function()
int c;
{
}
-
+
void
func5(
int a,
int b)
{
}
-
+
void
func6(
int a)
@@ -3221,11 +3221,11 @@ describe('cindent', function()
}
]=])
- execute('set cino&')
+ feed_command('set cino&')
feed('2kdd2j=7][<cr>')
expect([=[
-
+
void func(void)
{
if(x==y)
@@ -3236,7 +3236,7 @@ describe('cindent', function()
}
printf("Foo!\n");
}
-
+
void func1(void)
{
char* tab[] = {"foo", "bar",
@@ -3244,37 +3244,37 @@ describe('cindent', function()
"this line used", "to be indented incorrectly"};
foo();
}
-
+
void func2(void)
{
int tab[] =
{1, 2,
3, 4,
5, 6};
-
+
printf("This line used to be indented incorrectly.\n");
}
-
+
int foo[]
#ifdef BAR
-
+
= { 1, 2, 3,
4, 5, 6 }
-
+
#endif
;
int baz;
-
+
void func3(void)
{
int tab[] = {
1, 2,
3, 4,
5, 6};
-
+
printf("Don't you dare indent this line incorrectly!\n");
}
-
+
void
func4(a, b,
c)
@@ -3283,14 +3283,14 @@ describe('cindent', function()
int c;
{
}
-
+
void
func5(
int a,
int b)
{
}
-
+
void
func6(
int a)
@@ -3301,17 +3301,17 @@ describe('cindent', function()
it('36 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
int tab[] =
{
1, 2, 3,
4, 5, 6};
-
+
printf("Indent this line correctly!\n");
-
+
switch (foo)
{
case bar:
@@ -3328,21 +3328,21 @@ describe('cindent', function()
}
]=])
- execute('set cino&')
- execute('set cino+=l1')
+ feed_command('set cino&')
+ feed_command('set cino+=l1')
feed('2kdd2j=][<cr>')
expect([=[
-
+
void func(void)
{
int tab[] =
{
1, 2, 3,
4, 5, 6};
-
+
printf("Indent this line correctly!\n");
-
+
switch (foo)
{
case bar:
@@ -3362,8 +3362,8 @@ describe('cindent', function()
it('37 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
cout << "a"
@@ -3373,11 +3373,11 @@ describe('cindent', function()
}
]=])
- execute('set cino&')
+ feed_command('set cino&')
feed('2kdd2j=][<cr>')
expect([=[
-
+
void func(void)
{
cout << "a"
@@ -3390,7 +3390,7 @@ describe('cindent', function()
it('38 is working', function()
insert_([=[
-
+
void func(void)
{
/*
@@ -3399,11 +3399,11 @@ describe('cindent', function()
}
]=])
- execute('set com=s1:/*,m:*,ex:*/')
+ feed_command('set com=s1:/*,m:*,ex:*/')
feed(']]3jofoo();<esc>')
expect([=[
-
+
void func(void)
{
/*
@@ -3416,8 +3416,8 @@ describe('cindent', function()
it('39 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
for (int i = 0; i < 10; ++i)
@@ -3429,11 +3429,11 @@ describe('cindent', function()
}
]=])
- execute('set cino&')
+ feed_command('set cino&')
feed('2kdd2j=][<cr>')
expect([=[
-
+
void func(void)
{
for (int i = 0; i < 10; ++i)
@@ -3448,8 +3448,8 @@ describe('cindent', function()
it('40 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3457,7 +3457,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3465,7 +3465,7 @@ describe('cindent', function()
(c2 || c3))
{
}
-
+
if ( c1
&& ( c2
|| c3))
@@ -3477,11 +3477,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,(0')
+ feed_command('set cino=k2s,(0')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3489,7 +3489,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3497,7 +3497,7 @@ describe('cindent', function()
(c2 || c3))
{
}
-
+
if ( c1
&& ( c2
|| c3))
@@ -3512,8 +3512,8 @@ describe('cindent', function()
it('41 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3521,7 +3521,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3529,7 +3529,7 @@ describe('cindent', function()
(c2 || c3))
{
}
-
+
if ( c1
&& ( c2
|| c3))
@@ -3541,11 +3541,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,(s')
+ feed_command('set cino=k2s,(s')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3553,7 +3553,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3561,7 +3561,7 @@ describe('cindent', function()
(c2 || c3))
{
}
-
+
if ( c1
&& ( c2
|| c3))
@@ -3576,8 +3576,8 @@ describe('cindent', function()
it('42 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3585,7 +3585,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3597,7 +3597,7 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
c = c1 &&
(
c2 ||
@@ -3606,11 +3606,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,(s,U1')
+ feed_command('set cino=k2s,(s,U1')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3618,7 +3618,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3630,7 +3630,7 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
c = c1 &&
(
c2 ||
@@ -3642,8 +3642,8 @@ describe('cindent', function()
it('43 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3651,7 +3651,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3663,12 +3663,12 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
if ( c1
&& ( c2
|| c3))
foo;
-
+
a_long_line(
argument,
argument);
@@ -3677,11 +3677,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,(0,W4')
+ feed_command('set cino=k2s,(0,W4')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3689,7 +3689,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3701,12 +3701,12 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
if ( c1
&& ( c2
|| c3))
foo;
-
+
a_long_line(
argument,
argument);
@@ -3718,8 +3718,8 @@ describe('cindent', function()
it('44 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3727,7 +3727,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3742,11 +3742,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,u2')
+ feed_command('set cino=k2s,u2')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3754,7 +3754,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3772,8 +3772,8 @@ describe('cindent', function()
it('45 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3781,7 +3781,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3793,7 +3793,7 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
if ( c1
&& ( c2
|| c3))
@@ -3805,11 +3805,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2s,(0,w1')
+ feed_command('set cino=k2s,(0,w1')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3817,7 +3817,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3829,7 +3829,7 @@ describe('cindent', function()
&& (c22345
|| c3))
printf("foo\n");
-
+
if ( c1
&& ( c2
|| c3))
@@ -3844,8 +3844,8 @@ describe('cindent', function()
it('46 is working', function()
insert_([=[
-
-
+
+
void func(void)
{
if (condition1
@@ -3853,7 +3853,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3864,11 +3864,11 @@ describe('cindent', function()
}
]=])
- execute('set cino=k2,(s')
+ feed_command('set cino=k2,(s')
feed('2kdd3j=][<cr>')
expect([=[
-
+
void func(void)
{
if (condition1
@@ -3876,7 +3876,7 @@ describe('cindent', function()
action();
function(argument1
&& argument2);
-
+
if (c1 && (c2 ||
c3))
foo;
@@ -3890,7 +3890,7 @@ describe('cindent', function()
it('47 is working', function()
insert_([=[
-
+
NAMESPACESTART
/* valid namespaces with normal indent */
namespace
@@ -3930,7 +3930,7 @@ describe('cindent', function()
22222222222222222;
}
}
-
+
/* invalid namespaces use block indent */
namespace test test2 {
111111111111111111111;
@@ -3956,12 +3956,12 @@ describe('cindent', function()
NAMESPACEEND
]=])
- execute('set cino=N-s')
- execute('/^NAMESPACESTART')
+ feed_command('set cino=N-s')
+ feed_command('/^NAMESPACESTART')
feed('=/^NAMESPACEEND<cr>')
expect([=[
-
+
NAMESPACESTART
/* valid namespaces with normal indent */
namespace
@@ -4001,7 +4001,7 @@ describe('cindent', function()
22222222222222222;
}
}
-
+
/* invalid namespaces use block indent */
namespace test test2 {
111111111111111111111;
@@ -4030,7 +4030,7 @@ describe('cindent', function()
it('48 is working', function()
insert_([=[
-
+
JSSTART
var bar = {
foo: {
@@ -4047,12 +4047,12 @@ describe('cindent', function()
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
var bar = {
foo: {
@@ -4072,7 +4072,7 @@ describe('cindent', function()
it('49 is working', function()
insert_([=[
-
+
JSSTART
var foo = [
1,
@@ -4082,12 +4082,12 @@ describe('cindent', function()
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
var foo = [
1,
@@ -4100,7 +4100,7 @@ describe('cindent', function()
it('50 is working', function()
insert_([=[
-
+
JSSTART
function bar() {
var foo = [
@@ -4112,12 +4112,12 @@ describe('cindent', function()
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
function bar() {
var foo = [
@@ -4132,10 +4132,10 @@ describe('cindent', function()
it('51 is working', function()
insert_([=[
-
+
JSSTART
(function($){
-
+
if (cond &&
cond) {
stmt;
@@ -4143,18 +4143,18 @@ describe('cindent', function()
window.something.left =
(width - 50 + offset) + "px";
var class_name='myclass';
-
+
function private_method() {
}
-
+
var public_method={
method: function(options,args){
private_method();
}
}
-
+
function init(options) {
-
+
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2,
@@ -4168,19 +4168,19 @@ describe('cindent', function()
}
}, options||{}));
}
-
+
$.fn[class_name]=function() {
-
+
var _arguments=arguments;
return this.each(function(){
-
+
var options=$(this).data(class_name+'_public');
if (!options) {
init.apply(this,_arguments);
-
+
} else {
var method=public_method[_arguments[0]];
-
+
if (typeof(method)!='function') {
console.log(class_name+' has no method "'+_arguments[0]+'"');
return false;
@@ -4190,20 +4190,20 @@ describe('cindent', function()
}
});
}
-
+
})(jQuery);
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
(function($){
-
+
if (cond &&
cond) {
stmt;
@@ -4211,18 +4211,18 @@ describe('cindent', function()
window.something.left =
(width - 50 + offset) + "px";
var class_name='myclass';
-
+
function private_method() {
}
-
+
var public_method={
method: function(options,args){
private_method();
}
}
-
+
function init(options) {
-
+
$(this).data(class_name+'_public',$.extend({},{
foo: 'bar',
bar: 2,
@@ -4236,19 +4236,19 @@ describe('cindent', function()
}
}, options||{}));
}
-
+
$.fn[class_name]=function() {
-
+
var _arguments=arguments;
return this.each(function(){
-
+
var options=$(this).data(class_name+'_public');
if (!options) {
init.apply(this,_arguments);
-
+
} else {
var method=public_method[_arguments[0]];
-
+
if (typeof(method)!='function') {
console.log(class_name+' has no method "'+_arguments[0]+'"');
return false;
@@ -4258,7 +4258,7 @@ describe('cindent', function()
}
});
}
-
+
})(jQuery);
JSEND
]=])
@@ -4266,7 +4266,7 @@ describe('cindent', function()
it('52 is working', function()
insert_([=[
-
+
JSSTART
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
@@ -4285,12 +4285,12 @@ describe('cindent', function()
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
function init(options) {
$(this).data(class_name+'_public',$.extend({},{
@@ -4312,7 +4312,7 @@ describe('cindent', function()
it('53 is working', function()
insert_([=[
-
+
JSSTART
(function($){
function init(options) {
@@ -4333,12 +4333,12 @@ describe('cindent', function()
JSEND
]=])
- execute('set cino=j1,J1')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
(function($){
function init(options) {
@@ -4362,7 +4362,7 @@ describe('cindent', function()
it('javascript indent / vim-patch 7.4.670', function()
insert_([=[
-
+
JSSTART
// Results of JavaScript indent
// 1
@@ -4379,7 +4379,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 2
(function(){
var a = [
@@ -4400,7 +4400,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 3
(function(){
var a = [
@@ -4423,7 +4423,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 4
{
var a = [
@@ -4433,7 +4433,7 @@ describe('cindent', function()
var b;
var c;
}
-
+
// 5
{
var a = [
@@ -4444,7 +4444,7 @@ describe('cindent', function()
3
];
}
-
+
// 6
{
var a = [
@@ -4456,7 +4456,7 @@ describe('cindent', function()
3
];
}
-
+
// 7
{
var a = [
@@ -4468,7 +4468,7 @@ describe('cindent', function()
3
];
}
-
+
// 8
var x = [
(function(){
@@ -4483,7 +4483,7 @@ describe('cindent', function()
i;
})
];
-
+
// 9
var a = [
0 +
@@ -4502,7 +4502,7 @@ describe('cindent', function()
'h',
'i'
];
-
+
// 10
var a,
b,
@@ -4517,12 +4517,12 @@ describe('cindent', function()
]=])
-- :set cino=j1,J1,+2
- execute('set cino=j1,J1,+2')
- execute('/^JSSTART')
+ feed_command('set cino=j1,J1,+2')
+ feed_command('/^JSSTART')
feed('=/^JSEND<cr>')
expect([=[
-
+
JSSTART
// Results of JavaScript indent
// 1
@@ -4539,7 +4539,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 2
(function(){
var a = [
@@ -4560,7 +4560,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 3
(function(){
var a = [
@@ -4583,7 +4583,7 @@ describe('cindent', function()
'i'
];
}())
-
+
// 4
{
var a = [
@@ -4593,7 +4593,7 @@ describe('cindent', function()
var b;
var c;
}
-
+
// 5
{
var a = [
@@ -4604,7 +4604,7 @@ describe('cindent', function()
3
];
}
-
+
// 6
{
var a = [
@@ -4616,7 +4616,7 @@ describe('cindent', function()
3
];
}
-
+
// 7
{
var a = [
@@ -4628,7 +4628,7 @@ describe('cindent', function()
3
];
}
-
+
// 8
var x = [
(function(){
@@ -4643,7 +4643,7 @@ describe('cindent', function()
i;
})
];
-
+
// 9
var a = [
0 +
@@ -4662,7 +4662,7 @@ describe('cindent', function()
'h',
'i'
];
-
+
// 10
var a,
b,
diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
index 3e5cdd2ff2..9b0df024c8 100644
--- a/test/functional/legacy/004_bufenter_with_modelines_spec.lua
+++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
@@ -1,10 +1,9 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- 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')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('BufEnter with modelines', function()
setup(clear)
@@ -20,34 +19,34 @@ describe('BufEnter with modelines', function()
this is a test
end of test file Xxx]])
- execute('au BufEnter Xxx brew')
+ feed_command('au BufEnter Xxx brew')
-- Write test file Xxx
- execute('/start of')
- execute('.,/end of/w! Xxx')
- execute('set ai modeline modelines=3')
+ feed_command('/start of')
+ feed_command('.,/end of/w! Xxx')
+ feed_command('set ai modeline modelines=3')
-- Split to Xxx, autocmd will do :brew
- execute('sp Xxx')
+ feed_command('sp Xxx')
-- Append text with autoindent to this file
feed('G?this is a<CR>')
feed('othis should be auto-indented<Esc>')
-- Go to Xxx, no autocmd anymore
- execute('au! BufEnter Xxx')
- execute('buf Xxx')
+ feed_command('au! BufEnter Xxx')
+ feed_command('buf Xxx')
-- Append text without autoindent to Xxx
feed('G?this is a<CR>')
feed('othis should be in column 1<Esc>')
- execute('wq')
+ feed_command('wq')
-- Include Xxx in the current file
feed('G:r Xxx<CR>')
-- Vim issue #57 do not move cursor on <c-o> when autoindent is set
- execute('set fo+=r')
+ feed_command('set fo+=r')
feed('G')
feed('o# abcdef<Esc>2hi<CR><c-o>d0<Esc>')
feed('o# abcdef<Esc>2hi<c-o>d0<Esc>')
diff --git a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
index 895f4ad181..417842c52d 100644
--- a/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
+++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua
@@ -3,7 +3,8 @@
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 command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe('test5', function()
setup(clear)
@@ -18,35 +19,37 @@ describe('test5', function()
this is a test
end of test file Xxx]])
- execute('w! Xxx0')
- execute('au BufLeave Xxx bwipe')
- execute('/start of')
+ command('w! Xxx0')
+ command('au BufLeave Xxx bwipe')
+ command('/start of')
-- Write test file Xxx.
- execute('.,/end of/w! Xxx')
+ command('.,/end of/w! Xxx')
-- Split to Xxx.
- execute('sp Xxx')
+ command('sp Xxx')
-- Delete buffer Xxx, now we're back here.
- execute('bwipe')
+ command('bwipe')
feed('G?this is a<cr>')
feed('othis is some more text<esc>')
+ wait()
-- Append some text to this file.
-- Write current file contents.
- execute('?start?,$yank A')
+ command('?start?,$yank A')
-- Delete current buffer, get an empty one.
- execute('bwipe!')
+ command('bwipe!')
-- Append an extra line to the output register.
feed('ithis is another test line<esc>:yank A<cr>')
+ wait()
-- Output results
- execute('%d')
- execute('0put a')
- execute('$d')
+ command('%d')
+ command('0put a')
+ command('$d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/006_argument_list_spec.lua b/test/functional/legacy/006_argument_list_spec.lua
index 764854314f..dac58df8a5 100644
--- a/test/functional/legacy/006_argument_list_spec.lua
+++ b/test/functional/legacy/006_argument_list_spec.lua
@@ -2,8 +2,9 @@
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 command, dedent, eq = helpers.command, helpers.dedent, helpers.eq
local curbuf_contents = helpers.curbuf_contents
+local wait = helpers.wait
describe('argument list', function()
setup(clear)
@@ -16,10 +17,11 @@ describe('argument list', function()
this is a test
this is a test
end of test file Xxx]])
+ wait()
+
+ command('au BufReadPost Xxx2 next Xxx2 Xxx1')
+ command('/^start of')
- execute('au BufReadPost Xxx2 next Xxx2 Xxx1')
- execute('/^start of')
-
-- Write test file Xxx1
feed('A1<Esc>:.,/end of/w! Xxx1<cr>')
@@ -28,29 +30,31 @@ describe('argument list', function()
-- Write test file Xxx3
feed('$r3:.,/end of/w! Xxx3<cr>')
+ wait()
-- Redefine arglist; go to Xxx1
- execute('next! Xxx1 Xxx2 Xxx3')
-
+ command('next! Xxx1 Xxx2 Xxx3')
+
-- Open window for all args
- execute('all')
-
+ command('all')
+
-- Write contents of Xxx1
- execute('%yank A')
+ command('%yank A')
-- Append contents of last window (Xxx1)
feed('')
- execute('%yank A')
-
+ wait()
+ command('%yank A')
+
-- should now be in Xxx2
- execute('rew')
-
+ command('rew')
+
-- Append contents of Xxx2
- execute('%yank A')
+ command('%yank A')
- execute('%d')
- execute('0put=@a')
- execute('$d')
+ command('%d')
+ command('0put=@a')
+ command('$d')
eq(dedent([[
start of test file Xxx1
diff --git a/test/functional/legacy/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua
index e54525fd06..8501faabec 100644
--- a/test/functional/legacy/007_ball_buffer_list_spec.lua
+++ b/test/functional/legacy/007_ball_buffer_list_spec.lua
@@ -2,7 +2,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe(':ball', function()
setup(clear)
@@ -14,44 +14,44 @@ describe(':ball', function()
this is a test
end of test file Xxx]])
- execute('w! Xxx0')
+ feed_command('w! Xxx0')
feed('gg')
-- Write test file Xxx1
feed('A1:.,/end of/w! Xxx1<cr>')
- execute('sp Xxx1')
- execute('close')
+ feed_command('sp Xxx1')
+ feed_command('close')
-- Write test file Xxx2
feed('$r2:.,/end of/w! Xxx2<cr>')
- execute('sp Xxx2')
- execute('close')
+ feed_command('sp Xxx2')
+ feed_command('close')
-- Write test file Xxx3
feed('$r3:.,/end of/w! Xxx3<cr>')
- execute('sp Xxx3')
- execute('close')
+ feed_command('sp Xxx3')
+ feed_command('close')
- execute('au BufReadPost Xxx2 bwipe')
+ feed_command('au BufReadPost Xxx2 bwipe')
-- Open window for all args, close Xxx2
feed('$r4:ball<cr>')
-- Write contents of this file
- execute('%yank A')
+ feed_command('%yank A')
-- Append contents of second window (Xxx1)
feed('')
- execute('%yank A')
+ feed_command('%yank A')
-- Append contents of last window (this file)
feed('')
- execute('%yank A')
+ feed_command('%yank A')
- execute('bf')
- execute('%d')
- execute('0put=@a')
- execute('$d')
+ feed_command('bf')
+ feed_command('%d')
+ feed_command('0put=@a')
+ feed_command('$d')
expect([[
start of test file Xxx4
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 2c398d3c73..7474f1e068 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -3,7 +3,7 @@
local helpers = require('test.functional.helpers')(after_each)
local feed, source = helpers.feed, helpers.source
-local clear, execute, expect, eq, eval = helpers.clear, helpers.execute, helpers.expect, helpers.eq, helpers.eval
+local clear, feed_command, expect, eq, eval = helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
local io = require('io')
@@ -25,15 +25,15 @@ describe('autocommands that delete and unload buffers:', function()
before_each(clear)
it('BufWritePre, BufUnload', function()
- execute('au BufWritePre Xxx1 bunload')
- execute('au BufWritePre Xxx2 bwipe')
- execute('e Xxx2')
+ feed_command('au BufWritePre Xxx1 bunload')
+ feed_command('au BufWritePre Xxx2 bwipe')
+ feed_command('e Xxx2')
eq('Xxx2', eval('bufname("%")'))
- execute('e Xxx1')
+ feed_command('e Xxx1')
eq('Xxx1', eval('bufname("%")'))
-- The legacy test file did not check the error message.
- execute('let v:errmsg = "no error"')
- execute('write')
+ feed_command('let v:errmsg = "no error"')
+ feed_command('write')
-- Discard all "hit enter" prompts and messages.
feed('<C-L>')
eq('E203: Autocommands deleted or unloaded buffer to be written',
@@ -41,11 +41,11 @@ describe('autocommands that delete and unload buffers:', function()
eq('Xxx2', eval('bufname("%")'))
expect(text2)
-- Start editing Xxx2.
- execute('e! Xxx2')
+ feed_command('e! Xxx2')
-- The legacy test file did not check the error message.
- execute('let v:errmsg = "no error"')
+ feed_command('let v:errmsg = "no error"')
-- Write Xxx2, will delete the buffer and give an error msg.
- execute('w')
+ feed_command('w')
-- Discard all "hit enter" prompts and messages.
feed('<C-L>')
eq('E203: Autocommands deleted or unloaded buffer to be written',
@@ -73,17 +73,17 @@ describe('autocommands that delete and unload buffers:', function()
au BufUnload * call CloseAll()
au VimLeave * call WriteToOut()
]])
- execute('e Xxx2')
+ feed_command('e Xxx2')
-- Discard all "hit enter" prompts and messages.
feed('<C-L>')
- execute('e Xxx1')
+ feed_command('e Xxx1')
-- Discard all "hit enter" prompts and messages.
feed('<C-L>')
- execute('e Makefile') -- an existing file
+ feed_command('e Makefile') -- an existing file
feed('<C-L>')
- execute('sp new2')
+ feed_command('sp new2')
feed('<C-L>')
- execute('q')
+ feed_command('q')
wait()
eq('VimLeave done',
string.match(io.open('test.out', 'r'):read('*all'), "^%s*(.-)%s*$"))
diff --git a/test/functional/legacy/009_bufleave_autocommand_spec.lua b/test/functional/legacy/009_bufleave_autocommand_spec.lua
deleted file mode 100644
index 7481c639cf..0000000000
--- a/test/functional/legacy/009_bufleave_autocommand_spec.lua
+++ /dev/null
@@ -1,22 +0,0 @@
--- Test for Bufleave autocommand that deletes the buffer we are about to edit.
-
-local helpers = require('test.functional.helpers')(after_each)
-local clear, insert = helpers.clear, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
-
-describe('BufLeave autocommand', function()
- setup(clear)
-
- it('is working', function()
- insert([[
- start of test file xx
- end of test file xx]])
-
- execute('au BufLeave * bwipe yy')
- execute('e yy')
-
- expect([[
- start of test file xx
- end of test file xx]])
- end)
-end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index ba899f8119..e01af4583b 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -14,8 +14,8 @@
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,
+local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
+ helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
if helpers.pending_win32(pending) then return end
@@ -66,26 +66,26 @@ describe('file reading, writing and bufnew and filter autocommands', function()
it('FileReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
- execute('let $GZIP = ""')
+ feed_command('let $GZIP = ""')
--execute('au FileChangedShell * echo "caught FileChangedShell"')
- execute('set bin')
- execute("au FileReadPost *.gz '[,']!gzip -d")
+ feed_command('set bin')
+ feed_command("au FileReadPost *.gz '[,']!gzip -d")
-- Read and decompress the testfile.
- execute('$r Xtestfile.gz')
+ feed_command('$r Xtestfile.gz')
expect('\n'..text1)
end)
it('BufReadPre, BufReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
local gzip_data = io.open('Xtestfile.gz'):read('*all')
- execute('let $GZIP = ""')
+ feed_command('let $GZIP = ""')
-- Setup autocommands to decompress before reading and re-compress afterwards.
- execute("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
- execute("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")
- execute("au BufReadPost *.gz call rename(expand('<afile>'), expand('<afile>:r'))")
- execute("au BufReadPost *.gz exe '!gzip ' . shellescape(expand('<afile>:r'))")
+ feed_command("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
+ feed_command("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")
+ feed_command("au BufReadPost *.gz call rename(expand('<afile>'), expand('<afile>:r'))")
+ feed_command("au BufReadPost *.gz exe '!gzip ' . shellescape(expand('<afile>:r'))")
-- Edit compressed file.
- execute('e! Xtestfile.gz')
+ feed_command('e! Xtestfile.gz')
-- Discard all prompts and messages.
feed('<C-L>')
-- Expect the decompressed file in the buffer.
@@ -96,11 +96,11 @@ describe('file reading, writing and bufnew and filter autocommands', function()
it('FileReadPre, FileReadPost', function()
prepare_gz_file('Xtestfile', text1)
- execute('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
- execute('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
- execute("au! FileReadPost *.gz '[,']s/l/L/")
+ feed_command('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
+ feed_command('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
+ feed_command("au! FileReadPost *.gz '[,']s/l/L/")
-- Read compressed file.
- execute('$r Xtestfile.gz')
+ feed_command('$r Xtestfile.gz')
-- Discard all prompts and messages.
feed('<C-L>')
expect([[
@@ -121,17 +121,17 @@ describe('file reading, writing and bufnew and filter autocommands', function()
end
it('FileAppendPre, FileAppendPost', function()
- execute('au BufNewFile *.c read Xtest.c')
+ feed_command('au BufNewFile *.c read Xtest.c')
-- Will load Xtest.c.
- execute('e! foo.c')
- execute("au FileAppendPre *.out '[,']s/new/NEW/")
- execute('au FileAppendPost *.out !cat Xtest.c >>test.out')
+ feed_command('e! foo.c')
+ feed_command("au FileAppendPre *.out '[,']s/new/NEW/")
+ feed_command('au FileAppendPost *.out !cat Xtest.c >>test.out')
-- Append it to the output file.
- execute('w>>test.out')
+ feed_command('w>>test.out')
-- Discard all prompts and messages.
feed('<C-L>')
-- Expect the decompressed file in the buffer.
- execute('e test.out')
+ feed_command('e test.out')
expect([[
/*
@@ -166,18 +166,18 @@ describe('file reading, writing and bufnew and filter autocommands', function()
* Here is a new .c file
*/]]))
-- Need temp files here.
- execute('set shelltemp')
- execute('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
- execute('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
- execute('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
- execute("au FilterReadPost *.out '[,']s/x/X/g")
+ feed_command('set shelltemp')
+ feed_command('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
+ feed_command('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
+ feed_command('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
+ feed_command("au FilterReadPost *.out '[,']s/x/X/g")
-- Edit the output file.
- execute('e! test.out')
- execute('23,$!cat')
+ feed_command('e! test.out')
+ feed_command('23,$!cat')
-- Discard all prompts and messages.
feed('<C-L>')
-- Remove CR for when sed adds them.
- execute([[23,$s/\r$//]])
+ feed_command([[23,$s/\r$//]])
expect([[
startstart
start of testfile
diff --git a/test/functional/legacy/012_directory_spec.lua b/test/functional/legacy/012_directory_spec.lua
index cef31ae405..cec4f93737 100644
--- a/test/functional/legacy/012_directory_spec.lua
+++ b/test/functional/legacy/012_directory_spec.lua
@@ -3,12 +3,19 @@
-- - "./dir", in directory relative to file
-- - "dir", in directory relative to current dir
-local helpers = require('test.functional.helpers')(after_each)
-local lfs = require('lfs')
-local insert, eq = helpers.insert, helpers.eq
-local neq, eval = helpers.neq, helpers.eval
-local clear, execute = helpers.clear, helpers.execute
-local wait, write_file = helpers.wait, helpers.write_file
+local helpers = require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
+
+local eq = helpers.eq
+local neq = helpers.neq
+local wait = helpers.wait
+local funcs = helpers.funcs
+local meths = helpers.meths
+local clear = helpers.clear
+local insert = helpers.insert
+local command = helpers.command
+local write_file = helpers.write_file
+local curbufmeths = helpers.curbufmeths
local function ls_dir_sorted(dirname)
local files = {}
@@ -36,7 +43,7 @@ describe("'directory' option", function()
clear()
end)
teardown(function()
- execute('qall!')
+ command('qall!')
helpers.rmdir('Xtest.je')
helpers.rmdir('Xtest2')
os.remove('Xtest1')
@@ -49,21 +56,22 @@ describe("'directory' option", function()
line 3 Abcdefghij
end of testfile]])
- execute('set swapfile')
- execute('set dir=.,~')
+ meths.set_option('swapfile', true)
+ curbufmeths.set_option('swapfile', true)
+ meths.set_option('directory', '.')
-- sanity check: files should not exist yet.
eq(nil, lfs.attributes('.Xtest1.swp'))
- execute('e! Xtest1')
+ command('edit! Xtest1')
wait()
- eq('Xtest1', eval('buffer_name("%")'))
+ eq('Xtest1', funcs.buffer_name('%'))
-- Verify that the swapfile exists. In the legacy test this was done by
-- reading the output from :!ls.
neq(nil, lfs.attributes('.Xtest1.swp'))
- execute('set dir=./Xtest2,.,~')
- execute('e Xtest1')
+ meths.set_option('directory', './Xtest2,.')
+ command('edit Xtest1')
wait()
-- swapfile should no longer exist in CWD.
@@ -71,9 +79,9 @@ describe("'directory' option", function()
eq({ "Xtest1.swp", "Xtest3" }, ls_dir_sorted("Xtest2"))
- execute('set dir=Xtest.je,~')
- execute('e Xtest2/Xtest3')
- eq(1, eval('&swapfile'))
+ meths.set_option('directory', 'Xtest.je')
+ command('edit Xtest2/Xtest3')
+ eq(true, curbufmeths.get_option('swapfile'))
wait()
eq({ "Xtest3" }, ls_dir_sorted("Xtest2"))
diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua
index 48d4042ff2..8423aa3d11 100644
--- a/test/functional/legacy/015_alignment_spec.lua
+++ b/test/functional/legacy/015_alignment_spec.lua
@@ -4,7 +4,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('alignment', function()
setup(clear)
@@ -19,7 +19,7 @@ describe('alignment', function()
asdfa a
xasdfa a
asxxdfa a
-
+
test for :center
a a
fa afd asdf
@@ -28,7 +28,7 @@ describe('alignment', function()
asdfa a
xasdfa asdfasdfasdfasdfasdf
asxxdfa a
-
+
test for :right
a a
fa a
@@ -111,34 +111,34 @@ describe('alignment', function()
asxxdfa axxxoikey
asxa;ofa axxxoikey
asdfaqwer axxxoikey
-
+
xxxxx xx xxxxxx
xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx
xx xxxxxxx. xxxx xxxx.
-
+
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx
> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
-
+
aa aa aa aa
bb bb bb bb
cc cc cc cc]])
- execute('set tw=65')
+ feed_command('set tw=65')
feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]])
feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]])
feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]])
- execute('set fo+=tcroql tw=72')
+ feed_command('set fo+=tcroql tw=72')
feed('/xxxxxxxx$<cr>')
feed('0gq6kk<cr>')
-- Undo/redo here to make the next undo only work on the following changes.
feed('u<cr>')
- execute('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq')
- execute('/^aa')
+ feed_command('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq')
+ feed_command('/^aa')
feed('ggu<cr>')
-- Assert buffer contents.
@@ -151,7 +151,7 @@ describe('alignment', function()
asdfa a
xasdfa a
asxxdfa a
-
+
test for :center
a a
fa afd asdf
@@ -160,7 +160,7 @@ describe('alignment', function()
asdfa a
xasdfa asdfasdfasdfasdfasdf
asxxdfa a
-
+
test for :right
a a
fa a
@@ -243,14 +243,14 @@ describe('alignment', function()
asxxdfa axxxoikey
asxa;ofa axxxoikey
asdfaqwer axxxoikey
-
+
xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx
xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx.
xxxx xxxx.
-
+
> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx
> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx
-
+
aa aa aa aa
bb bb bb bb
cc cc cc cc]])
diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua
index ba1eac02cb..94fbb283f4 100644
--- a/test/functional/legacy/018_unset_smart_indenting_spec.lua
+++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua
@@ -1,11 +1,15 @@
-- Tests for not doing smart indenting when it isn't set.
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 feed = helpers.feed
+local clear = helpers.clear
+local insert = helpers.insert
+local expect = helpers.expect
+local feed_command = helpers.feed_command
describe('unset smart indenting', function()
- setup(clear)
+ before_each(clear)
it('is working', function()
insert([[
@@ -15,8 +19,8 @@ describe('unset smart indenting', function()
test text
test text]])
- execute('set nocin nosi ai')
- execute('/some')
+ feed_command('set nocin nosi ai')
+ feed_command('/some')
feed('2cc#test<Esc>')
expect([[
diff --git a/test/functional/legacy/019_smarttab_expandtab_spec.lua b/test/functional/legacy/019_smarttab_expandtab_spec.lua
index 2287a9f786..ecb24885bb 100644
--- a/test/functional/legacy/019_smarttab_expandtab_spec.lua
+++ b/test/functional/legacy/019_smarttab_expandtab_spec.lua
@@ -3,7 +3,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
setup(clear)
@@ -19,24 +19,24 @@ describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and
test text
Second line beginning with whitespace]])
- execute('set smarttab expandtab ts=8 sw=4')
+ feed_command('set smarttab expandtab ts=8 sw=4')
-- Make sure that backspace works, no matter what termcap is used.
- execute('set t_kD=x7f t_kb=x08')
+ feed_command('set t_kD=x7f t_kb=x08')
- execute('/some')
+ feed_command('/some')
feed('r ')
- execute('set noexpandtab')
- execute('/other')
+ feed_command('set noexpandtab')
+ feed_command('/other')
feed('r <cr>')
-- Test replacing with Tabs and then backspacing to undo it.
feed('0wR <bs><bs><bs><esc><cr>')
-- Test replacing with Tabs.
feed('0wR <esc><cr>')
-- Test that copyindent works with expandtab set.
- execute('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
+ feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
feed('o{<cr>x<esc>')
- execute('set nosol')
- execute('/Second line/')
+ feed_command('set nosol')
+ feed_command('/Second line/')
-- Test "dv_"
feed('fwdv_')
diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua
index 660348a792..8d90b1c77d 100644
--- a/test/functional/legacy/020_blockwise_visual_spec.lua
+++ b/test/functional/legacy/020_blockwise_visual_spec.lua
@@ -1,11 +1,10 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests Blockwise Visual when there are TABs before the text.
-- 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')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('blockwise visual', function()
setup(clear)
@@ -26,15 +25,15 @@ Ox jAy kdd]])
feed(":let @a = 'Ox<C-v><Esc>jAy<C-v><Esc>kdd'<cr>")
feed('G0k@au')
- execute('new')
+ feed_command('new')
feed('@auY')
- execute('quit')
+ feed_command('quit')
feed('GP')
- execute('/start here')
+ feed_command('/start here')
feed('"by$<C-v>jjlld')
- execute('/456')
+ feed_command('/456')
feed('<C-v>jj"bP')
- execute('$-3,$d')
+ feed_command('$-3,$d')
expect([[
123start here56
diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua
index 787a384fca..87d9deed7a 100644
--- a/test/functional/legacy/021_control_wi_spec.lua
+++ b/test/functional/legacy/021_control_wi_spec.lua
@@ -1,9 +1,8 @@
--- 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')(after_each)
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('CTRL-W CTRL-I', function()
setup(clear)
@@ -20,18 +19,18 @@ describe('CTRL-W CTRL-I', function()
test text]])
-- Search for the second occurence of start and append to register
- execute('/start')
+ feed_command('/start')
feed('2[<C-i>')
- execute('yank A')
+ feed_command('yank A')
-- Same as above but using different keystrokes.
feed('?start<cr>')
feed('2<C-w><Tab>')
- execute('yank A')
+ feed_command('yank A')
-- Clean buffer and put register
feed('ggdG"ap')
- execute('1d')
+ feed_command('1d')
-- The buffer should now contain:
expect([[
diff --git a/test/functional/legacy/022_line_ending_spec.lua b/test/functional/legacy/022_line_ending_spec.lua
index 092440bb16..fb4b782011 100644
--- a/test/functional/legacy/022_line_ending_spec.lua
+++ b/test/functional/legacy/022_line_ending_spec.lua
@@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('line ending', function()
setup(clear)
@@ -14,8 +14,8 @@ describe('line ending', function()
this one does<C-V><C-M>
and the last one doesn't]], '<ESC>')
- execute('set ta tx')
- execute('e!')
+ feed_command('set ta tx')
+ feed_command('e!')
expect("this lines ends in a\r\n"..
"this one doesn't\n"..
diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua
index 95ab983d24..e705397a2b 100644
--- a/test/functional/legacy/023_edit_arguments_spec.lua
+++ b/test/functional/legacy/023_edit_arguments_spec.lua
@@ -2,7 +2,8 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, insert = helpers.clear, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe(':edit', function()
setup(clear)
@@ -12,31 +13,32 @@ describe(':edit', function()
The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
foo|bar
foo/bar]])
+ wait()
-- Prepare some test files
- execute('$-1w! Xfile1')
- execute('$w! Xfile2')
- execute('w! Xfile0')
+ command('$-1w! Xfile1')
+ command('$w! Xfile2')
+ command('w! Xfile0')
-- Open Xfile using '+' range
- execute('edit +1 Xfile1')
- execute('s/|/PIPE/')
- execute('yank A')
- execute('w! Xfile1')
+ command('edit +1 Xfile1')
+ command('s/|/PIPE/')
+ command('yank A')
+ command('w! Xfile1')
-- Open Xfile2 using '|' range
- execute('edit Xfile2|1')
- execute("s/\\//SLASH/")
- execute('yank A')
- execute('w! Xfile2')
+ command('edit Xfile2|1')
+ command("s/\\//SLASH/")
+ command('yank A')
+ command('w! Xfile2')
-- Clean first buffer and put @a
- execute('bf')
- execute('%d')
- execute('0put a')
+ command('bf')
+ command('%d')
+ command('0put a')
-- Remove empty line
- execute('$d')
+ command('$d')
-- The buffer should now contain
expect([[
diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua
index 99224f9e08..0d51b4da26 100644
--- a/test/functional/legacy/025_jump_tag_hidden_spec.lua
+++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua
@@ -3,7 +3,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
@@ -21,30 +21,30 @@ describe('jump to a tag with hidden set', function()
SECTION_OFF]])
- execute('w! Xxx')
- execute('set hidden')
+ feed_command('w! Xxx')
+ feed_command('set hidden')
-- Create a link from test25.dir to the current directory.
- execute('!rm -f test25.dir')
- execute('!ln -s . test25.dir')
+ feed_command('!rm -f test25.dir')
+ feed_command('!ln -s . test25.dir')
-- Create tags.text, with the current directory name inserted.
- execute('/tags line')
- execute('r !pwd')
+ feed_command('/tags line')
+ feed_command('r !pwd')
feed('d$/test<cr>')
feed('hP:.w! tags.test<cr>')
-- Try jumping to a tag in the current file, but with a path that contains a
-- symbolic link. When wrong, this will give the ATTENTION message. The next
-- space will then be eaten by hit-return, instead of moving the cursor to 'd'.
- execute('set tags=tags.test')
+ feed_command('set tags=tags.test')
feed('G<C-]> x:yank a<cr>')
- execute('!rm -f Xxx test25.dir tags.test')
+ feed_command('!rm -f Xxx test25.dir tags.test')
-- Put @a and remove empty line
- execute('%d')
- execute('0put a')
- execute('$d')
+ feed_command('%d')
+ feed_command('0put a')
+ feed_command('$d')
-- Assert buffer contents.
expect("#efine SECTION_OFF 3")
diff --git a/test/functional/legacy/026_execute_while_if_spec.lua b/test/functional/legacy/026_execute_while_if_spec.lua
index 74ef34bb20..ea8abed7ae 100644
--- a/test/functional/legacy/026_execute_while_if_spec.lua
+++ b/test/functional/legacy/026_execute_while_if_spec.lua
@@ -1,9 +1,11 @@
-- Test for :execute, :while and :if
local helpers = require('test.functional.helpers')(after_each)
+
local clear = helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local expect = helpers.expect
local source = helpers.source
+local command = helpers.command
describe(':execute, :while and :if', function()
setup(clear)
@@ -37,7 +39,7 @@ describe(':execute, :while and :if', function()
]])
-- Remove empty line
- execute('1d')
+ command('1d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua
index a8c43260be..fabf831341 100644
--- a/test/functional/legacy/028_source_ctrl_v_spec.lua
+++ b/test/functional/legacy/028_source_ctrl_v_spec.lua
@@ -2,7 +2,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('CTRL-V at the end of the line', function()
setup(clear)
@@ -24,8 +24,8 @@ describe('CTRL-V at the end of the line', function()
feed(':%s/X/<C-v><C-v>/g<cr>')
feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
- execute('so Xtestfile')
- execute('%d')
+ feed_command('so Xtestfile')
+ feed_command('%d')
feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
feed(":'m,$s/<C-v><C-@>/0/g<cr>")
diff --git a/test/functional/legacy/029_join_spec.lua b/test/functional/legacy/029_join_spec.lua
index 7a183fcbec..460b9291bf 100644
--- a/test/functional/legacy/029_join_spec.lua
+++ b/test/functional/legacy/029_join_spec.lua
@@ -1,8 +1,12 @@
-- Test for joining lines with marks in them (and with 'joinspaces' set/reset)
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 feed = helpers.feed
+local clear = helpers.clear
+local insert = helpers.insert
+local expect = helpers.expect
+local feed_command = helpers.feed_command
describe('joining lines', function()
before_each(clear)
@@ -46,19 +50,19 @@ describe('joining lines', function()
-- Switch off 'joinspaces', then join some lines in the buffer using "J".
-- Also set a few marks and record their movement when joining lines.
- execute('set nojoinspaces')
- execute('/firstline/')
+ feed_command('set nojoinspaces')
+ feed_command('/firstline/')
feed('j"td/^$/<cr>')
feed('PJjJjJjJjJjJjJjJjJjJjJjJjJjJ')
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$p')
-- Do the same with 'joinspaces' on.
- execute('set joinspaces')
+ feed_command('set joinspaces')
feed('j"tp')
feed('JjJjJjJjJjJjJjJjJjJjJjJjJjJ')
feed('j05lmx2j06lmy2k4Jy3l$p`xyl$p`yy2l$po<esc>')
- execute('1d')
+ feed_command('1d')
expect([[
asdfasdf. asdf
@@ -129,20 +133,20 @@ describe('joining lines', function()
}
]])
- execute('/^{/+1')
- execute('set comments=s1:/*,mb:*,ex:*/,://')
- execute('set nojoinspaces')
- execute('set backspace=eol,start')
+ feed_command('/^{/+1')
+ feed_command('set comments=s1:/*,mb:*,ex:*/,://')
+ feed_command('set nojoinspaces')
+ feed_command('set backspace=eol,start')
-- With 'joinspaces' switched off, join lines using both "J" and :join and
-- verify that comment leaders are stripped or kept as appropriate.
- execute('.,+3join')
+ feed_command('.,+3join')
feed('j4J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('j3J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('j3J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('jj3J<cr>')
expect([[
@@ -180,22 +184,22 @@ describe('joining lines', function()
-- As mentioned above, we mimic the wrong initial cursor position in the old
-- test by advancing one line further.
- execute([[/^\d\+ this]], '+1')
+ feed_command([[/^\d\+ this]], '+1')
-- Test with the default 'backspace' setting.
feed('Avim1<c-u><esc><cr>')
feed('Avim2<c-g>u<c-u><esc><cr>')
- execute('set cpo-=<')
- execute('inoremap <c-u> <left><c-u>')
+ feed_command('set cpo-=<')
+ feed_command('inoremap <c-u> <left><c-u>')
feed('Avim3<c-u><esc><cr>')
- execute('iunmap <c-u>')
+ feed_command('iunmap <c-u>')
feed('Avim4<c-u><c-u><esc><cr>')
-- Test with 'backspace' set to the compatible setting.
- execute('set backspace=')
+ feed_command('set backspace=')
feed('A vim5<esc>A<c-u><c-u><esc><cr>')
feed('A vim6<esc>Azwei<c-g>u<c-u><esc><cr>')
- execute('inoremap <c-u> <left><c-u>')
+ feed_command('inoremap <c-u> <left><c-u>')
feed('A vim7<c-u><c-u><esc><cr>')
expect([[
@@ -283,29 +287,29 @@ describe('joining lines', function()
}
]])
- execute('/^{/+1')
- execute([[set comments=sO:*\ -,mO:*\ \ ,exO:*/]])
- execute('set comments+=s1:/*,mb:*,ex:*/,://')
- execute('set comments+=s1:>#,mb:#,ex:#<,:<')
- execute('set backspace=eol,start')
+ feed_command('/^{/+1')
+ feed_command([[set comments=sO:*\ -,mO:*\ \ ,exO:*/]])
+ feed_command('set comments+=s1:/*,mb:*,ex:*/,://')
+ feed_command('set comments+=s1:>#,mb:#,ex:#<,:<')
+ feed_command('set backspace=eol,start')
-- With 'joinspaces' on (the default setting), again join lines and verify
-- that comment leaders are stripped or kept as appropriate.
- execute('.,+3join')
+ feed_command('.,+3join')
feed('j4J<cr>')
- execute('.,+8join')
+ feed_command('.,+8join')
feed('j9J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('j3J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('j3J<cr>')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('jj3J<cr>')
feed('j')
- execute('.,+2join')
+ feed_command('.,+2join')
feed('jj3J<cr>')
feed('j')
- execute('.,+5join')
+ feed_command('.,+5join')
feed('j6J<cr>')
feed('oSome code!<cr>// Make sure backspacing does not remove this comment leader.<esc>0i<bs><esc>')
diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua
index 5fd78b2c59..7384fdf847 100644
--- a/test/functional/legacy/030_fileformats_spec.lua
+++ b/test/functional/legacy/030_fileformats_spec.lua
@@ -1,8 +1,9 @@
-- Test for a lot of variations of the 'fileformats' option
local helpers = require('test.functional.helpers')(after_each)
-local feed, clear, execute = helpers.feed, helpers.clear, helpers.execute
+local feed, clear, command = helpers.feed, helpers.clear, helpers.command
local eq, write_file = helpers.eq, helpers.write_file
+local wait = helpers.wait
if helpers.pending_win32(pending) then return end
@@ -45,198 +46,214 @@ describe('fileformats option', function()
it('is working', function()
-- Try reading and writing with 'fileformats' empty.
- execute('set fileformats=')
- execute('set fileformat=unix')
- execute('e! XXUnix')
- execute('w! test.out')
- execute('e! XXDos')
- execute('w! XXtt01')
- execute('e! XXMac')
- execute('w! XXtt02')
- execute('bwipe XXUnix XXDos XXMac')
- execute('set fileformat=dos')
- execute('e! XXUnix')
- execute('w! XXtt11')
- execute('e! XXDos')
- execute('w! XXtt12')
- execute('e! XXMac')
- execute('w! XXtt13')
- execute('bwipe XXUnix XXDos XXMac')
- execute('set fileformat=mac')
- execute('e! XXUnix')
- execute('w! XXtt21')
- execute('e! XXDos')
- execute('w! XXtt22')
- execute('e! XXMac')
- execute('w! XXtt23')
- execute('bwipe XXUnix XXDos XXMac')
+ command('set fileformats=')
+ command('set fileformat=unix')
+ command('e! XXUnix')
+ command('w! test.out')
+ command('e! XXDos')
+ command('w! XXtt01')
+ command('e! XXMac')
+ command('w! XXtt02')
+ command('bwipe XXUnix XXDos XXMac')
+ command('set fileformat=dos')
+ command('e! XXUnix')
+ command('w! XXtt11')
+ command('e! XXDos')
+ command('w! XXtt12')
+ command('e! XXMac')
+ command('w! XXtt13')
+ command('bwipe XXUnix XXDos XXMac')
+ command('set fileformat=mac')
+ command('e! XXUnix')
+ command('w! XXtt21')
+ command('e! XXDos')
+ command('w! XXtt22')
+ command('e! XXMac')
+ command('w! XXtt23')
+ command('bwipe XXUnix XXDos XXMac')
-- Try reading and writing with 'fileformats' set to one format.
- execute('set fileformats=unix')
- execute('e! XXUxDsMc')
- execute('w! XXtt31')
- execute('bwipe XXUxDsMc')
- execute('set fileformats=dos')
- execute('e! XXUxDsMc')
- execute('w! XXtt32')
- execute('bwipe XXUxDsMc')
- execute('set fileformats=mac')
- execute('e! XXUxDsMc')
- execute('w! XXtt33')
- execute('bwipe XXUxDsMc')
+ command('set fileformats=unix')
+ command('e! XXUxDsMc')
+ command('w! XXtt31')
+ command('bwipe XXUxDsMc')
+ command('set fileformats=dos')
+ command('e! XXUxDsMc')
+ command('w! XXtt32')
+ command('bwipe XXUxDsMc')
+ command('set fileformats=mac')
+ command('e! XXUxDsMc')
+ command('w! XXtt33')
+ command('bwipe XXUxDsMc')
-- Try reading and writing with 'fileformats' set to two formats.
- execute('set fileformats=unix,dos')
- execute('e! XXUxDsMc')
- execute('w! XXtt41')
- execute('bwipe XXUxDsMc')
- execute('e! XXUxMac')
- execute('w! XXtt42')
- execute('bwipe XXUxMac')
- execute('e! XXDosMac')
- execute('w! XXtt43')
- execute('bwipe XXDosMac')
- execute('set fileformats=unix,mac')
- execute('e! XXUxDs')
- execute('w! XXtt51')
- execute('bwipe XXUxDs')
- execute('e! XXUxDsMc')
- execute('w! XXtt52')
- execute('bwipe XXUxDsMc')
- execute('e! XXDosMac')
- execute('w! XXtt53')
- execute('bwipe XXDosMac')
- execute('e! XXEol')
+ command('set fileformats=unix,dos')
+ command('e! XXUxDsMc')
+ command('w! XXtt41')
+ command('bwipe XXUxDsMc')
+ command('e! XXUxMac')
+ command('w! XXtt42')
+ command('bwipe XXUxMac')
+ command('e! XXDosMac')
+ command('w! XXtt43')
+ command('bwipe XXDosMac')
+ command('set fileformats=unix,mac')
+ command('e! XXUxDs')
+ command('w! XXtt51')
+ command('bwipe XXUxDs')
+ command('e! XXUxDsMc')
+ command('w! XXtt52')
+ command('bwipe XXUxDsMc')
+ command('e! XXDosMac')
+ command('w! XXtt53')
+ command('bwipe XXDosMac')
+ command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
- execute('w! XXtt54')
- execute('bwipe XXEol')
- execute('set fileformats=dos,mac')
- execute('e! XXUxDs')
- execute('w! XXtt61')
- execute('bwipe XXUxDs')
- execute('e! XXUxMac')
+ wait()
+ command('w! XXtt54')
+ command('bwipeout! XXEol')
+ command('set fileformats=dos,mac')
+ command('e! XXUxDs')
+ command('w! XXtt61')
+ command('bwipe XXUxDs')
+ command('e! XXUxMac')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
- execute('w! XXtt62')
- execute('bwipe XXUxMac')
- execute('e! XXUxDsMc')
- execute('w! XXtt63')
- execute('bwipe XXUxDsMc')
- execute('e! XXMacEol')
+ wait()
+ command('w! XXtt62')
+ command('bwipeout! XXUxMac')
+ command('e! XXUxDsMc')
+ command('w! XXtt63')
+ command('bwipe XXUxDsMc')
+ command('e! XXMacEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
- execute('w! XXtt64')
- execute('bwipe XXMacEol')
+ wait()
+ command('w! XXtt64')
+ command('bwipeout! XXMacEol')
-- Try reading and writing with 'fileformats' set to three formats.
- execute('set fileformats=unix,dos,mac')
- execute('e! XXUxDsMc')
- execute('w! XXtt71')
- execute('bwipe XXUxDsMc')
- execute('e! XXEol')
+ command('set fileformats=unix,dos,mac')
+ command('e! XXUxDsMc')
+ command('w! XXtt71')
+ command('bwipe XXUxDsMc')
+ command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
- execute('w! XXtt72')
- execute('bwipe XXEol')
- execute('set fileformats=mac,dos,unix')
- execute('e! XXUxDsMc')
- execute('w! XXtt81')
- execute('bwipe XXUxDsMc')
- execute('e! XXEol')
+ wait()
+ command('w! XXtt72')
+ command('bwipeout! XXEol')
+ command('set fileformats=mac,dos,unix')
+ command('e! XXUxDsMc')
+ command('w! XXtt81')
+ command('bwipe XXUxDsMc')
+ command('e! XXEol')
feed('ggO<C-R>=&ffs<CR>:<C-R>=&ff<CR><ESC>')
- execute('w! XXtt82')
- execute('bwipe XXEol')
+ wait()
+ command('w! XXtt82')
+ command('bwipeout! XXEol')
-- Try with 'binary' set.
- execute('set fileformats=mac,unix,dos')
- execute('set binary')
- execute('e! XXUxDsMc')
- execute('w! XXtt91')
- execute('bwipe XXUxDsMc')
- execute('set fileformats=mac')
- execute('e! XXUxDsMc')
- execute('w! XXtt92')
- execute('bwipe XXUxDsMc')
- execute('set fileformats=dos')
- execute('e! XXUxDsMc')
- execute('w! XXtt93')
+ command('set fileformats=mac,unix,dos')
+ command('set binary')
+ command('e! XXUxDsMc')
+ command('w! XXtt91')
+ command('bwipe XXUxDsMc')
+ command('set fileformats=mac')
+ command('e! XXUxDsMc')
+ command('w! XXtt92')
+ command('bwipe XXUxDsMc')
+ command('set fileformats=dos')
+ command('e! XXUxDsMc')
+ command('w! XXtt93')
-- Append "END" to each file so that we can see what the last written
-- char was.
- execute('set fileformat=unix nobin')
+ command('set fileformat=unix nobin')
feed('ggdGaEND<esc>')
- execute('w >>XXtt01')
- execute('w >>XXtt02')
- execute('w >>XXtt11')
- execute('w >>XXtt12')
- execute('w >>XXtt13')
- execute('w >>XXtt21')
- execute('w >>XXtt22')
- execute('w >>XXtt23')
- execute('w >>XXtt31')
- execute('w >>XXtt32')
- execute('w >>XXtt33')
- execute('w >>XXtt41')
- execute('w >>XXtt42')
- execute('w >>XXtt43')
- execute('w >>XXtt51')
- execute('w >>XXtt52')
- execute('w >>XXtt53')
- execute('w >>XXtt54')
- execute('w >>XXtt61')
- execute('w >>XXtt62')
- execute('w >>XXtt63')
- execute('w >>XXtt64')
- execute('w >>XXtt71')
- execute('w >>XXtt72')
- execute('w >>XXtt81')
- execute('w >>XXtt82')
- execute('w >>XXtt91')
- execute('w >>XXtt92')
- execute('w >>XXtt93')
+ wait()
+ command('w >>XXtt01')
+ command('w >>XXtt02')
+ command('w >>XXtt11')
+ command('w >>XXtt12')
+ command('w >>XXtt13')
+ command('w >>XXtt21')
+ command('w >>XXtt22')
+ command('w >>XXtt23')
+ command('w >>XXtt31')
+ command('w >>XXtt32')
+ command('w >>XXtt33')
+ command('w >>XXtt41')
+ command('w >>XXtt42')
+ command('w >>XXtt43')
+ command('w >>XXtt51')
+ command('w >>XXtt52')
+ command('w >>XXtt53')
+ command('w >>XXtt54')
+ command('w >>XXtt61')
+ command('w >>XXtt62')
+ command('w >>XXtt63')
+ command('w >>XXtt64')
+ command('w >>XXtt71')
+ command('w >>XXtt72')
+ command('w >>XXtt81')
+ command('w >>XXtt82')
+ command('w >>XXtt91')
+ command('w >>XXtt92')
+ command('w >>XXtt93')
-- Concatenate the results.
-- Make fileformat of test.out the native fileformat.
-- Add a newline at the end.
- execute('set binary')
- execute('e! test.out')
- execute('$r XXtt01')
- execute('$r XXtt02')
+ command('set binary')
+ command('e! test.out')
+ command('$r XXtt01')
+ command('$r XXtt02')
feed('Go1<esc>')
- execute('$r XXtt11')
- execute('$r XXtt12')
- execute('$r XXtt13')
+ wait()
+ command('$r XXtt11')
+ command('$r XXtt12')
+ command('$r XXtt13')
feed('Go2<esc>')
- execute('$r XXtt21')
- execute('$r XXtt22')
- execute('$r XXtt23')
+ wait()
+ command('$r XXtt21')
+ command('$r XXtt22')
+ command('$r XXtt23')
feed('Go3<esc>')
- execute('$r XXtt31')
- execute('$r XXtt32')
- execute('$r XXtt33')
+ wait()
+ command('$r XXtt31')
+ command('$r XXtt32')
+ command('$r XXtt33')
feed('Go4<esc>')
- execute('$r XXtt41')
- execute('$r XXtt42')
- execute('$r XXtt43')
+ wait()
+ command('$r XXtt41')
+ command('$r XXtt42')
+ command('$r XXtt43')
feed('Go5<esc>')
- execute('$r XXtt51')
- execute('$r XXtt52')
- execute('$r XXtt53')
- execute('$r XXtt54')
+ wait()
+ command('$r XXtt51')
+ command('$r XXtt52')
+ command('$r XXtt53')
+ command('$r XXtt54')
feed('Go6<esc>')
- execute('$r XXtt61')
- execute('$r XXtt62')
- execute('$r XXtt63')
- execute('$r XXtt64')
+ wait()
+ command('$r XXtt61')
+ command('$r XXtt62')
+ command('$r XXtt63')
+ command('$r XXtt64')
feed('Go7<esc>')
- execute('$r XXtt71')
- execute('$r XXtt72')
+ wait()
+ command('$r XXtt71')
+ command('$r XXtt72')
feed('Go8<esc>')
- execute('$r XXtt81')
- execute('$r XXtt82')
+ wait()
+ command('$r XXtt81')
+ command('$r XXtt82')
feed('Go9<esc>')
- execute('$r XXtt91')
- execute('$r XXtt92')
- execute('$r XXtt93')
+ wait()
+ command('$r XXtt91')
+ command('$r XXtt92')
+ command('$r XXtt93')
feed('Go10<esc>')
- execute('$r XXUnix')
- execute('set nobinary ff&')
+ wait()
+ command('$r XXUnix')
+ command('set nobinary ff&')
-- Assert buffer contents. This has to be done manually as
-- helpers.expect() calls helpers.dedent() which messes up the white space
diff --git a/test/functional/legacy/031_close_commands_spec.lua b/test/functional/legacy/031_close_commands_spec.lua
index d41eadaa00..64c67c9882 100644
--- a/test/functional/legacy/031_close_commands_spec.lua
+++ b/test/functional/legacy/031_close_commands_spec.lua
@@ -16,7 +16,7 @@ local clear = helpers.clear
local source = helpers.source
local insert = helpers.insert
local expect = helpers.expect
-local execute = helpers.execute
+local feed_command = helpers.feed_command
describe('Commands that close windows and/or buffers', function()
local function cleanup()
@@ -38,40 +38,40 @@ describe('Commands that close windows and/or buffers', function()
feed('GA 1<Esc>:$w! Xtest1<CR>')
feed('$r2:$w! Xtest2<CR>')
feed('$r3:$w! Xtest3<CR>')
- execute('n! Xtest1 Xtest2')
+ feed_command('n! Xtest1 Xtest2')
feed('A 1<Esc>:set hidden<CR>')
-- Test for working :n when hidden set
- execute('n')
+ feed_command('n')
expect('testtext 2')
-- Test for failing :rew when hidden not set
- execute('set nohidden')
+ feed_command('set nohidden')
feed('A 2<Esc>:rew<CR>')
expect('testtext 2 2')
-- Test for working :rew when hidden set
- execute('set hidden')
- execute('rew')
+ feed_command('set hidden')
+ feed_command('rew')
expect('testtext 1 1')
-- Test for :all keeping a buffer when it's modified
- execute('set nohidden')
+ feed_command('set nohidden')
feed('A 1<Esc>:sp<CR>')
- execute('n Xtest2 Xtest3')
- execute('all')
- execute('1wincmd w')
+ feed_command('n Xtest2 Xtest3')
+ feed_command('all')
+ feed_command('1wincmd w')
expect('testtext 1 1 1')
-- Test abandoning changed buffer, should be unloaded even when 'hidden' set
- execute('set hidden')
+ feed_command('set hidden')
feed('A 1<Esc>:q!<CR>')
expect('testtext 2 2')
- execute('unhide')
+ feed_command('unhide')
expect('testtext 2 2')
-- Test ":hide" hides anyway when 'hidden' not set
- execute('set nohidden')
+ feed_command('set nohidden')
feed('A 2<Esc>:hide<CR>')
expect('testtext 3')
@@ -80,42 +80,42 @@ describe('Commands that close windows and/or buffers', function()
expect('testtext 3 3')
-- Test ":edit" working in modified buffer when 'hidden' set
- execute('set hidden')
- execute('e Xtest1')
+ feed_command('set hidden')
+ feed_command('e Xtest1')
expect('testtext 1')
-- Test ":close" not hiding when 'hidden' not set in modified buffer
- execute('sp Xtest3')
- execute('set nohidden')
+ feed_command('sp Xtest3')
+ feed_command('set nohidden')
feed('A 3<Esc>:close<CR>')
expect('testtext 3 3 3')
-- Test ":close!" does hide when 'hidden' not set in modified buffer
feed('A 3<Esc>:close!<CR>')
- execute('set nohidden')
+ feed_command('set nohidden')
expect('testtext 1')
-- Test ":all!" hides changed buffer
- execute('sp Xtest4')
+ feed_command('sp Xtest4')
feed('GA 4<Esc>:all!<CR>')
- execute('1wincmd w')
+ feed_command('1wincmd w')
expect('testtext 2 2 2')
-- Test ":q!" and hidden buffer.
- execute('bw! Xtest1 Xtest2 Xtest3 Xtest4')
- execute('sp Xtest1')
- execute('wincmd w')
- execute('bw!')
- execute('set modified')
- execute('bot sp Xtest2')
- execute('set modified')
- execute('bot sp Xtest3')
- execute('set modified')
- execute('wincmd t')
- execute('hide')
- execute('q!')
+ feed_command('bw! Xtest1 Xtest2 Xtest3 Xtest4')
+ feed_command('sp Xtest1')
+ feed_command('wincmd w')
+ feed_command('bw!')
+ feed_command('set modified')
+ feed_command('bot sp Xtest2')
+ feed_command('set modified')
+ feed_command('bot sp Xtest3')
+ feed_command('set modified')
+ feed_command('wincmd t')
+ feed_command('hide')
+ feed_command('q!')
expect('testtext 3')
- execute('q!')
+ feed_command('q!')
feed('<CR>')
expect('testtext 1')
source([[
diff --git a/test/functional/legacy/033_lisp_indent_spec.lua b/test/functional/legacy/033_lisp_indent_spec.lua
index b4abb02ac2..2b79ee024b 100644
--- a/test/functional/legacy/033_lisp_indent_spec.lua
+++ b/test/functional/legacy/033_lisp_indent_spec.lua
@@ -1,10 +1,10 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- Test for 'lisp'
-- If the lisp feature is not enabled, this will fail!
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 command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe('lisp indent', function()
setup(clear)
@@ -13,7 +13,7 @@ describe('lisp indent', function()
insert([[
(defun html-file (base)
(format nil "~(~A~).html" base))
-
+
(defmacro page (name title &rest body)
(let ((ti (gensym)))
`(with-open-file (*standard-output*
@@ -26,29 +26,30 @@ describe('lisp indent', function()
(as h2 (string-upcase ,ti)))
(brs 3)
,@body))))
-
+
;;; Utilities for generating links
-
+
(defmacro with-link (dest &rest body)
`(progn
(format t "<a href=\"~A\">" (html-file ,dest))
,@body
(princ "</a>")))]])
- execute('set lisp')
- execute('/^(defun')
+ command('set lisp')
+ command('/^(defun')
feed('=G:/^(defun/,$yank A<cr>')
+ wait()
-- Put @a and clean empty line
- execute('%d')
- execute('0put a')
- execute('$d')
+ command('%d')
+ command('0put a')
+ command('$d')
-- Assert buffer contents.
expect([[
(defun html-file (base)
(format nil "~(~A~).html" base))
-
+
(defmacro page (name title &rest body)
(let ((ti (gensym)))
`(with-open-file (*standard-output*
@@ -61,9 +62,9 @@ describe('lisp indent', function()
(as h2 (string-upcase ,ti)))
(brs 3)
,@body))))
-
+
;;; Utilities for generating links
-
+
(defmacro with-link (dest &rest body)
`(progn
(format t "<a href=\"~A\">" (html-file ,dest))
diff --git a/test/functional/legacy/034_user_function_spec.lua b/test/functional/legacy/034_user_function_spec.lua
index 38989cd982..0b7dfc4f0e 100644
--- a/test/functional/legacy/034_user_function_spec.lua
+++ b/test/functional/legacy/034_user_function_spec.lua
@@ -5,7 +5,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('user functions, expr-mappings, overwrite protected builtin functions and regression on calling expressions', function()
setup(clear)
@@ -72,19 +72,19 @@ describe('user functions, expr-mappings, overwrite protected builtin functions a
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')
+ feed_command('call append(line("$"), max([1, 2, 3]))')
+ feed_command('call extend(g:, {"max": function("min")})')
+ feed_command('call append(line("$"), max([1, 2, 3]))')
+ feed_command('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')
+ feed_command([[ $put =(0&&(function('tr'))(1, 2, 3))]])
+ feed_command([[ $put =(1&&(function('tr'))(1, 2, 3))]])
+ feed_command('catch')
+ feed_command([[ $put ='!!! Unexpected exception:']])
+ feed_command(' $put =v:exception')
+ feed_command('endtry')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua
index 3b9f7a9d85..84eb9c0eee 100644
--- a/test/functional/legacy/035_increment_and_decrement_spec.lua
+++ b/test/functional/legacy/035_increment_and_decrement_spec.lua
@@ -3,7 +3,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('increment and decrement commands', function()
setup(clear)
@@ -19,25 +19,25 @@ describe('increment and decrement commands', function()
-- Increment and decrement numbers in the first row, interpreting the
-- numbers as decimal, octal or hexadecimal.
- execute('set nrformats=bin,octal,hex', '1')
+ feed_command('set nrformats=bin,octal,hex', '1')
feed('63l102ll64128$')
-- For the second row, treat the numbers as decimal or octal.
-- 0x100 should be interpreted as decimal 0, the character x, and decimal 100.
- execute('set nrformats=octal', '2')
+ feed_command('set nrformats=octal', '2')
feed('0w102l2w65129blx6lD')
-- For the third row, treat the numbers as decimal or hexadecimal.
-- 077 should be interpreted as decimal 77.
- execute('set nrformats=hex', '3')
+ feed_command('set nrformats=hex', '3')
feed('0101l257Txldt   ')
-- For the fourth row, interpret all numbers as decimal.
- execute('set nrformats=', '4')
+ feed_command('set nrformats=', '4')
feed('0200l100w78')
-- For the last row, interpret as binary and hexadecimal.
- execute('set nrformats=bin,hex', '5')
+ feed_command('set nrformats=bin,hex', '5')
feed('010065l6432')
expect([[
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index 15287b9901..110f7dd852 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -1,7 +1,7 @@
-- Test character classes in regexp using regexpengine 0, 1, 2.
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, command, expect = helpers.clear, helpers.command, helpers.expect
local source, write_file = helpers.source, helpers.write_file
local function sixlines(text)
@@ -14,7 +14,7 @@ end
local function diff(text, nodedent)
local fname = helpers.tmpname()
- execute('w! '..fname)
+ command('w! '..fname)
helpers.wait()
local data = io.open(fname):read('*all')
if nodedent then
@@ -45,7 +45,7 @@ describe('character classes in regexp', function()
end)
before_each(function()
clear()
- execute('e test36.in')
+ command('e test36.in')
end)
teardown(function()
os.remove('test36.in')
diff --git a/test/functional/legacy/038_virtual_replace_spec.lua b/test/functional/legacy/038_virtual_replace_spec.lua
index dcbc9c39f7..2dfc959a8c 100644
--- a/test/functional/legacy/038_virtual_replace_spec.lua
+++ b/test/functional/legacy/038_virtual_replace_spec.lua
@@ -2,31 +2,31 @@
local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('Virtual replace mode', function()
setup(clear)
it('is working', function()
-- Make sure that backspace works, no matter what termcap is used.
- execute('set t_kD=x7f t_kb=x08')
+ feed_command('set t_kD=x7f t_kb=x08')
-- Use vi default for 'smarttab'
- execute('set nosmarttab')
+ feed_command('set nosmarttab')
feed('ggdGa<cr>')
feed('abcdefghi<cr>')
feed('jk<tab>lmn<cr>')
feed('<Space><Space><Space><Space>opq<tab>rst<cr>')
feed('<C-d>uvwxyz<cr>')
feed('<esc>gg')
- execute('set ai')
- execute('set bs=2')
+ feed_command('set ai')
+ feed_command('set bs=2')
feed('gR0<C-d> 1<cr>')
feed('A<cr>')
feed('BCDEFGHIJ<cr>')
feed('<tab>KL<cr>')
feed('MNO<cr>')
feed('PQR<esc>G')
- execute('ka')
+ feed_command('ka')
feed('o0<C-d><cr>')
feed('abcdefghi<cr>')
feed('jk<tab>lmn<cr>')
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 63335985cc..dffef50950 100644
--- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua
+++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
@@ -5,14 +5,14 @@ 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
-local execute = helpers.execute
+local feed_command = helpers.feed_command
describe('Visual block mode', function()
before_each(function()
clear()
- execute('set ts&vi sw&vi sts&vi noet') -- Vim compatible
+ feed_command('set ts&vi sw&vi sts&vi noet') -- Vim compatible
end)
it('should shift, insert, replace and change a block', function()
@@ -55,9 +55,9 @@ describe('Visual block mode', function()
cccc
dddd]])
- execute('/^aa')
+ feed_command('/^aa')
feed('l<C-v>jjjlllI<Right><Right> <ESC>')
- execute('/xaaa$')
+ feed_command('/xaaa$')
feed('<C-v>jjjI<lt>><Left>p<ESC>')
expect([[
@@ -84,13 +84,13 @@ describe('Visual block mode', function()
4567]])
-- Test for Visual block was created with the last <C-v>$.
- execute('/^A23$/')
+ feed_command('/^A23$/')
feed('l<C-v>j$Aab<ESC>')
-- Test for Visual block was created with the middle <C-v>$ (1).
- execute('/^B23$/')
+ feed_command('/^B23$/')
feed('l<C-v>j$hAab<ESC>')
-- Test for Visual block was created with the middle <C-v>$ (2).
- execute('/^C23$/')
+ feed_command('/^C23$/')
feed('l<C-v>j$hhAab<ESC>')
expect([[
@@ -112,8 +112,8 @@ describe('Visual block mode', function()
]])
-- Test for Visual block insert when virtualedit=all and utf-8 encoding.
- execute('set ve=all')
- execute('/\t\tline')
+ feed_command('set ve=all')
+ feed_command('/\t\tline')
feed('07l<C-v>jjIx<ESC>')
expect([[
@@ -199,10 +199,10 @@ describe('Visual block mode', function()
98765]])
-- Test cursor position. When virtualedit=block and Visual block mode and $gj.
- execute('set ve=block')
+ feed_command('set ve=block')
feed('G2l')
feed('2k<C-v>$gj<ESC>')
- execute([[let cpos=getpos("'>")]])
+ feed_command([[let cpos=getpos("'>")]])
local cpos = nvim.get_var('cpos')
local expected = {
col = 4,
@@ -223,7 +223,7 @@ describe('Visual block mode', function()
#define BO_CRSR 0x0004]])
-- Block_insert when replacing spaces in front of the block with tabs.
- execute('set ts=8 sts=4 sw=4')
+ feed_command('set ts=8 sts=4 sw=4')
feed('ggf0<C-v>2jI<TAB><ESC>')
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 b6451eb720..b526d82519 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,8 +1,10 @@
-- Test for writing and reading a file of over 100 Kbyte
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 command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe('writing and reading a file of over 100 Kbyte', function()
setup(clear)
@@ -16,17 +18,18 @@ describe('writing and reading a file of over 100 Kbyte', function()
This is the end]])
feed('kY3000p2GY3000p')
+ wait()
- execute('w! test.out')
- execute('%d')
- execute('e! test.out')
- execute('yank A')
- execute('3003yank A')
- execute('6005yank A')
- execute('%d')
- execute('0put a')
- execute('$d')
- execute('w!')
+ command('w! test.out')
+ command('%d')
+ command('e! test.out')
+ command('yank A')
+ command('3003yank A')
+ command('6005yank A')
+ command('%d')
+ command('0put a')
+ command('$d')
+ command('w!')
expect([[
This is the start
diff --git a/test/functional/legacy/043_magic_settings_spec.lua b/test/functional/legacy/043_magic_settings_spec.lua
index f174751de2..a88ccc2b42 100644
--- a/test/functional/legacy/043_magic_settings_spec.lua
+++ b/test/functional/legacy/043_magic_settings_spec.lua
@@ -1,9 +1,8 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for regexp with various magic settings.
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('regexp with magic settings', function()
setup(clear)
@@ -21,27 +20,27 @@ describe('regexp with magic settings', function()
9 foobar
]])
- execute('/^1')
- execute([[/a*b\{2}c\+/e]])
+ feed_command('/^1')
+ feed_command([[/a*b\{2}c\+/e]])
feed([[x/\Md\*e\{2}f\+/e<cr>]])
feed('x:set nomagic<cr>')
- execute([[/g\*h\{2}i\+/e]])
+ feed_command([[/g\*h\{2}i\+/e]])
feed([[x/\mj*k\{2}l\+/e<cr>]])
feed([[x/\vm*n{2}o+/e<cr>]])
feed([[x/\V^aa$<cr>]])
feed('x:set magic<cr>')
- execute([[/\v(a)(b)\2\1\1/e]])
+ feed_command([[/\v(a)(b)\2\1\1/e]])
feed([[x/\V[ab]\(\[xy]\)\1<cr>]])
feed('x:$<cr>')
- execute('set undolevels=100')
+ feed_command('set undolevels=100')
feed('dv?bar?<cr>')
feed('Yup:<cr>')
- execute('?^1?,$yank A')
+ feed_command('?^1?,$yank A')
-- Put @a and clean empty line
- execute('%d')
- execute('0put a')
- execute('$d')
+ feed_command('%d')
+ feed_command('0put a')
+ feed_command('$d')
-- Assert buffer contents.
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 c6883e4902..074ee094b4 100644
--- a/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
+++ b/test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
@@ -5,7 +5,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
-- Runs the test protocol with the given 'regexpengine' setting. In the old test
-- suite the test protocol was duplicated in test44 and test99, the only
@@ -32,19 +32,19 @@ local function run_test_with_regexpengine(regexpengine)
k combinations
l ä ö ü ᾱ̆́]])
- execute('set re=' .. regexpengine)
+ feed_command('set re=' .. regexpengine)
-- Lines 1-8. Exercise regexp search with various magic settings. On each
-- line the character on which the cursor is expected to land is deleted.
feed('/^1<cr>')
feed([[/a*b\{2}c\+/e<cr>x]])
feed([[/\Md\*e\{2}f\+/e<cr>x]])
- execute('set nomagic')
+ feed_command('set nomagic')
feed([[/g\*h\{2}i\+/e<cr>x]])
feed([[/\mj*k\{2}l\+/e<cr>x]])
feed([[/\vm*n{2}o+/e<cr>x]])
feed([[/\V^aa$<cr>x]])
- execute('set magic')
+ feed_command('set magic')
feed([[/\v(a)(b)\2\1\1/e<cr>x]])
feed([[/\V[ab]\(\[xy]\)\1<cr>x]])
@@ -57,7 +57,7 @@ local function run_test_with_regexpengine(regexpengine)
-- Line b. Find word by change of word class.
-- (The "<" character in this test step seemed to confuse our "feed" test
-- helper, which is why we've resorted to "execute" here.)
- execute([[/ち\<カヨ\>は]])
+ feed_command([[/ち\<カヨ\>は]])
feed('x')
-- Lines c-i. Test \%u, [\u], and friends.
@@ -73,28 +73,28 @@ local function run_test_with_regexpengine(regexpengine)
-- Line k. Test substitution with combining characters by executing register
-- contents.
- execute([[let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g']])
- execute('@w')
+ feed_command([[let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g']])
+ feed_command('@w')
-- Line l. Ex command ":s/ \?/ /g" should NOT split multi-byte characters
-- into bytes (fixed by vim-7.3.192).
- execute([[/^l]])
- execute([[s/ \?/ /g]])
+ feed_command([[/^l]])
+ feed_command([[s/ \?/ /g]])
-- Additional tests. Test matchstr() with multi-byte characters.
feed('G')
- execute([[put =matchstr(\"אבגד\", \".\", 0, 2)]]) -- ב
- execute([[put =matchstr(\"אבגד\", \"..\", 0, 2)]]) -- בג
- execute([[put =matchstr(\"אבגד\", \".\", 0, 0)]]) -- א
- execute([[put =matchstr(\"אבגד\", \".\", 4, -1)]]) -- ג
+ feed_command([[put =matchstr(\"אבגד\", \".\", 0, 2)]]) -- ב
+ feed_command([[put =matchstr(\"אבגד\", \"..\", 0, 2)]]) -- בג
+ feed_command([[put =matchstr(\"אבגד\", \".\", 0, 0)]]) -- א
+ feed_command([[put =matchstr(\"אבגד\", \".\", 4, -1)]]) -- ג
-- Test that a search with "/e" offset wraps around at the end of the buffer.
- execute('new')
- execute([[$put =['dog(a', 'cat('] ]])
+ feed_command('new')
+ feed_command([[$put =['dog(a', 'cat('] ]])
feed('/(/e+<cr>')
feed('"ayn')
- execute('bd!')
- execute([[$put ='']])
+ feed_command('bd!')
+ feed_command([[$put ='']])
feed('G"ap')
-- Assert buffer contents.
diff --git a/test/functional/legacy/045_folding_spec.lua b/test/functional/legacy/045_folding_spec.lua
index 5c8292c324..6ca1176aea 100644
--- a/test/functional/legacy/045_folding_spec.lua
+++ b/test/functional/legacy/045_folding_spec.lua
@@ -2,8 +2,8 @@
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, execute, expect_any =
- helpers.feed, helpers.insert, helpers.execute, helpers.expect_any
+local feed, insert, feed_command, expect_any =
+ helpers.feed, helpers.insert, helpers.feed_command, helpers.expect_any
describe('folding', function()
local screen
@@ -28,15 +28,15 @@ describe('folding', function()
-- Basic test if a fold can be created, opened, moving to the end and
-- closed.
- execute('1')
+ feed_command('1')
feed('zf2j')
- execute('call append("$", "manual " . getline(foldclosed(".")))')
+ feed_command('call append("$", "manual " . getline(foldclosed(".")))')
feed('zo')
- execute('call append("$", foldclosed("."))')
+ feed_command('call append("$", foldclosed("."))')
feed(']z')
- execute('call append("$", getline("."))')
+ feed_command('call append("$", getline("."))')
feed('zc')
- execute('call append("$", getline(foldclosed(".")))')
+ feed_command('call append("$", getline(foldclosed(".")))')
expect_any([[
manual 1 aa
@@ -52,15 +52,15 @@ describe('folding', function()
ee {{{ }}}
ff }}}
]])
- execute('set fdm=marker fdl=1')
- execute('2')
- execute('call append("$", "line 2 foldlevel=" . foldlevel("."))')
+ feed_command('set fdm=marker fdl=1')
+ feed_command('2')
+ feed_command('call append("$", "line 2 foldlevel=" . foldlevel("."))')
feed('[z')
- execute('call append("$", foldlevel("."))')
+ feed_command('call append("$", foldlevel("."))')
feed('jo{{ <esc>r{jj') -- writes '{{{' and moves 2 lines bot
- execute('call append("$", foldlevel("."))')
+ feed_command('call append("$", foldlevel("."))')
feed('kYpj')
- execute('call append("$", foldlevel("."))')
+ feed_command('call append("$", foldlevel("."))')
helpers.wait()
screen:expect([[
@@ -80,15 +80,15 @@ describe('folding', function()
it("foldmethod=indent", function()
screen:try_resize(20, 8)
- execute('set fdm=indent sw=2')
+ feed_command('set fdm=indent sw=2')
insert([[
aa
bb
cc
last
]])
- execute('call append("$", "foldlevel line3=" . foldlevel(3))')
- execute('call append("$", foldlevel(2))')
+ feed_command('call append("$", "foldlevel line3=" . foldlevel(3))')
+ feed_command('call append("$", foldlevel(2))')
feed('zR')
helpers.wait()
@@ -119,23 +119,23 @@ describe('folding', function()
a jj
b kk
last]])
- execute('set fdm=syntax fdl=0')
- execute('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
- execute('syn region Fd1 start="ee" end="ff" fold contained')
- execute('syn region Fd2 start="gg" end="hh" fold contained')
- execute('syn region Fd3 start="commentstart" end="commentend" fold contained')
+ feed_command('set fdm=syntax fdl=0')
+ feed_command('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
+ feed_command('syn region Fd1 start="ee" end="ff" fold contained')
+ feed_command('syn region Fd2 start="gg" end="hh" fold contained')
+ feed_command('syn region Fd3 start="commentstart" end="commentend" fold contained')
feed('Gzk')
- execute('call append("$", "folding " . getline("."))')
+ feed_command('call append("$", "folding " . getline("."))')
feed('k')
- execute('call append("$", getline("."))')
+ feed_command('call append("$", getline("."))')
feed('jAcommentstart <esc>Acommentend<esc>')
- execute('set fdl=1')
+ feed_command('set fdl=1')
feed('3j')
- execute('call append("$", getline("."))')
- execute('set fdl=0')
+ feed_command('call append("$", getline("."))')
+ feed_command('set fdl=0')
feed('zO<C-L>j') -- <C-L> redraws screen
- execute('call append("$", getline("."))')
- execute('set fdl=0')
+ feed_command('call append("$", getline("."))')
+ feed_command('set fdl=0')
expect_any([[
folding 9 ii
3 cc
@@ -158,7 +158,7 @@ describe('folding', function()
b kk
last ]])
- execute([[
+ feed_command([[
fun Flvl()
let l = getline(v:lnum)
if l =~ "bb$"
@@ -173,15 +173,15 @@ describe('folding', function()
return "="
endfun
]])
- execute('set fdm=expr fde=Flvl()')
- execute('/bb$')
- execute('call append("$", "expr " . foldlevel("."))')
- execute('/hh$')
- execute('call append("$", foldlevel("."))')
- execute('/ii$')
- execute('call append("$", foldlevel("."))')
- execute('/kk$')
- execute('call append("$", foldlevel("."))')
+ feed_command('set fdm=expr fde=Flvl()')
+ feed_command('/bb$')
+ feed_command('call append("$", "expr " . foldlevel("."))')
+ feed_command('/hh$')
+ feed_command('call append("$", foldlevel("."))')
+ feed_command('/ii$')
+ feed_command('call append("$", foldlevel("."))')
+ feed_command('/kk$')
+ feed_command('call append("$", foldlevel("."))')
expect_any([[
expr 2
@@ -199,11 +199,11 @@ describe('folding', function()
Test fdm=indent START
line3
line4]])
- execute('set noai nosta ')
- execute('set fdm=indent')
- execute('1m1')
+ feed_command('set noai nosta ')
+ feed_command('set fdm=indent')
+ feed_command('1m1')
feed('2jzc')
- execute('m0')
+ feed_command('m0')
feed('zR')
expect_any([[
diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/051_highlight_spec.lua
index d4d9b7d997..60d29246ff 100644
--- a/test/functional/legacy/051_highlight_spec.lua
+++ b/test/functional/legacy/051_highlight_spec.lua
@@ -1,11 +1,12 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for ":highlight".
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
+local eq = helpers.eq
local wait = helpers.wait
+local exc_exec = helpers.exc_exec
if helpers.pending_win32(pending) then return end
@@ -16,7 +17,8 @@ describe(':highlight', function()
local screen = Screen.new(35, 10)
screen:attach()
-- Basic test if ":highlight" doesn't crash
- execute('set more', 'highlight')
+ command('set more')
+ feed(':highlight<CR>')
-- FIXME(tarruda): We need to be sure the prompt is displayed before
-- continuing, or risk a race condition where some of the following input
-- is discarded resulting in test failure
@@ -34,65 +36,51 @@ describe(':highlight', function()
]])
feed('q')
wait() -- wait until we're back to normal
- execute('hi Search')
+ command('hi Search')
-- Test setting colors.
-- Test clearing one color and all doesn't generate error or warning
- execute('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan')
- execute('hi Group2 cterm=NONE')
- execute('hi Group3 cterm=bold')
- execute('redir! @a')
- execute('hi NewGroup')
- execute('hi Group2')
- execute('hi Group3')
- execute('hi clear NewGroup')
- execute('hi NewGroup')
- execute('hi Group2')
- execute('hi Group2 NONE')
- execute('hi Group2')
- execute('hi clear')
- execute('hi Group3')
- execute([[hi Crash cterm='asdf]])
- execute('redir END')
+ command('hi NewGroup cterm=italic ctermfg=DarkBlue ctermbg=Grey gui=NONE guifg=#00ff00 guibg=Cyan')
+ command('hi Group2 cterm=NONE')
+ command('hi Group3 cterm=bold')
+ command('redir! @a')
+ command('hi NewGroup')
+ command('hi Group2')
+ command('hi Group3')
+ command('hi clear NewGroup')
+ command('hi NewGroup')
+ command('hi Group2')
+ command('hi Group2 NONE')
+ command('hi Group2')
+ command('hi clear')
+ command('hi Group3')
+ eq('Vim(highlight):E475: Invalid argument: cterm=\'asdf',
+ exc_exec([[hi Crash cterm='asdf]]))
+ command('redir END')
-- Filter ctermfg and ctermbg, the numbers depend on the terminal
- execute('0put a')
- execute([[%s/ctermfg=\d*/ctermfg=2/]])
- execute([[%s/ctermbg=\d*/ctermbg=3/]])
-
- -- Filter out possibly translated error message
- execute('%s/E475: [^:]*:/E475:/')
+ command('0put a')
+ command([[%s/ctermfg=\d*/ctermfg=2/]])
+ command([[%s/ctermbg=\d*/ctermbg=3/]])
-- Fix the fileformat
- execute('set ff&')
- execute('$d')
+ command('set ff&')
+ command('$d')
-- Assert buffer contents.
expect([[
-
-
+
NewGroup xxx cterm=italic
ctermfg=2
ctermbg=3
guifg=#00ff00
guibg=Cyan
-
Group2 xxx cleared
-
Group3 xxx cterm=bold
-
-
NewGroup xxx cleared
-
Group2 xxx cleared
-
-
Group2 xxx cleared
-
-
- Group3 xxx cleared
-
- E475: cterm='asdf]])
+ Group3 xxx cleared]])
screen:detach()
end)
end)
diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
index 1f7c4dee6a..c8b9dfa98f 100644
--- a/test/functional/legacy/054_buffer_local_autocommands_spec.lua
+++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
@@ -1,33 +1,37 @@
-- Some tests for buffer-local autocommands
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
-local curbuf_contents = helpers.curbuf_contents
+
+local clear = helpers.clear
+local expect = helpers.expect
+local command = helpers.command
+
+local fname = 'Xtest-functional-legacy-054'
describe('BufLeave <buffer>', function()
setup(clear)
it('is working', function()
- execute('w! xx')
- execute('au BufLeave <buffer> norm Ibuffer-local autocommand')
- execute('au BufLeave <buffer> update')
-
+ command('write! ' .. fname)
+ command('autocmd BufLeave <buffer> normal! Ibuffer-local autocommand')
+ command('autocmd BufLeave <buffer> update')
+
-- Here, autocommand for xx shall append a line
-- But autocommand shall not apply to buffer named <buffer>
- execute('e somefile')
+ command('edit somefile')
-- Here, autocommand shall be auto-deleted
- execute('bwipe xx')
-
+ command('bwipeout ' .. fname)
+
-- Nothing shall be written
- execute('e xx')
- execute('e somefile')
- execute('e xx')
+ command('edit ' .. fname)
+ command('edit somefile')
+ command('edit ' .. fname)
- eq('buffer-local autocommand', curbuf_contents())
+ expect('buffer-local autocommand')
end)
teardown(function()
- os.remove('xx')
+ os.remove(fname)
end)
end)
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
index dbe9e1bc7f..e84c415eb0 100644
--- a/test/functional/legacy/055_list_and_dict_types_spec.lua
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -2,7 +2,7 @@
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
+local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('list and dictionary types', function()
before_each(clear)
@@ -20,7 +20,7 @@ describe('list and dictionary types', function()
$put =v:exception[:14]
endtry]])
expect([[
-
+
[1, 'as''d', [1, 2, function('strlen')], {'a': 1}]
{'a': 1}
1
@@ -38,7 +38,7 @@ describe('list and dictionary types', function()
$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')]]
@@ -84,7 +84,7 @@ describe('list and dictionary types', function()
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}]
@@ -134,7 +134,7 @@ describe('list and dictionary types', function()
unlet d[-1]
$put =string(d)]])
expect([[
-
+
[1, 'as''d', {'a': 1}]
[4]
{'1': 99, '3': 33}]])
@@ -142,42 +142,42 @@ describe('list and dictionary types', function()
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)')
+ feed_command('lang C')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[2:1]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[2:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[2:3]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[2:4]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[2:5]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-1:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-2:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-3:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-4:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-5:2]')
+ feed_command('$put =string(l)')
+ feed_command('let l = [0, 1, 2, 3]')
+ feed_command('unlet l[-6:2]')
+ feed_command('$put =string(l)')
expect([=[
-
+
[0, 1, 2, 3]
[0, 1, 3]
[0, 1]
@@ -208,7 +208,7 @@ describe('list and dictionary types', function()
$put =v:exception[:14]
endtry]])
expect([[
-
+
2
3
Vim(let):E687:
@@ -257,7 +257,7 @@ describe('list and dictionary types', function()
" Must be almost empty now.
$put =string(d)]])
expect([[
-
+
3000 2900 2001 1600 1501
Vim(let):E716: 1500
NONE 2999
@@ -277,7 +277,7 @@ describe('list and dictionary types', function()
let Fn = dict.func
call Fn('xxx')]])
expect([[
-
+
len: 3
again: 3
xxx3]])
@@ -324,7 +324,7 @@ describe('list and dictionary types', function()
let l3 = deepcopy(l2)
$put ='same list: ' . (l3[1] is l3[2])]])
expect([[
-
+
Vim(let):E698:
same list: 1]])
end)
@@ -394,7 +394,7 @@ describe('list and dictionary types', function()
endfor
endfor]=])
expect([[
-
+
depth is 0
0000-000
ppppppp
@@ -499,7 +499,7 @@ describe('list and dictionary types', function()
endfor
endfor]=])
expect([[
-
+
depth is 0
0000-000
ppppppp
@@ -647,7 +647,7 @@ describe('list and dictionary types', function()
$put =string(l)]])
expect([=[
-
+
Locks and commands or functions:
No :unlet after lock on dict:
Vim(unlet):E741:
@@ -676,7 +676,7 @@ describe('list and dictionary types', function()
end)
it('locked variables (part 2)', function()
- execute(
+ feed_command(
'let l = [1, 2, 3, 4]',
'lockvar! l',
'$put =string(l)',
@@ -691,7 +691,7 @@ describe('list and dictionary types', function()
'let l[1:2] = [0, 1]',
'$put =string(l)')
expect([=[
-
+
[1, 2, 3, 4]
[1, 2, 3, 4]
[1, 2, 3, 4]
@@ -708,7 +708,7 @@ describe('list and dictionary types', function()
$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]])
@@ -749,9 +749,9 @@ describe('list and dictionary types', function()
$put ='caught ' . v:exception
endtry
endfunction]])
- execute('call Test(1, 2, [3, 4], {5: 6})')
+ feed_command('call Test(1, 2, [3, 4], {5: 6})')
expect([=[
-
+
caught a:000
caught a:000[0]
caught a:000[2]
@@ -779,7 +779,7 @@ describe('list and dictionary types', function()
$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']
@@ -805,7 +805,7 @@ describe('list and dictionary types', function()
$put =string(split('abc', '\zs'))
$put =string(split('abc', '\zs', 1))]])
expect([=[
-
+
['aa', 'bb']
['aa', 'bb']
['', 'aa', 'bb', '']
@@ -827,7 +827,7 @@ describe('list and dictionary types', function()
$put =(l != deepcopy(l))
$put =(d != deepcopy(d))]])
expect([[
-
+
1
1
0
@@ -845,7 +845,7 @@ describe('list and dictionary types', function()
$put =(l == lcopy)
$put =(dict4 == dict4copy)]])
expect([[
-
+
1
1]])
end)
@@ -856,7 +856,7 @@ describe('list and dictionary types', function()
call extend(l, l)
$put =string(l)]])
expect([=[
-
+
[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]]=])
end)
@@ -866,7 +866,7 @@ describe('list and dictionary types', function()
call extend(d, d)
$put =string(d)]])
expect([[
-
+
{'a': {'b': 'B'}}]])
end)
@@ -881,7 +881,7 @@ describe('list and dictionary types', function()
endtry
$put =string(d)]])
expect([[
-
+
Vim(call):E737: a
{'a': {'b': 'B'}}]])
end)
@@ -892,29 +892,29 @@ describe('list and dictionary types', function()
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_command('let a = "No error caught"')
+ feed_command('try')
+ feed_command(' foldopen')
+ feed_command('catch')
+ feed_command(" let a = matchstr(v:exception,'^[^ ]*')")
+ feed_command('endtry')
feed('o<C-R>=a<CR><esc>')
- execute('lang C')
- execute('redir => a')
+ feed_command('lang C')
+ feed_command('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_command("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
+ feed_command('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
]])
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua
index 6984ad0de2..bdc2c9779c 100644
--- a/test/functional/legacy/057_sort_spec.lua
+++ b/test/functional/legacy/057_sort_spec.lua
@@ -1,9 +1,10 @@
-- Tests for :sort command.
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
+
+local insert, command, clear, expect, eq, wait = helpers.insert,
+ helpers.command, helpers.clear, helpers.expect, helpers.eq, helpers.wait
+local exc_exec = helpers.exc_exec
describe(':sort', function()
local text = [[
@@ -26,9 +27,10 @@ describe(':sort', function()
it('alphabetical', function()
insert(text)
- execute('sort')
+ wait()
+ command('sort')
expect([[
-
+
123b
a
a122
@@ -65,12 +67,13 @@ describe(':sort', function()
b321
b321b
]])
- execute('sort n')
+ wait()
+ command('sort n')
expect([[
abc
ab
a
-
+
-24
x-22
0
@@ -89,9 +92,10 @@ describe(':sort', function()
it('hexadecimal', function()
insert(text)
- execute('sort x')
+ wait()
+ command('sort x')
expect([[
-
+
a
ab
abc
@@ -110,9 +114,10 @@ describe(':sort', function()
it('alphabetical, unique', function()
insert(text)
- execute('sort u')
+ wait()
+ command('sort u')
expect([[
-
+
123b
a
a122
@@ -130,7 +135,8 @@ describe(':sort', function()
it('alphabetical, reverse', function()
insert(text)
- execute('sort!')
+ wait()
+ command('sort!')
expect([[
c321d
c123d
@@ -151,7 +157,8 @@ describe(':sort', function()
it('numerical, reverse', function()
insert(text)
- execute('sort! n')
+ wait()
+ command('sort! n')
expect([[
b322b
b321b
@@ -164,7 +171,7 @@ describe(':sort', function()
b123
a123
a122
-
+
a
ab
abc]])
@@ -172,7 +179,8 @@ describe(':sort', function()
it('unique, reverse', function()
insert(text)
- execute('sort! u')
+ wait()
+ command('sort! u')
expect([[
c321d
c123d
@@ -192,12 +200,13 @@ describe(':sort', function()
it('octal', function()
insert(text)
- execute('sort o')
+ wait()
+ command('sort o')
expect([[
abc
ab
a
-
+
a122
a123
b123
@@ -213,7 +222,8 @@ describe(':sort', function()
it('reverse, hexadecimal', function()
insert(text)
- execute('sort! x')
+ wait()
+ command('sort! x')
expect([[
c321d
c123d
@@ -234,10 +244,11 @@ describe(':sort', function()
it('alphabetical, skip first character', function()
insert(text)
- execute('sort/./')
+ wait()
+ command('sort/./')
expect([[
a
-
+
a122
a123
b123
@@ -255,11 +266,12 @@ describe(':sort', function()
it('alphabetical, skip first 2 characters', function()
insert(text)
- execute('sort/../')
+ wait()
+ command('sort/../')
expect([[
ab
a
-
+
a321
b321
b321
@@ -276,11 +288,12 @@ describe(':sort', function()
it('alphabetical, unique, skip first 2 characters', function()
insert(text)
- execute('sort/../u')
+ wait()
+ command('sort/../u')
expect([[
ab
a
-
+
a321
b321
b321b
@@ -296,12 +309,13 @@ describe(':sort', function()
it('numerical, skip first character', function()
insert(text)
- execute('sort/./n')
+ wait()
+ command('sort/./n')
expect([[
abc
ab
a
-
+
a122
a123
b123
@@ -317,9 +331,10 @@ describe(':sort', function()
it('alphabetical, sort on first character', function()
insert(text)
- execute('sort/./r')
+ wait()
+ command('sort/./r')
expect([[
-
+
123b
abc
ab
@@ -338,10 +353,11 @@ describe(':sort', function()
it('alphabetical, sort on first 2 characters', function()
insert(text)
- execute('sort/../r')
+ wait()
+ command('sort/../r')
expect([[
a
-
+
123b
a123
a122
@@ -359,7 +375,8 @@ describe(':sort', function()
it('numerical, sort on first character', function()
insert(text)
- execute('sort/./rn')
+ wait()
+ command('sort/./rn')
expect([[
abc
ab
@@ -380,12 +397,13 @@ describe(':sort', function()
it('alphabetical, skip past first digit', function()
insert(text)
- execute([[sort/\d/]])
+ wait()
+ command([[sort/\d/]])
expect([[
abc
ab
a
-
+
a321
b321
b321
@@ -401,12 +419,13 @@ describe(':sort', function()
it('alphabetical, sort on first digit', function()
insert(text)
- execute([[sort/\d/r]])
+ wait()
+ command([[sort/\d/r]])
expect([[
abc
ab
a
-
+
a123
a122
b123
@@ -422,12 +441,13 @@ describe(':sort', function()
it('numerical, skip past first digit', function()
insert(text)
- execute([[sort/\d/n]])
+ wait()
+ command([[sort/\d/n]])
expect([[
abc
ab
a
-
+
a321
b321
c321d
@@ -443,12 +463,13 @@ describe(':sort', function()
it('numerical, sort on first digit', function()
insert(text)
- execute([[sort/\d/rn]])
+ wait()
+ command([[sort/\d/rn]])
expect([[
abc
ab
a
-
+
a123
a122
b123
@@ -464,12 +485,13 @@ describe(':sort', function()
it('alphabetical, skip past first 2 digits', function()
insert(text)
- execute([[sort/\d\d/]])
+ wait()
+ command([[sort/\d\d/]])
expect([[
abc
ab
a
-
+
a321
b321
b321
@@ -485,12 +507,13 @@ describe(':sort', function()
it('numerical, skip past first 2 digits', function()
insert(text)
- execute([[sort/\d\d/n]])
+ wait()
+ command([[sort/\d\d/n]])
expect([[
abc
ab
a
-
+
a321
b321
c321d
@@ -506,12 +529,13 @@ describe(':sort', function()
it('hexadecimal, skip past first 2 digits', function()
insert(text)
- execute([[sort/\d\d/x]])
+ wait()
+ command([[sort/\d\d/x]])
expect([[
abc
ab
a
-
+
a321
b321
b321
@@ -527,12 +551,13 @@ describe(':sort', function()
it('alpha, on first 2 digits', function()
insert(text)
- execute([[sort/\d\d/r]])
+ wait()
+ command([[sort/\d\d/r]])
expect([[
abc
ab
a
-
+
a123
a122
b123
@@ -548,12 +573,13 @@ describe(':sort', function()
it('numeric, on first 2 digits', function()
insert(text)
- execute([[sort/\d\d/rn]])
+ wait()
+ command([[sort/\d\d/rn]])
expect([[
abc
ab
a
-
+
a123
a122
b123
@@ -569,12 +595,13 @@ describe(':sort', function()
it('hexadecimal, on first 2 digits', function()
insert(text)
- execute([[sort/\d\d/rx]])
+ wait()
+ command([[sort/\d\d/rx]])
expect([[
abc
ab
a
-
+
a123
a122
b123
@@ -591,13 +618,7 @@ describe(':sort', function()
it('fails with wrong arguments', function()
insert(text)
-- This should fail with "E474: Invalid argument".
- source([[
- try
- sort no
- catch
- let tmpvar = v:exception
- endtry]])
- eq('Vim(sort):E474: Invalid argument', eval('tmpvar'))
+ eq('Vim(sort):E474: Invalid argument', exc_exec('sort no'))
expect(text)
end)
@@ -617,7 +638,8 @@ describe(':sort', function()
0b100010
0b100100
0b100010]])
- execute([[sort b]])
+ wait()
+ command([[sort b]])
expect([[
0b000000
0b001000
@@ -651,7 +673,8 @@ describe(':sort', function()
0b101010
0b000000
b0b111000]])
- execute([[sort b]])
+ wait()
+ command([[sort b]])
expect([[
0b000000
a0b001000
@@ -677,7 +700,8 @@ describe(':sort', function()
1.15e-6
-1.1e3
-1.01e3]])
- execute([[sort f]])
+ wait()
+ command([[sort f]])
expect([[
-1.1e3
-1.01e3
diff --git a/test/functional/legacy/059_utf8_spell_checking_spec.lua b/test/functional/legacy/059_utf8_spell_checking_spec.lua
index 2fb8f3557d..120e469ab2 100644
--- a/test/functional/legacy/059_utf8_spell_checking_spec.lua
+++ b/test/functional/legacy/059_utf8_spell_checking_spec.lua
@@ -2,7 +2,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
local write_file, call = helpers.write_file, helpers.call
if helpers.pending_win32(pending) then return end
@@ -15,44 +15,44 @@ end
describe("spell checking with 'encoding' set to utf-8", function()
setup(function()
clear()
- execute("syntax off")
+ feed_command("syntax off")
write_latin1('Xtest1.aff',[[
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
-
+
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-
+
SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
-
+
MIDWORD '-
-
+
KEP =
RAR ?
BAD !
-
+
PFX I N 1
PFX I 0 in .
-
+
PFX O Y 1
PFX O 0 out .
-
+
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
-
+
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
-
+
REP 3
REP g ch
REP ch g
REP svp s.v.p.
-
+
MAP 9
MAP aàáâãäå
MAP eèéêë
@@ -79,39 +79,39 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest2.aff', [[
SET ISO8859-1
-
+
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-
+
PFXPOSTPONE
-
+
MIDWORD '-
-
+
KEP =
RAR ?
BAD !
-
+
PFX I N 1
PFX I 0 in .
-
+
PFX O Y 1
PFX O 0 out [a-z]
-
+
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
-
+
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
-
+
REP 3
REP g ch
REP ch g
REP svp s.v.p.
-
+
MAP 9
MAP aàáâãäå
MAP eèéêë
@@ -125,7 +125,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest3.aff', [[
SET ISO8859-1
-
+
COMPOUNDMIN 3
COMPOUNDRULE m*
NEEDCOMPOUND x
@@ -139,21 +139,21 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest4.aff', [[
SET ISO8859-1
-
+
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-
+
COMPOUNDRULE m+
COMPOUNDRULE sm*e
COMPOUNDRULE sm+
COMPOUNDMIN 3
COMPOUNDWORDMAX 3
COMPOUNDFORBIDFLAG t
-
+
COMPOUNDSYLMAX 5
SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui
-
+
MAP 9
MAP aàáâãäå
MAP eèéêë
@@ -164,23 +164,23 @@ describe("spell checking with 'encoding' set to utf-8", function()
MAP cç
MAP yÿý
MAP sß
-
+
NEEDAFFIX x
-
+
PFXPOSTPONE
-
+
MIDWORD '-
-
+
SFX q N 1
SFX q 0 -ok .
-
+
SFX a Y 2
SFX a 0 s .
SFX a 0 ize/t .
-
+
PFX p N 1
PFX p 0 pre .
-
+
PFX P N 1
PFX P 0 nou .
]])
@@ -196,28 +196,28 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest5.aff', [[
SET ISO8859-1
-
+
FLAG long
-
+
NEEDAFFIX !!
-
+
COMPOUNDRULE ssmm*ee
-
+
NEEDCOMPOUND xx
COMPOUNDPERMITFLAG pp
-
+
SFX 13 Y 1
SFX 13 0 bork .
-
+
SFX a1 Y 1
SFX a1 0 a1 .
-
+
SFX aé Y 1
SFX aé 0 aé .
-
+
PFX zz Y 1
PFX zz 0 pre/pp .
-
+
PFX yy Y 1
PFX yy 0 nou .
]])
@@ -231,26 +231,26 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest6.aff', [[
SET ISO8859-1
-
+
FLAG caplong
-
+
NEEDAFFIX A!
-
+
COMPOUNDRULE sMm*Ee
-
+
NEEDCOMPOUND Xx
-
+
COMPOUNDPERMITFLAG p
-
+
SFX N3 Y 1
SFX N3 0 bork .
-
+
SFX A1 Y 1
SFX A1 0 a1 .
-
+
SFX Aé Y 1
SFX Aé 0 aé .
-
+
PFX Zz Y 1
PFX Zz 0 pre/p .
]])
@@ -264,29 +264,29 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest7.aff', [[
SET ISO8859-1
-
+
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-
+
FLAG num
-
+
NEEDAFFIX 9999
-
+
COMPOUNDRULE 2,77*123
-
+
NEEDCOMPOUND 1
COMPOUNDPERMITFLAG 432
-
+
SFX 61003 Y 1
SFX 61003 0 meat .
-
+
SFX 391 Y 1
SFX 391 0 a1 .
-
+
SFX 111 Y 1
SFX 111 0 aé .
-
+
PFX 17 Y 1
PFX 17 0 pre/432 .
]])
@@ -300,7 +300,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
write_latin1('Xtest8.aff', [[
SET ISO8859-1
-
+
NOSPLITSUGS
]])
write_latin1('Xtest8.dic', [[
@@ -319,37 +319,37 @@ describe("spell checking with 'encoding' set to utf-8", function()
write_latin1('Xtest-sal.aff', [[
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
-
+
FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
-
+
MIDWORD '-
-
+
KEP =
RAR ?
BAD !
-
+
PFX I N 1
PFX I 0 in .
-
+
PFX O Y 1
PFX O 0 out .
-
+
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
-
+
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
-
+
REP 3
REP g ch
REP ch g
REP svp s.v.p.
-
+
MAP 9
MAP aàáâãäå
MAP eèéêë
@@ -360,7 +360,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
MAP cç
MAP yÿý
MAP sß
-
+
SAL AH(AEIOUY)-^ *H
SAL AR(AEIOUY)-^ *R
SAL A(HR)^ *
@@ -550,60 +550,60 @@ describe("spell checking with 'encoding' set to utf-8", function()
1good: wrong OK puts. Test the end
bad: inputs comment ok Ok. test déôl end the
badend
-
+
test2:
elequint test elekwint test elekwent asdf
]])
test_one(1, 1)
- execute([[$put =soundfold('goobledygoook')]])
- execute([[$put =soundfold('kóopërÿnôven')]])
- execute([[$put =soundfold('oeverloos gezwets edale')]])
+ feed_command([[$put =soundfold('goobledygoook')]])
+ feed_command([[$put =soundfold('kóopërÿnôven')]])
+ feed_command([[$put =soundfold('oeverloos gezwets edale')]])
-- And now with SAL instead of SOFO items; test automatic reloading.
os.execute('cp -f Xtest-sal.aff Xtest.aff')
- execute('mkspell! Xtest Xtest')
- execute([[$put =soundfold('goobledygoook')]])
- execute([[$put =soundfold('kóopërÿnôven')]])
- execute([[$put =soundfold('oeverloos gezwets edale')]])
+ feed_command('mkspell! Xtest Xtest')
+ feed_command([[$put =soundfold('goobledygoook')]])
+ feed_command([[$put =soundfold('kóopërÿnôven')]])
+ feed_command([[$put =soundfold('oeverloos gezwets edale')]])
-- Also use an addition file.
- execute('mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add')
- execute('set spellfile=Xtest.utf-8.add')
- execute('/^test2:')
+ feed_command('mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add')
+ feed_command('set spellfile=Xtest.utf-8.add')
+ feed_command('/^test2:')
feed(']s')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
- execute('set spl=Xtest_us.utf-8.spl')
- execute('/^test2:')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
+ feed_command('set spl=Xtest_us.utf-8.spl')
+ feed_command('/^test2:')
feed(']smm')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
feed('`m]s')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
- execute('set spl=Xtest_gb.utf-8.spl')
- execute('/^test2:')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
+ feed_command('set spl=Xtest_gb.utf-8.spl')
+ feed_command('/^test2:')
feed(']smm')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
feed('`m]s')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
- execute('set spl=Xtest_nz.utf-8.spl')
- execute('/^test2:')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
+ feed_command('set spl=Xtest_nz.utf-8.spl')
+ feed_command('/^test2:')
feed(']smm')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
feed('`m]s')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
- execute('set spl=Xtest_ca.utf-8.spl')
- execute('/^test2:')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
+ feed_command('set spl=Xtest_ca.utf-8.spl')
+ feed_command('/^test2:')
feed(']smm')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
feed('`m]s')
- execute('let [str, a] = spellbadword()')
- execute('$put =str')
- execute('1,/^test 1-1/-1d')
+ feed_command('let [str, a] = spellbadword()')
+ feed_command('$put =str')
+ feed_command('1,/^test 1-1/-1d')
expect([[
test 1-1
# file: Xtest.utf-8.spl
@@ -667,7 +667,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
]])
-- Postponed prefixes.
test_one(2, 1)
- execute('1,/^test 2-1/-1d')
+ feed_command('1,/^test 2-1/-1d')
expect([=[
test 2-1
# file: Xtest.utf-8.spl
@@ -711,13 +711,13 @@ describe("spell checking with 'encoding' set to utf-8", function()
it('part 3-3', function()
insert([[
Test rules for compounding.
-
+
3good: foo mï foobar foofoobar barfoo barbarfoo
bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
badend
]])
test_one(3, 3)
- execute('1,/^test 3-3/-1d')
+ feed_command('1,/^test 3-3/-1d')
expect([=[
test 3-3
# file: Xtest.utf-8.spl
@@ -755,7 +755,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
it('part 4-4', function()
insert([[
Tests for compounding.
-
+
4good: word util bork prebork start end wordutil wordutils pro-ok
bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
tomato tomatotomato startend startword startwordword startwordend
@@ -770,7 +770,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
badend
]])
test_one(4, 4)
- execute('1,/^test 4-4/-1d')
+ feed_command('1,/^test 4-4/-1d')
expect([=[
test 4-4
# file: Xtest.utf-8.spl
@@ -823,7 +823,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
it('part 5-5', function()
insert([[
Test affix flags with two characters
-
+
5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
start end startend startmiddleend nouend
bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
@@ -831,7 +831,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
badend
]])
test_one(5, 5)
- execute('1,/^test 5-5/-1d')
+ feed_command('1,/^test 5-5/-1d')
expect([=[
test 5-5
# file: Xtest.utf-8.spl
@@ -878,7 +878,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
badend
]])
test_one(6, 6)
- execute('1,/^test 6-6/-1d')
+ feed_command('1,/^test 6-6/-1d')
expect([=[
test 6-6
# file: Xtest.utf-8.spl
@@ -924,7 +924,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
-- Compound words.
test_one(7, 7)
-- Assert buffer contents.
- execute('1,/^test 7-7/-1d')
+ feed_command('1,/^test 7-7/-1d')
expect([=[
test 7-7
# file: Xtest.utf-8.spl
@@ -968,7 +968,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
-- NOSPLITSUGS
test_one(8, 8)
-- Assert buffer contents.
- execute('1,/^test 8-8/-1d')
+ feed_command('1,/^test 8-8/-1d')
expect([=[
test 8-8
# file: Xtest.utf-8.spl
@@ -992,7 +992,7 @@ describe("spell checking with 'encoding' set to utf-8", function()
-- NOSPLITSUGS
test_one(9, 9)
-- Assert buffer contents.
- execute('1,/^test 9-9/-1d')
+ feed_command('1,/^test 9-9/-1d')
expect([=[
test 9-9
# file: Xtest.utf-8.spl
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index aeb2001d11..1a8ef067d0 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -1,8 +1,8 @@
-- Tests for undo tree and :earlier and :later.
local helpers = require('test.functional.helpers')(after_each)
+local feed_command = helpers.feed_command
local write_file = helpers.write_file
-local execute = helpers.execute
local command = helpers.command
local source = helpers.source
local expect = helpers.expect
@@ -44,7 +44,7 @@ describe('undo tree:', function()
-- function to allow multiple attempts.
local function test_earlier_later()
clear()
- execute('e Xtest')
+ feed_command('e Xtest')
-- Assert that no undo history is present.
eq({}, eval('undotree().entries'))
-- Delete three characters and undo.
@@ -88,13 +88,13 @@ describe('undo tree:', function()
feed('Ab<esc>')
feed('Ac<esc>')
expect_line('123456abc')
- execute('earlier 1s')
+ feed_command('earlier 1s')
expect_line('123456')
- execute('earlier 3s')
+ feed_command('earlier 3s')
expect_line('123456789')
- execute('later 1s')
+ feed_command('later 1s')
expect_line('123456')
- execute('later 1h')
+ feed_command('later 1h')
expect_line('123456abc')
end
@@ -103,28 +103,28 @@ describe('undo tree:', function()
it('file-write specifications', function()
feed('ione one one<esc>')
- execute('w Xtest')
+ feed_command('w Xtest')
feed('otwo<esc>')
feed('otwo<esc>')
- execute('w')
+ feed_command('w')
feed('othree<esc>')
- execute('earlier 1f')
+ feed_command('earlier 1f')
expect([[
one one one
two
two]])
- execute('earlier 1f')
+ feed_command('earlier 1f')
expect('one one one')
- execute('earlier 1f')
+ feed_command('earlier 1f')
expect_empty_buffer()
- execute('later 1f')
+ feed_command('later 1f')
expect('one one one')
- execute('later 1f')
+ feed_command('later 1f')
expect([[
one one one
two
two]])
- execute('later 1f')
+ feed_command('later 1f')
expect([[
one one one
two
@@ -193,20 +193,20 @@ describe('undo tree:', function()
feed('ob<esc>')
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
expect([[
-
+
a
b
12034]])
feed('uu')
expect([[
-
+
a
b
1]])
feed('oc<esc>')
feed([[o1<esc>a2<C-R>=setline('.','1234')<cr><esc>]])
expect([[
-
+
a
b
1
@@ -214,16 +214,16 @@ describe('undo tree:', function()
12034]])
feed('u')
expect([[
-
+
a
b
1
c
12]])
feed('od<esc>')
- execute('so! Xtest.source')
+ feed_command('so! Xtest.source')
expect([[
-
+
a
b
1
@@ -233,7 +233,7 @@ describe('undo tree:', function()
12123]])
feed('u')
expect([[
-
+
a
b
1
@@ -246,7 +246,7 @@ describe('undo tree:', function()
-- interactive use (even in Vim; see ":help :undojoin"):
feed(normal_commands)
expect([[
-
+
a
b
1
@@ -256,7 +256,7 @@ describe('undo tree:', function()
12123]])
feed('u')
expect([[
-
+
a
b
1
diff --git a/test/functional/legacy/062_tab_pages_spec.lua b/test/functional/legacy/062_tab_pages_spec.lua
index 71a0a77354..eae0a8d51a 100644
--- a/test/functional/legacy/062_tab_pages_spec.lua
+++ b/test/functional/legacy/062_tab_pages_spec.lua
@@ -1,17 +1,18 @@
-- Tests for tab pages
local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, source, clear, execute, expect, eval, eq =
+local feed, insert, source, clear, command, expect, eval, eq =
helpers.feed, helpers.insert, helpers.source, helpers.clear,
- helpers.execute, helpers.expect, helpers.eval, helpers.eq
+ helpers.command, helpers.expect, helpers.eval, helpers.eq
+local exc_exec = helpers.exc_exec
describe('tab pages', function()
before_each(clear)
it('can be opened and closed', function()
- execute('tabnew')
+ command('tabnew')
eq(2, eval('tabpagenr()'))
- execute('quit')
+ command('quit')
eq(1, eval('tabpagenr()'))
end)
@@ -25,7 +26,7 @@ describe('tab pages', function()
tabrewind
]])
eq('this is tab page 1', eval("getline('$')"))
- execute('tablast')
+ command('tablast')
eq('this is tab page 4', eval("getline('$')"))
end)
@@ -44,7 +45,7 @@ describe('tab pages', function()
eq(100, eval('gettabvar(2, "val_num")'))
eq('SetTabVar test', eval('gettabvar(2, "val_str")'))
eq({'red', 'blue', 'green'}, eval('gettabvar(2, "val_list")'))
- execute('tabnext 2')
+ command('tabnext 2')
eq(100, eval('t:val_num'))
eq('SetTabVar test', eval('t:val_str'))
eq({'red', 'blue', 'green'}, eval('t:val_list'))
@@ -52,8 +53,8 @@ describe('tab pages', function()
it('work together with the drop feature and loaded buffers', function()
-- Test for ":tab drop exist-file" to keep current window.
- execute('sp test1')
- execute('tab drop test1')
+ command('sp test1')
+ command('tab drop test1')
eq(1, eval('tabpagenr("$")'))
eq(2, eval('winnr("$")'))
eq(1, eval('winnr()'))
@@ -61,8 +62,8 @@ describe('tab pages', function()
it('work together with the drop feature and new files', function()
-- Test for ":tab drop new-file" to keep current window of tabpage 1.
- execute('split')
- execute('tab drop newfile')
+ command('split')
+ command('tab drop newfile')
eq(2, eval('tabpagenr("$")'))
eq(2, eval('tabpagewinnr(1, "$")'))
eq(1, eval('tabpagewinnr(1)'))
@@ -71,53 +72,49 @@ describe('tab pages', function()
it('work together with the drop feature and multi loaded buffers', function()
-- Test for ":tab drop multi-opend-file" to keep current tabpage and
-- window.
- execute('new test1')
- execute('tabnew')
- execute('new test1')
- execute('tab drop test1')
+ command('new test1')
+ command('tabnew')
+ command('new test1')
+ command('tab drop test1')
eq(2, eval('tabpagenr()'))
eq(2, eval('tabpagewinnr(2, "$")'))
eq(1, eval('tabpagewinnr(2)'))
end)
it('can be navigated with :tabmove', function()
- execute('lang C')
- execute('for i in range(9) | tabnew | endfor')
+ command('lang C')
+ command('for i in range(9) | tabnew | endfor')
feed('1gt')
eq(1, eval('tabpagenr()'))
- execute('tabmove 5')
+ command('tabmove 5')
eq(5, eval('tabpagenr()'))
- execute('.tabmove')
+ command('.tabmove')
eq(5, eval('tabpagenr()'))
- execute('tabmove -')
+ command('tabmove -')
eq(4, eval('tabpagenr()'))
- execute('tabmove +')
+ command('tabmove +')
eq(5, eval('tabpagenr()'))
- execute('tabmove -2')
+ command('tabmove -2')
eq(3, eval('tabpagenr()'))
- execute('tabmove +4')
+ command('tabmove +4')
eq(7, eval('tabpagenr()'))
- execute('tabmove')
+ command('tabmove')
eq(10, eval('tabpagenr()'))
- execute('0tabmove')
+ command('0tabmove')
eq(1, eval('tabpagenr()'))
- execute('$tabmove')
+ command('$tabmove')
eq(10, eval('tabpagenr()'))
- execute('tabmove 0')
+ command('tabmove 0')
eq(1, eval('tabpagenr()'))
- execute('tabmove $')
+ command('tabmove $')
eq(10, eval('tabpagenr()'))
- execute('3tabmove')
+ command('3tabmove')
eq(4, eval('tabpagenr()'))
- execute('7tabmove 5')
+ command('7tabmove 5')
eq(5, eval('tabpagenr()'))
- execute('let a="No error caught."')
- execute('try')
- execute('tabmove foo')
- execute('catch E474')
- execute('let a="E474 caught."')
- execute('endtry')
- eq('E474 caught.', eval('a'))
+ command('let a="No error caught."')
+ eq('Vim(tabmove):E474: Invalid argument: tabmove foo',
+ exc_exec('tabmove foo'))
end)
it('can trigger certain autocommands', function()
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index 5818bb6b3a..a505a2db30 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -2,9 +2,11 @@
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
+
+local eval, clear, command = helpers.eval, helpers.clear, helpers.command
local eq, neq = helpers.eq, helpers.neq
+local insert = helpers.insert
+local redir_exec = helpers.redir_exec
describe('063: Test for ":match", "matchadd()" and related functions', function()
setup(clear)
@@ -15,12 +17,12 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
-- Check that "matcharg()" returns the correct group and pattern if a match
-- is defined.
- execute("highlight MyGroup1 term=bold ctermbg=red guibg=red")
- execute("highlight MyGroup2 term=italic ctermbg=green guibg=green")
- execute("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
- execute("match MyGroup1 /TODO/")
- execute("2match MyGroup2 /FIXME/")
- execute("3match MyGroup3 /XXX/")
+ command("highlight MyGroup1 term=bold ctermbg=red guibg=red")
+ command("highlight MyGroup2 term=italic ctermbg=green guibg=green")
+ command("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
+ command("match MyGroup1 /TODO/")
+ command("2match MyGroup2 /FIXME/")
+ command("3match MyGroup3 /XXX/")
eq({'MyGroup1', 'TODO'}, eval('matcharg(1)'))
eq({'MyGroup2', 'FIXME'}, eval('matcharg(2)'))
eq({'MyGroup3', 'XXX'}, eval('matcharg(3)'))
@@ -31,18 +33,18 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
eq({}, eval('matcharg(4)'))
-- Check that "matcharg()" returns ['', ''] if a match is not defined.
- execute("match")
- execute("2match")
- execute("3match")
+ command("match")
+ command("2match")
+ command("3match")
eq({'', ''}, eval('matcharg(1)'))
eq({'', ''}, eval('matcharg(2)'))
eq({'', ''}, eval('matcharg(3)'))
-- Check that "matchadd()" and "getmatches()" agree on added matches and
-- that default values apply.
- execute("let m1 = matchadd('MyGroup1', 'TODO')")
- execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
+ command("let m1 = matchadd('MyGroup1', 'TODO')")
+ command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
+ command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 4},
{group = 'MyGroup2', pattern = 'FIXME', priority = 42, id = 5},
{group = 'MyGroup3', pattern = 'XXX', priority = 60, id = 17}},
@@ -50,56 +52,57 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
-- Check that "matchdelete()" deletes the matches defined in the previous
-- test correctly.
- execute("call matchdelete(m1)")
- execute("call matchdelete(m2)")
- execute("call matchdelete(m3)")
+ command("call matchdelete(m1)")
+ command("call matchdelete(m2)")
+ command("call matchdelete(m3)")
eq({}, eval('getmatches()'))
--- Check that "matchdelete()" returns 0 if successful and otherwise -1.
- execute("let m = matchadd('MyGroup1', 'TODO')")
+ command("let m = matchadd('MyGroup1', 'TODO')")
eq(0, eval('matchdelete(m)'))
-- matchdelete throws error and returns -1 on failure
neq(true, pcall(function() eval('matchdelete(42)') end))
- execute("let r2 = matchdelete(42)")
+ eq('\nE803: ID not found: 42',
+ redir_exec("let r2 = matchdelete(42)"))
eq(-1, eval('r2'))
-- Check that "clearmatches()" clears all matches defined by ":match" and
-- "matchadd()".
- execute("let m1 = matchadd('MyGroup1', 'TODO')")
- execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
- execute("match MyGroup1 /COFFEE/")
- execute("2match MyGroup2 /HUMPPA/")
- execute("3match MyGroup3 /VIM/")
- execute("call clearmatches()")
+ command("let m1 = matchadd('MyGroup1', 'TODO')")
+ command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
+ command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
+ command("match MyGroup1 /COFFEE/")
+ command("2match MyGroup2 /HUMPPA/")
+ command("3match MyGroup3 /VIM/")
+ command("call clearmatches()")
eq({}, eval('getmatches()'))
-- Check that "setmatches()" restores a list of matches saved by
-- "getmatches()" without changes. (Matches with equal priority must also
-- remain in the same order.)
- execute("let m1 = matchadd('MyGroup1', 'TODO')")
- execute("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- execute("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
- execute("match MyGroup1 /COFFEE/")
- execute("2match MyGroup2 /HUMPPA/")
- execute("3match MyGroup3 /VIM/")
- execute("let ml = getmatches()")
+ command("let m1 = matchadd('MyGroup1', 'TODO')")
+ command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
+ command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
+ command("match MyGroup1 /COFFEE/")
+ command("2match MyGroup2 /HUMPPA/")
+ command("3match MyGroup3 /VIM/")
+ command("let ml = getmatches()")
local ml = eval("ml")
- execute("call clearmatches()")
- execute("call setmatches(ml)")
+ command("call clearmatches()")
+ command("call setmatches(ml)")
eq(ml, eval('getmatches()'))
-- Check that "setmatches()" can correctly restore the matches from matchaddpos()
- execute("call clearmatches()")
- execute("call setmatches(ml)")
+ command("call clearmatches()")
+ command("call setmatches(ml)")
eq(ml, eval('getmatches()'))
-- Check that "setmatches()" will not add two matches with the same ID. The
-- expected behaviour (for now) is to add the first match but not the
-- second and to return -1.
- execute("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])")
- feed("<cr>")
+ eq('\nE801: ID already taken: 1',
+ redir_exec("let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])"))
eq(-1, eval("r1"))
eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 1}}, eval('getmatches()'))
@@ -108,18 +111,17 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
-- return values.)
eq(0,eval("setmatches([])"))
eq(0,eval("setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])"))
- execute("call clearmatches()")
- execute("let rf1 = setmatches(0)")
+ command("call clearmatches()")
+ eq('\nE714: List required', redir_exec("let rf1 = setmatches(0)"))
eq(-1, eval('rf1'))
- execute("let rf2 = setmatches([0])")
+ eq('\nE474: Invalid argument', redir_exec("let rf2 = setmatches([0])"))
eq(-1, eval('rf2'))
- execute("let rf3 = setmatches([{'wrong key': 'wrong value'}])")
- feed("<cr>")
+ eq('\nE474: Invalid argument', redir_exec("let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
eq(-1, eval('rf3'))
-- Check that "matchaddpos()" positions matches correctly
insert('abcdefghijklmnopq')
- execute("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
+ command("call matchaddpos('MyGroup1', [[1, 5], [1, 8, 3]], 10, 3)")
screen:expect([[
abcd{1:e}fg{1:hij}klmnop^q |
~ |
@@ -128,9 +130,9 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
|
]], {[1] = {background = Screen.colors.Red}}, {{bold = true, foreground = Screen.colors.Blue}})
- execute("call clearmatches()")
- execute("call setline(1, 'abcdΣabcdef')")
- execute("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
+ command("call clearmatches()")
+ command("call setline(1, 'abcdΣabcdef')")
+ command("call matchaddpos('MyGroup1', [[1, 4, 2], [1, 9, 2]])")
screen:expect([[
abc{1:dΣ}ab{1:cd}e^f |
~ |
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 d12ea502f3..ad1b004085 100644
--- a/test/functional/legacy/065_float_and_logic_operators_spec.lua
+++ b/test/functional/legacy/065_float_and_logic_operators_spec.lua
@@ -2,7 +2,7 @@
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
+local clear, expect = helpers.clear, helpers.expect
describe('floating point and logical operators', function()
setup(clear)
@@ -44,14 +44,7 @@ describe('floating point and logical operators', function()
$put ='abs'
$put =printf('%d', abs(1456))
$put =printf('%d', abs(-4))
- ]])
-
- -- The test will throw an error if this line is included in a source()
- -- call. The vim expression throws a exception "E745: Using a List as a
- -- Number" which is fatal in a source() call but not in a execute() call.
- execute([[$put =printf('%d', abs([1, 2, 3]))]])
-
- source([[
+ silent! $put =printf('%d', abs([1, 2, 3]))
$put =printf('%g', abs(14.56))
$put =printf('%g', abs(-54.32))
$put ='ceil'
@@ -100,12 +93,9 @@ describe('floating point and logical operators', function()
$put =and(invert(127), 65535)
$put =and(invert(16), 65535)
$put =and(invert(128), 65535)
+ silent! $put =invert(1.0)
]])
- -- This line can not be included in a source() call. It throws a "E805:
- -- Using a Float as a Number". Also compare comment above.
- execute('$put =invert(1.0)')
-
-- Assert buffer contents.
expect([=[
Results of test65:
diff --git a/test/functional/legacy/066_visual_block_tab_spec.lua b/test/functional/legacy/066_visual_block_tab_spec.lua
index 72fa7d881b..7c4984362f 100644
--- a/test/functional/legacy/066_visual_block_tab_spec.lua
+++ b/test/functional/legacy/066_visual_block_tab_spec.lua
@@ -3,7 +3,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('visual block shift and tab characters', function()
setup(clear)
@@ -24,23 +24,23 @@ describe('visual block shift and tab characters', function()
feed('gg')
feed([[fe<C-v>4jR<esc>ugvr1:'<lt>,'>yank A<cr>]])
- execute('/^abcdefgh')
+ feed_command('/^abcdefgh')
feed('<C-v>4jI <esc>j<lt><lt>11|D')
feed('j7|a <esc>')
feed('j7|a <esc>')
feed('j7|a <esc>4k13|<C-v>4j<lt>')
- execute('$-5,$yank A')
- execute([[$-4,$s/\s\+//g]])
+ feed_command('$-5,$yank A')
+ feed_command([[$-4,$s/\s\+//g]])
feed('<C-v>4kI <esc>j<lt><lt>')
feed('j7|a <esc>')
feed('j7|a <esc>')
feed('j7|a <esc>4k13|<C-v>4j3<lt>')
- execute('$-4,$yank A')
+ feed_command('$-4,$yank A')
-- Put @a and clean empty lines
- execute('%d')
- execute('0put a')
- execute('$d')
+ feed_command('%d')
+ feed_command('0put a')
+ feed_command('$d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/067_augroup_exists_spec.lua b/test/functional/legacy/067_augroup_exists_spec.lua
index 8f6b881ed8..4a77bf838a 100644
--- a/test/functional/legacy/067_augroup_exists_spec.lua
+++ b/test/functional/legacy/067_augroup_exists_spec.lua
@@ -3,32 +3,34 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
describe('augroup when calling exists()', function()
setup(clear)
it('is working', function()
- execute('let results=[]')
- execute('call add(results, "##BufEnter: " . exists("##BufEnter"))')
- execute('call add(results, "#BufEnter: " . exists("#BufEnter"))')
- execute('au BufEnter * let g:entered=1')
- execute('call add(results, "#BufEnter: " . exists("#BufEnter"))')
- execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
- execute('augroup auexists', 'au BufEnter * let g:entered=1', 'augroup END')
- execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
- execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
- execute('au BufEnter *.test let g:entered=1')
- execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
- execute('edit testfile.test')
- execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
- execute('au BufEnter <buffer> let g:entered=1')
- execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
- execute('edit testfile2.test')
- execute('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
- execute('bf')
- execute('call append(0, results)')
- execute('$d')
+ command('let results=[]')
+ command('call add(results, "##BufEnter: " . exists("##BufEnter"))')
+ command('call add(results, "#BufEnter: " . exists("#BufEnter"))')
+ command('au BufEnter * let g:entered=1')
+ command('call add(results, "#BufEnter: " . exists("#BufEnter"))')
+ command('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
+ command('augroup auexists')
+ command('au BufEnter * let g:entered=1')
+ command('augroup END')
+ command('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))')
+ command('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
+ command('au BufEnter *.test let g:entered=1')
+ command('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))')
+ command('edit testfile.test')
+ command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
+ command('au BufEnter <buffer> let g:entered=1')
+ command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
+ command('edit testfile2.test')
+ command('call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))')
+ command('bf')
+ command('call append(0, results)')
+ command('$d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/068_text_formatting_spec.lua b/test/functional/legacy/068_text_formatting_spec.lua
index e232e5073d..772dbc14cf 100644
--- a/test/functional/legacy/068_text_formatting_spec.lua
+++ b/test/functional/legacy/068_text_formatting_spec.lua
@@ -3,7 +3,7 @@ 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 feed_command = helpers.feed_command
local expect = helpers.expect
describe('text formatting', function()
@@ -15,195 +15,195 @@ describe('text formatting', function()
-- mode so it has to be escaped with <C-V>.
insert([[
Results of test68:
-
-
+
+
{
-
-
+
+
}
-
-
+
+
{
a b
-
+
a
}
-
-
+
+
{
a 
}
-
-
+
+
{
a b
#a b
}
-
-
+
+
{
1 a
# 1 a
}
-
-
+
+
{
-
+
x a
b
c
-
+
}
-
-
+
+
{
# 1 a b
}
-
-
+
+
{
# x
# a b
}
-
-
+
+
{
1aa
2bb
}
-
-
+
+
/* abc def ghi jkl
* mno pqr stu
*/
-
-
+
+
# 1 xxxxx
]])
- execute('/^{/+1')
- execute('set noai tw=2 fo=t')
+ feed_command('/^{/+1')
+ feed_command('set noai tw=2 fo=t')
feed('gRa b<esc>')
- execute('/^{/+1')
- execute('set ai tw=2 fo=tw')
+ feed_command('/^{/+1')
+ feed_command('set ai tw=2 fo=tw')
feed('gqgqjjllab<esc>')
- execute('/^{/+1')
- execute('set tw=3 fo=t')
+ feed_command('/^{/+1')
+ feed_command('set tw=3 fo=t')
feed('gqgqo<cr>')
feed('a <C-V><C-A><esc><esc>')
- execute('/^{/+1')
- execute('set tw=2 fo=tcq1 comments=:#')
+ feed_command('/^{/+1')
+ feed_command('set tw=2 fo=tcq1 comments=:#')
feed('gqgqjgqgqo<cr>')
feed('a b<cr>')
feed('#a b<esc>')
- execute('/^{/+1')
- execute('set tw=5 fo=tcn comments=:#')
+ feed_command('/^{/+1')
+ feed_command('set tw=5 fo=tcn comments=:#')
feed('A b<esc>jA b<esc>')
- execute('/^{/+3')
- execute('set tw=5 fo=t2a si')
+ feed_command('/^{/+3')
+ feed_command('set tw=5 fo=t2a si')
feed('i <esc>A_<esc>')
- execute('/^{/+1')
- execute('set tw=5 fo=qn comments=:#')
+ feed_command('/^{/+1')
+ feed_command('set tw=5 fo=qn comments=:#')
feed('gwap<cr>')
- execute('/^{/+1')
- execute('set tw=5 fo=q2 comments=:#')
+ feed_command('/^{/+1')
+ feed_command('set tw=5 fo=q2 comments=:#')
feed('gwap<cr>')
- execute('/^{/+2')
- execute('set tw& fo=a')
+ feed_command('/^{/+2')
+ feed_command('set tw& fo=a')
feed('I^^<esc><esc>')
- execute('/mno pqr/')
- execute('setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/')
+ feed_command('/mno pqr/')
+ feed_command('setl tw=20 fo=an12wcq comments=s1:/*,mb:*,ex:*/')
feed('A vwx yz<esc>')
- execute('/^#/')
- execute('setl tw=12 fo=tqnc comments=:#')
+ feed_command('/^#/')
+ feed_command('setl tw=12 fo=tqnc comments=:#')
feed('A foobar<esc>')
-- Assert buffer contents.
expect([[
Results of test68:
-
-
+
+
{
a
b
}
-
-
+
+
{
a
b
-
+
a
b
}
-
-
+
+
{
a

-
+
a

}
-
-
+
+
{
a b
#a b
-
+
a b
#a b
}
-
-
+
+
{
1 a
b
# 1 a
# b
}
-
-
+
+
{
-
+
x a
b_
c
-
+
}
-
-
+
+
{
# 1 a
# b
}
-
-
+
+
{
# x a
# b
}
-
-
+
+
{ 1aa ^^2bb }
-
-
+
+
/* abc def ghi jkl
* mno pqr stu
* vwx yz
*/
-
-
+
+
# 1 xxxxx
# foobar
]])
diff --git a/test/functional/legacy/069_multibyte_formatting_spec.lua b/test/functional/legacy/069_multibyte_formatting_spec.lua
index 6edcd8b7f2..38ca25d57a 100644
--- a/test/functional/legacy/069_multibyte_formatting_spec.lua
+++ b/test/functional/legacy/069_multibyte_formatting_spec.lua
@@ -4,8 +4,8 @@
-- Also test byteidx() and byteidxcomp()
local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, eq, eval, clear, execute, expect = helpers.feed,
- helpers.insert, helpers.eq, helpers.eval, helpers.clear, helpers.execute,
+local feed, insert, eq, eval, clear, feed_command, expect = helpers.feed,
+ helpers.insert, helpers.eq, helpers.eval, helpers.clear, helpers.feed_command,
helpers.expect
describe('multibyte text', function()
@@ -17,8 +17,8 @@ describe('multibyte text', function()
XYZ
abc XYZ
}]])
- execute('/^{/+1')
- execute('set tw=2 fo=t')
+ feed_command('/^{/+1')
+ feed_command('set tw=2 fo=t')
feed('gqgqjgqgqo<cr>')
feed('XYZ<cr>')
feed('abc XYZ<esc><esc>')
@@ -43,8 +43,8 @@ describe('multibyte text', function()
XY
X Y
}]])
- execute('/^{/+1')
- execute('set tw=1 fo=tm')
+ feed_command('/^{/+1')
+ feed_command('set tw=1 fo=tm')
feed('gqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
feed('X<cr>')
feed('Xa<cr>')
@@ -89,8 +89,8 @@ describe('multibyte text', function()
abX c
abXY
}]])
- execute('/^{/+1')
- execute('set tw=2 fo=tm')
+ feed_command('/^{/+1')
+ feed_command('set tw=2 fo=tm')
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
feed('X<cr>')
feed('Xa<cr>')
@@ -156,8 +156,8 @@ describe('multibyte text', function()
Xa
}]])
- execute('/^{/+1')
- execute('set ai tw=2 fo=tm')
+ feed_command('/^{/+1')
+ feed_command('set ai tw=2 fo=tm')
feed('gqgqjgqgqo<cr>')
feed('X<cr>')
feed('Xa<esc>')
@@ -179,8 +179,8 @@ describe('multibyte text', function()
Xa
}]])
- execute('/^{/+1')
- execute('set noai tw=2 fo=tm')
+ feed_command('/^{/+1')
+ feed_command('set noai tw=2 fo=tm')
feed('gqgqjgqgqo<cr>')
-- Literal spaces will be trimmed from the by feed().
feed('<space><space>X<cr>')
@@ -211,8 +211,8 @@ describe('multibyte text', function()
XXa
XXY
}]])
- execute('/^{/+1')
- execute('set tw=2 fo=cqm comments=n:X')
+ feed_command('/^{/+1')
+ feed_command('set tw=2 fo=cqm comments=n:X')
feed('gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo<cr>')
feed('X<cr>')
feed('Xa<cr>')
@@ -261,8 +261,8 @@ describe('multibyte text', function()
{
}]])
- execute('/^{/+1')
- execute('set tw=2 fo=tm')
+ feed_command('/^{/+1')
+ feed_command('set tw=2 fo=tm')
feed('RXa<esc>')
expect([[
{
@@ -276,8 +276,8 @@ describe('multibyte text', function()
{
‘ two three ’ four
}]])
- execute('/^{/+1')
- execute('set mps+=‘:’')
+ feed_command('/^{/+1')
+ feed_command('set mps+=‘:’')
feed('d%<cr>')
expect([[
{
@@ -299,8 +299,8 @@ describe('multibyte text', function()
insert([[
á
x]])
- execute('set whichwrap+=h')
- execute('/^x')
+ feed_command('set whichwrap+=h')
+ feed_command('/^x')
feed('dh')
expect([[
áx]])
@@ -308,9 +308,9 @@ describe('multibyte text', function()
it('can be queried with byteidx() and byteidxcomp()', function()
-- One char of two bytes.
- execute("let a = '.é.'")
+ feed_command("let a = '.é.'")
-- Normal e with composing char.
- execute("let b = '.é.'")
+ feed_command("let b = '.é.'")
eq(0, eval('byteidx(a, 0)'))
eq(1, eval('byteidx(a, 1)'))
eq(3, eval('byteidx(a, 2)'))
diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua
index 4682a82008..b4927e779e 100644
--- a/test/functional/legacy/072_undo_file_spec.lua
+++ b/test/functional/legacy/072_undo_file_spec.lua
@@ -4,7 +4,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('72', function()
setup(clear)
@@ -13,34 +13,34 @@ describe('72', function()
insert([[
1111 -----
2222 -----
-
+
123456789]])
-- Test 'undofile': first a simple one-line change.
- execute('set visualbell')
- execute('set ul=100 undofile undodir=. nomore')
- execute('e! Xtestfile')
+ feed_command('set visualbell')
+ feed_command('set ul=100 undofile undodir=. nomore')
+ feed_command('e! Xtestfile')
feed('ggdGithis is one line<esc>:set ul=100<cr>')
- execute('s/one/ONE/')
- execute('set ul=100')
- execute('w')
- execute('bwipe!')
- execute('e Xtestfile')
+ feed_command('s/one/ONE/')
+ feed_command('set ul=100')
+ feed_command('w')
+ feed_command('bwipe!')
+ feed_command('e Xtestfile')
feed('u:.w! test.out<cr>')
-- Test 'undofile', change in original file fails check.
- execute('set noundofile')
- execute('e! Xtestfile')
- execute('s/line/Line/')
- execute('w')
- execute('set undofile')
- execute('bwipe!')
- execute('e Xtestfile')
+ feed_command('set noundofile')
+ feed_command('e! Xtestfile')
+ feed_command('s/line/Line/')
+ feed_command('w')
+ feed_command('set undofile')
+ feed_command('bwipe!')
+ feed_command('e Xtestfile')
---- TODO: this beeps.
feed('u:.w >>test.out<cr>')
-- Test 'undofile', add 10 lines, delete 6 lines, undo 3.
- execute('set undofile')
+ feed_command('set undofile')
feed('ggdGione<cr>')
feed('two<cr>')
feed('three<cr>')
@@ -57,20 +57,20 @@ describe('72', function()
feed('dd:set ul=100<cr>')
feed('dd:set ul=100<cr>')
feed('dd:set ul=100<cr>')
- execute('w')
- execute('bwipe!')
- execute('e Xtestfile')
+ feed_command('w')
+ feed_command('bwipe!')
+ feed_command('e Xtestfile')
feed('uuu:w >>test.out<cr>')
-- Test that reading the undofiles when setting undofile works.
- execute('set noundofile ul=0')
+ feed_command('set noundofile ul=0')
feed('i<cr>')
feed('<esc>u:e! Xtestfile<cr>')
- execute('set undofile ul=100')
+ feed_command('set undofile ul=100')
feed('uuuuuu:w >>test.out<cr>')
---- Open the output to see if it meets the expections
- execute('e! test.out')
+ feed_command('e! test.out')
-- Assert buffer contents.
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 e8292db8c1..e17b463e30 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -2,8 +2,8 @@
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,
+local clear, command, eq, neq, eval, wait, spawn =
+ helpers.clear, helpers.command, helpers.eq, helpers.neq, helpers.eval,
helpers.wait, helpers.spawn
describe('storing global variables in ShaDa files', function()
@@ -26,31 +26,29 @@ describe('storing global variables in ShaDa files', function()
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
- execute(
- -- This will cause a few errors, do it silently.
- 'set visualbell',
- 'set shada+=!',
- "let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
- -- Store a really long list. Initially this was testing line wrapping in
- -- viminfo, but shada files has no line wrapping, no matter how long the
- -- list is.
- 'let MY_GLOBAL_LIST=range(1,100)'
- )
+ command('set visualbell')
+ command('set shada+=!')
+ command('let MY_GLOBAL_DICT={\'foo\': 1, \'bar\': 0, \'longvarible\': 1000}')
+ -- Store a really long list. Initially this was testing line wrapping in
+ -- viminfo, but shada files has no line wrapping, no matter how long the
+ -- list is.
+ command('let MY_GLOBAL_LIST=range(1, 100)')
+
eq(test_dict, eval('MY_GLOBAL_DICT'))
eq(test_list, eval('MY_GLOBAL_LIST'))
- execute('wsh! ' .. tempname)
+ command('wsh! ' .. tempname)
wait()
-- Assert that the shada file exists.
neq(nil, lfs.attributes(tempname))
- execute('unlet MY_GLOBAL_DICT',
- 'unlet MY_GLOBAL_LIST')
+ command('unlet MY_GLOBAL_DICT')
+ command('unlet MY_GLOBAL_LIST')
-- Assert that the variables where deleted.
eq(0, eval('exists("MY_GLOBAL_DICT")'))
eq(0, eval('exists("MY_GLOBAL_LIST")'))
- execute('rsh! ' .. tempname)
+ command('rsh! ' .. tempname)
eq(test_list, eval('MY_GLOBAL_LIST'))
eq(test_dict, eval('MY_GLOBAL_DICT'))
diff --git a/test/functional/legacy/075_maparg_spec.lua b/test/functional/legacy/075_maparg_spec.lua
index e9d2acdaf5..fcfd33ec46 100644
--- a/test/functional/legacy/075_maparg_spec.lua
+++ b/test/functional/legacy/075_maparg_spec.lua
@@ -3,46 +3,48 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe('maparg()', function()
setup(clear)
it('is working', function()
- execute('set cpo-=<')
+ command('set cpo-=<')
-- Test maparg() with a string result
- execute('map foo<C-V> is<F4>foo')
- execute('vnoremap <script> <buffer> <expr> <silent> bar isbar')
- execute([[call append('$', maparg('foo<C-V>'))]])
- execute([[call append('$', string(maparg('foo<C-V>', '', 0, 1)))]])
- execute([[call append('$', string(maparg('bar', '', 0, 1)))]])
- execute('map <buffer> <nowait> foo bar')
- execute([[call append('$', string(maparg('foo', '', 0, 1)))]])
- execute('map abc x<char-114>x')
- execute([[call append('$', maparg('abc'))]])
- execute('map abc y<S-char-114>y')
- execute([[call append('$', maparg('abc'))]])
+ command('map foo<C-V> is<F4>foo')
+ command('vnoremap <script> <buffer> <expr> <silent> bar isbar')
+ command([[call append('$', maparg('foo<C-V>'))]])
+ command([[call append('$', string(maparg('foo<C-V>', '', 0, 1)))]])
+ command([[call append('$', string(maparg('bar', '', 0, 1)))]])
+ command('map <buffer> <nowait> foo bar')
+ command([[call append('$', string(maparg('foo', '', 0, 1)))]])
+ command('map abc x<char-114>x')
+ command([[call append('$', maparg('abc'))]])
+ command('map abc y<S-char-114>y')
+ command([[call append('$', maparg('abc'))]])
feed('Go<esc>:<cr>')
+ wait()
-- Outside of the range, minimum
- execute('inoremap <Char-0x1040> a')
- execute([[execute "normal a\u1040\<Esc>"]])
+ command('inoremap <Char-0x1040> a')
+ command([[execute "normal a\u1040\<Esc>"]])
-- Inside of the range, minimum
- execute('inoremap <Char-0x103f> b')
- execute([[execute "normal a\u103f\<Esc>"]])
+ command('inoremap <Char-0x103f> b')
+ command([[execute "normal a\u103f\<Esc>"]])
-- Inside of the range, maximum
- execute('inoremap <Char-0xf03f> c')
- execute([[execute "normal a\uf03f\<Esc>"]])
+ command('inoremap <Char-0xf03f> c')
+ command([[execute "normal a\uf03f\<Esc>"]])
-- Outside of the range, maximum
- execute('inoremap <Char-0xf040> d')
- execute([[execute "normal a\uf040\<Esc>"]])
+ command('inoremap <Char-0xf040> d')
+ command([[execute "normal a\uf040\<Esc>"]])
-- Remove empty line
- execute('1d')
+ command('1d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/077_mf_hash_grow_spec.lua b/test/functional/legacy/077_mf_hash_grow_spec.lua
index b43263300d..c692127213 100644
--- a/test/functional/legacy/077_mf_hash_grow_spec.lua
+++ b/test/functional/legacy/077_mf_hash_grow_spec.lua
@@ -7,8 +7,12 @@
-- If it isn't available then the test will be skipped.
local helpers = require('test.functional.helpers')(after_each)
+
local feed = helpers.feed
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local wait = helpers.wait
+local clear = helpers.clear
+local expect = helpers.expect
+local command = helpers.command
describe('mf_hash_grow()', function()
setup(clear)
@@ -18,19 +22,21 @@ describe('mf_hash_grow()', function()
pending('was not tested because cksum was not found', function() end)
else
it('is working', function()
- execute('set fileformat=unix undolevels=-1')
+ command('set fileformat=unix undolevels=-1')
-- Fill the buffer with numbers 1 - 2000000
- execute('let i = 1')
- execute('while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile')
+ command('let i = 1')
+ command('while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile')
-- Delete empty first line, save to Xtest, and clear buffer
feed('ggdd<cr>')
- execute('w! Xtest')
+ wait()
+ command('w! Xtest')
feed('ggdG<cr>')
+ wait()
-- Calculate the cksum of Xtest and delete first line
- execute('r !cksum Xtest')
+ command('r !cksum Xtest')
feed('ggdd<cr>')
-- Assert correct output of cksum.
diff --git a/test/functional/legacy/080_substitute_spec.lua b/test/functional/legacy/080_substitute_spec.lua
index 6b4d82a4c0..faeb61e3af 100644
--- a/test/functional/legacy/080_substitute_spec.lua
+++ b/test/functional/legacy/080_substitute_spec.lua
@@ -4,7 +4,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
local eq, eval = helpers.eq, helpers.eval
describe('substitue()', function()
@@ -46,17 +46,17 @@ describe('substitue()', function()
end
it('with "set magic" (TEST_1)', function()
- execute('set magic')
+ feed_command('set magic')
test_1_and_2()
end)
it('with "set nomagic" (TEST_2)', function()
- execute('set nomagic')
+ feed_command('set nomagic')
test_1_and_2()
end)
it('with sub-replace-expression (TEST_3)', function()
- execute('set magic&')
+ feed_command('set magic&')
eq('a\\a', eval([[substitute('aAa', 'A', '\="\\"', '')]]))
eq('b\\\\b', eval([[substitute('bBb', 'B', '\="\\\\"', '')]]))
eq('c\rc', eval([[substitute('cCc', 'C', '\="]]..'\r'..[["', '')]]))
@@ -70,7 +70,7 @@ describe('substitue()', function()
end)
it('with submatch() (TEST_4)', function()
- execute('set magic&')
+ feed_command('set magic&')
eq('a\\a', eval([[substitute('aAa', 'A', ]] ..
[['\=substitute(submatch(0), ".", "\\", "")', '')]]))
eq('b\\b', eval([[substitute('bBb', 'B', ]] ..
@@ -92,7 +92,7 @@ describe('substitue()', function()
end)
it('with submatch() (TEST_5)', function()
- execute('set magic&')
+ feed_command('set magic&')
eq('A123456789987654321', eval([[substitute('A123456789', ]] ..
[['A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', ]] ..
[['\=submatch(0) . submatch(9) . submatch(8) . submatch(7) . ]] ..
@@ -110,7 +110,7 @@ describe('substitue()', function()
-- #2943.
it('with submatch or \\ze (TEST_7)', function()
- execute('set magic&')
+ feed_command('set magic&')
eq('A\rA', eval("substitute('A\rA', 'A.', '\\=submatch(0)', '')"))
eq('B\nB', eval([[substitute("B\nB", 'B.', '\=submatch(0)', '')]]))
eq("['B\n']B",
@@ -120,7 +120,7 @@ describe('substitue()', function()
end)
it('with \\zs and \\ze (TEST_10)', function()
- execute('set magic&')
+ feed_command('set magic&')
eq('a1a2a3a', eval([[substitute('123', '\zs', 'a', 'g')]]))
eq('aaa', eval([[substitute('123', '\zs.', 'a', 'g')]]))
eq('1a2a3a', eval([[substitute('123', '.\zs', 'a', 'g')]]))
@@ -140,11 +140,11 @@ describe(':substitue', function()
,,X
,,Y
,,Z]])
- execute('set magic&')
- execute([[1s/\(^\|,\)\ze\(,\|X\)/\1N/g]])
- execute([[2s/\(^\|,\)\ze\(,\|Y\)/\1N/gc]])
+ feed_command('set magic&')
+ feed_command([[1s/\(^\|,\)\ze\(,\|X\)/\1N/g]])
+ feed_command([[2s/\(^\|,\)\ze\(,\|Y\)/\1N/gc]])
feed('a') -- For the dialog of the previous :s command.
- execute([[3s/\(^\|,\)\ze\(,\|Z\)/\1N/gc]])
+ feed_command([[3s/\(^\|,\)\ze\(,\|Z\)/\1N/gc]])
feed('yy') -- For the dialog of the previous :s command.
expect([[
N,,NX
@@ -154,8 +154,8 @@ describe(':substitue', function()
it('with confirmation dialog (TEST_9)', function()
insert('xxx')
- execute('set magic&')
- execute('s/x/X/gc')
+ feed_command('set magic&')
+ feed_command('s/x/X/gc')
feed('yyq') -- For the dialog of the previous :s command.
expect('XXx')
end)
diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua
index 2ac1332687..993aff2ba2 100644
--- a/test/functional/legacy/081_coptions_movement_spec.lua
+++ b/test/functional/legacy/081_coptions_movement_spec.lua
@@ -2,7 +2,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('coptions', function()
setup(clear)
@@ -16,18 +16,18 @@ describe('coptions', function()
ccc two three four
ddd yee yoo four]])
- execute('set cpo-=;')
+ feed_command('set cpo-=;')
feed('gg0tt;D')
feed('j0fz;D')
feed('j$Fy;D')
feed('j$Ty;D')
- execute('set cpo+=;')
+ feed_command('set cpo+=;')
feed('j0tt;;D')
feed('j$Ty;;D')
-
+
expect([[
aaa two
z
diff --git a/test/functional/legacy/082_string_comparison_spec.lua b/test/functional/legacy/082_string_comparison_spec.lua
index d6f3c45e1f..cfc0b96bce 100644
--- a/test/functional/legacy/082_string_comparison_spec.lua
+++ b/test/functional/legacy/082_string_comparison_spec.lua
@@ -3,7 +3,7 @@
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
+local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('case-insensitive string comparison in UTF-8', function()
setup(clear)
@@ -106,11 +106,11 @@ describe('case-insensitive string comparison in UTF-8', function()
]])
-- Test that g~ap changes one paragraph only.
- execute('new')
+ feed_command('new')
feed('iabcd<cr><cr>defg<esc>gg0g~ap')
- execute('let lns = getline(1,3)')
- execute('q!')
- execute([[call append(line('$'), lns)]])
+ feed_command('let lns = getline(1,3)')
+ feed_command('q!')
+ feed_command([[call append(line('$'), lns)]])
-- Assert buffer contents.
expect([=[
diff --git a/test/functional/legacy/084_curswant_spec.lua b/test/functional/legacy/084_curswant_spec.lua
index 818914eeb9..9809ce5b88 100644
--- a/test/functional/legacy/084_curswant_spec.lua
+++ b/test/functional/legacy/084_curswant_spec.lua
@@ -25,7 +25,7 @@ describe('curswant', function()
let curswant_after = winsaveview().curswant
return [a:option_name, curswant_before, curswant_after]
endfunction
-
+
new
put =['1234567890', '12345']
1 delete _
@@ -33,7 +33,7 @@ describe('curswant', function()
for option_name in target_option_names
call add(result, TestCurswant(option_name))
endfor
-
+
new
put =map(copy(result), 'join(v:val, '' '')')
1 delete _
diff --git a/test/functional/legacy/088_conceal_tabs_spec.lua b/test/functional/legacy/088_conceal_tabs_spec.lua
index 00e7312bf8..c9414679ab 100644
--- a/test/functional/legacy/088_conceal_tabs_spec.lua
+++ b/test/functional/legacy/088_conceal_tabs_spec.lua
@@ -2,8 +2,8 @@
-- tabulators.
local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, clear, execute =
- helpers.feed, helpers.insert, helpers.clear, helpers.execute
+local feed, insert, clear, feed_command =
+ helpers.feed, helpers.insert, helpers.clear, helpers.feed_command
local expect_pos = function(row, col)
return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
@@ -17,19 +17,19 @@ describe('cursor and column position with conceal and tabulators', function()
start:
.concealed. text
|concealed| text
-
+
.concealed. text
|concealed| text
-
+
.a. .b. .c. .d.
|a| |b| |c| |d|]])
-- Conceal settings.
- execute('set conceallevel=2')
- execute('set concealcursor=nc')
- execute('syntax match test /|/ conceal')
+ feed_command('set conceallevel=2')
+ feed_command('set concealcursor=nc')
+ feed_command('syntax match test /|/ conceal')
-- Start test.
- execute('/^start:')
+ feed_command('/^start:')
feed('ztj')
expect_pos(2, 1)
-- We should end up in the same column when running these commands on the
@@ -78,10 +78,10 @@ describe('cursor and column position with conceal and tabulators', function()
expect_pos(9, 25)
feed('$')
expect_pos(9, 26)
- execute('set lbr')
+ feed_command('set lbr')
feed('$')
expect_pos(9, 26)
- execute('set list listchars=tab:>-')
+ feed_command('set list listchars=tab:>-')
feed('0')
expect_pos(9, 1)
feed('W')
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 f8564384e9..44f1664abe 100644
--- a/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
+++ b/test/functional/legacy/092_mksession_cursor_cols_utf8_spec.lua
@@ -5,7 +5,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('store cursor position in session file in UTF-8', function()
setup(clear)
@@ -29,15 +29,15 @@ describe('store cursor position in session file in UTF-8', function()
-- This test requires the buffer to correspond to a file on disk, here named
-- "test.in", because otherwise :mksession won't write out the cursor column
-- info needed for verification.
- execute('write! test.in')
+ feed_command('write! test.in')
- execute('set sessionoptions=buffers splitbelow fileencoding=utf-8')
+ feed_command('set sessionoptions=buffers splitbelow fileencoding=utf-8')
-- Move the cursor through the buffer lines and position it with "|". Using
-- :split after every normal mode command is a trick to have multiple
-- cursors on the screen that can all be stored in the session file.
- execute('/^start:')
- execute('vsplit')
+ feed_command('/^start:')
+ feed_command('vsplit')
feed('j16|:split<cr>')
feed('j16|:split<cr>')
feed('j16|:split<cr>')
@@ -49,9 +49,9 @@ describe('store cursor position in session file in UTF-8', function()
-- Again move the cursor through the buffer and position it with "|". This
-- time also perform a horizontal scroll at every step.
- execute('wincmd l')
- execute('/^start:')
- execute('set nowrap')
+ feed_command('wincmd l')
+ feed_command('/^start:')
+ feed_command('set nowrap')
feed('j16|3zl:split<cr>')
feed('j016|3zl:split<cr>')
feed('j016|3zl:split<cr>')
@@ -62,9 +62,9 @@ describe('store cursor position in session file in UTF-8', function()
feed('j016|3zl:split<cr>')
-- Create the session file, read it back in, and prepare for verification.
- execute('mksession! test.out')
- execute('new test.out')
- execute([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
+ feed_command('mksession! test.out')
+ feed_command('new test.out')
+ feed_command([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
-- Assert buffer contents.
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 40be7dcca4..49bc43f76f 100644
--- a/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
+++ b/test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua
@@ -5,7 +5,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
@@ -30,13 +30,13 @@ describe('store cursor position in session file in Latin-1', function()
A three mulTibyte characters]])
-- Must write buffer to disk for :mksession. See the comments in
-- "092_mksession_cursor_cols_utf8_spec.lua".
- execute('write! test.in')
+ feed_command('write! test.in')
- execute('set sessionoptions=buffers splitbelow fileencoding=latin1')
+ feed_command('set sessionoptions=buffers splitbelow fileencoding=latin1')
-- Move the cursor through the buffer lines and position it with "|".
- execute('/^start:')
- execute('vsplit')
+ feed_command('/^start:')
+ feed_command('vsplit')
feed('j16|:split<cr>')
feed('j16|:split<cr>')
feed('j16|:split<cr>')
@@ -48,9 +48,9 @@ describe('store cursor position in session file in Latin-1', function()
-- Again move the cursor through the buffer and position it with "|". This
-- time also perform a horizontal scroll at every step.
- execute('wincmd l')
- execute('/^start:')
- execute('set nowrap')
+ feed_command('wincmd l')
+ feed_command('/^start:')
+ feed_command('set nowrap')
feed('j16|3zl:split<cr>')
feed('j016|3zl:split<cr>')
feed('j016|3zl:split<cr>')
@@ -61,9 +61,9 @@ describe('store cursor position in session file in Latin-1', function()
feed('j016|3zl:split<cr>')
-- Create the session file, read it back in, and prepare for verification.
- execute('mksession! test.out')
- execute('new test.out')
- execute([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
+ feed_command('mksession! test.out')
+ feed_command('new test.out')
+ feed_command([[v/\(^ *normal! 0\|^ *exe 'normal!\)/d]])
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/094_visual_mode_operators_spec.lua b/test/functional/legacy/094_visual_mode_operators_spec.lua
index a52fa00672..84e384050a 100644
--- a/test/functional/legacy/094_visual_mode_operators_spec.lua
+++ b/test/functional/legacy/094_visual_mode_operators_spec.lua
@@ -6,7 +6,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
-- Vim script user functions needed for some of the test cases.
local function source_user_functions()
@@ -54,38 +54,38 @@ describe('Visual mode and operator', function()
it('simple change in Visual mode', function()
insert([[
apple banana cherry
-
+
line 1 line 1
line 2 line 2
line 3 line 3
line 4 line 4
line 5 line 5
line 6 line 6
-
+
xxxxxxxxxxxxx
xxxxxxxxxxxxx
xxxxxxxxxxxxx
xxxxxxxxxxxxx]])
-- Exercise characterwise Visual mode plus operator, with count and repeat.
- execute('/^apple')
+ feed_command('/^apple')
feed('lvld.l3vd.')
-- Same in linewise Visual mode.
- execute('/^line 1')
+ feed_command('/^line 1')
feed('Vcnewline<esc>j.j2Vd.')
-- Same in blockwise Visual mode.
- execute('/^xxxx')
+ feed_command('/^xxxx')
feed('<c-v>jlc <esc>l.l2<c-v>c----<esc>l.')
-- Assert buffer contents.
expect([[
a y
-
+
newline
newline
-
+
--------x
--------x
xxxx--------x
@@ -98,15 +98,15 @@ describe('Visual mode and operator', function()
JambuRambutanBananaTangerineMango]])
-- Set up Visual mode mappings.
- execute('vnoremap W /\\u/s-1<CR>')
- execute('vnoremap iW :<C-U>call SelectInCaps()<CR>')
+ feed_command('vnoremap W /\\u/s-1<CR>')
+ feed_command('vnoremap iW :<C-U>call SelectInCaps()<CR>')
-- Do a simple change using the simple vmap, also with count and repeat.
- execute('/^Kiwi')
+ feed_command('/^Kiwi')
feed('vWcNo<esc>l.fD2vd.')
-- Same, using the vmap that maps to an Ex command.
- execute('/^Jambu')
+ feed_command('/^Jambu')
feed('llviWc-<esc>l.l2vdl.')
-- Assert buffer contents.
@@ -122,20 +122,20 @@ describe('Visual mode and operator', function()
LemonNectarineZ]])
-- Set up Operator-pending mode mappings.
- execute('onoremap W /\\u/<CR>')
- execute('onoremap <Leader>W :<C-U>call MoveToCap()<CR>')
- execute('onoremap iW :<C-U>call SelectInCaps()<CR>')
+ feed_command('onoremap W /\\u/<CR>')
+ feed_command('onoremap <Leader>W :<C-U>call MoveToCap()<CR>')
+ feed_command('onoremap iW :<C-U>call SelectInCaps()<CR>')
-- Do a simple change using the simple omap, also with count and repeat.
- execute('/^Pineapple')
+ feed_command('/^Pineapple')
feed('cW-<esc>l.l2.l.')
-- Same, using the omap that maps to an Ex command to move the cursor.
- execute('/^Juniper')
+ feed_command('/^Juniper')
feed('g?\\WfD.')
-- Same, using the omap that uses Ex and Visual mode (custom text object).
- execute('/^Lemon')
+ feed_command('/^Lemon')
feed('yiWPlciWNew<esc>fr.')
-- Assert buffer contents.
@@ -159,7 +159,7 @@ describe('Visual mode and operator', function()
-- changed, taking into account the v/V/<c-v> modifier given; or
-- - abort the operation by pressing Escape: no change to the buffer is
-- carried out.
- execute('/^zzzz')
+ feed_command('/^zzzz')
feed([[dV:<cr>dv:<cr>:set noma | let v:errmsg = ''<cr>]])
feed([[d:<cr>:set ma | put = v:errmsg =~# '^E21' ? 'ok' : 'failed'<cr>]])
feed([[dv:<esc>dV:<esc>:set noma | let v:errmsg = ''<cr>]])
@@ -180,7 +180,7 @@ describe('Visual mode and operator', function()
feed('v$p')
expect([[
-
+
x]])
end)
@@ -189,7 +189,7 @@ describe('Visual mode and operator', function()
feed('kkv$d')
expect([[
-
+
b
c]])
end)
@@ -199,7 +199,7 @@ describe('Visual mode and operator', function()
feed('kkvj$d')
expect([[
-
+
c]])
end)
@@ -208,7 +208,7 @@ describe('Visual mode and operator', function()
feed('v$d')
expect([[
-
+
a
b
]])
@@ -219,7 +219,7 @@ describe('Visual mode and operator', function()
feed('kvj$d')
expect([[
-
+
a
]])
end)
@@ -235,7 +235,7 @@ describe('Visual mode and operator', function()
feed('kkgh<End><Del>')
expect([[
-
+
b
c]])
end)
@@ -245,7 +245,7 @@ describe('Visual mode and operator', function()
feed('kkgh<Down><End><Del>')
expect([[
-
+
c]])
end)
@@ -254,7 +254,7 @@ describe('Visual mode and operator', function()
feed('gh<End><Del>')
expect([[
-
+
a
b
]])
@@ -265,7 +265,7 @@ describe('Visual mode and operator', function()
feed('kgh<Down><End><Del>')
expect([[
-
+
a
]])
end)
@@ -281,7 +281,7 @@ describe('Visual mode and operator', function()
feed(' kkgH<Del> ')
expect([[
-
+
b
c]])
end)
@@ -291,7 +291,7 @@ describe('Visual mode and operator', function()
feed('kkgH<Down><Del>')
expect([[
-
+
c]])
end)
@@ -300,7 +300,7 @@ describe('Visual mode and operator', function()
feed('gH<Del>')
expect([[
-
+
a
b]])
end)
@@ -310,7 +310,7 @@ describe('Visual mode and operator', function()
feed('kgH<Down><Del>')
expect([[
-
+
a]])
end)
end)
@@ -318,25 +318,25 @@ describe('Visual mode and operator', function()
describe('v_p:', function()
it('replace last character with line register at middle line', function()
put_aaabbbccc()
- execute('-2yank')
+ feed_command('-2yank')
feed('k$vp')
expect([[
-
+
aaa
bb
aaa
-
+
ccc]])
end)
it('replace last character with line register at middle line selecting newline', function()
put_aaabbbccc()
- execute('-2yank')
+ feed_command('-2yank')
feed('k$v$p')
expect([[
-
+
aaa
bb
aaa
@@ -345,11 +345,11 @@ describe('Visual mode and operator', function()
it('replace last character with line register at last line', function()
put_aaabbbccc()
- execute('-2yank')
+ feed_command('-2yank')
feed('$vp')
expect([[
-
+
aaa
bbb
cc
@@ -359,11 +359,11 @@ describe('Visual mode and operator', function()
it('replace last character with line register at last line selecting newline', function()
put_aaabbbccc()
- execute('-2yank')
+ feed_command('-2yank')
feed('$v$p')
expect([[
-
+
aaa
bbb
cc
@@ -380,7 +380,7 @@ describe('Visual mode and operator', function()
feed('kv3lyjv3lpgvcxxx<Esc>')
expect([[
-
+
zzz
xxx ]])
end)
@@ -392,7 +392,7 @@ describe('Visual mode and operator', function()
feed('0v3l<Esc>gvcxxx<Esc>')
expect([[
-
+
xxx ]])
end)
end)
diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua
index eac8d6356d..85c4fe0ec4 100644
--- a/test/functional/legacy/096_location_list_spec.lua
+++ b/test/functional/legacy/096_location_list_spec.lua
@@ -8,7 +8,7 @@
local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, command, expect = helpers.clear, helpers.command, helpers.expect
describe('location list', function()
setup(clear)
@@ -28,7 +28,7 @@ describe('location list', function()
function! ReadTestProtocol(name)
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
let word = substitute(base, '\v(.*)\..*', '\1', '')
-
+
setl modifiable
setl noreadonly
setl noswapfile
@@ -37,9 +37,9 @@ describe('location list', function()
" For problem 2:
" 'buftype' has to be set to reproduce the constant opening of new windows.
setl buftype=nofile
-
+
call setline(1, word)
-
+
setl nomodified
setl nomodifiable
setl readonly
@@ -71,74 +71,77 @@ describe('location list', function()
]])
-- Set up the result buffer "test.out".
- execute('enew')
- execute('w! test.out')
- execute('b 1')
+ command('enew')
+ command('w! test.out')
+ command('b 1')
-- Test A.
-- Open a new buffer as the sole window, rewind and open the prepopulated
-- location list and navigate through the entries.
- execute('lrewind')
- execute('enew')
- execute('lopen')
- execute('lnext', 'lnext', 'lnext', 'lnext')
+ command('lrewind')
+ command('enew')
+ command('lopen')
+ command(('lnext|'):rep(4))
-- Split the window, copying the location list, then open the copied
-- location list and again navigate forward.
- execute('vert split')
- execute('wincmd L')
- execute('lopen')
- execute('wincmd p')
- execute('lnext')
+ command('vert split')
+ command('wincmd L')
+ command('lopen')
+ command('wincmd p')
+ command('lnext')
-- Record the current file name and the file name of the corresponding
-- location list entry, then open the result buffer.
- execute('let fileName = expand("%")')
- execute('wincmd p')
- execute([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('let fileName = expand("%")')
+ command('wincmd p')
+ command([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute([[let fileName = substitute(fileName, '\\', '/', 'g')]])
- execute([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
- execute([[call append(line('$'), "Test A:")]])
- execute([[call append(line('$'), " - file name displayed: " . fileName)]])
- execute([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
- execute('w')
+ command([[let fileName = substitute(fileName, '\\', '/', 'g')]])
+ command([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
+ command([[call append(line('$'), "Test A:")]])
+ command([[call append(line('$'), " - file name displayed: " . fileName)]])
+ command([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
+ command('w')
-- Clean slate for the next test.
- execute('wincmd o')
- execute('b 1')
+ command('wincmd o')
+ command('b 1')
-- Test B.
-- Rewind the location list, then open it and browse through it by running
-- ":{number}" followed by Enter repeatedly in the location list window.
- execute('lrewind')
- execute('lopen')
- execute('2', [[exe "normal \\<CR>"]])
- execute('wincmd p')
- execute('3', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('4', [[exe "normal \<CR>"]])
+ command('lrewind')
+ command('lopen')
+ command('2')
+ command([[exe "normal \\<CR>"]])
+ command('wincmd p')
+ command('3')
+ command([[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('4')
+ command([[exe "normal \<CR>"]])
-- Record the number of windows open, then go back to the result buffer.
- execute('let numberOfWindowsOpen = winnr("$")')
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('let numberOfWindowsOpen = winnr("$")')
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute('call append(line("$"), "Test B:")')
- execute('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
- execute('w')
+ command('call append(line("$"), "Test B:")')
+ command('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
+ command('w')
-- Clean slate.
- execute('wincmd o')
- execute('b 1')
+ command('wincmd o')
+ command('b 1')
-- Test C.
@@ -146,38 +149,41 @@ describe('location list', function()
-- Enter browsing. But this time, move the location list window to the top
-- to check whether it (the first window found) will be reused when we try
-- to open new windows.
- execute('lrewind')
- execute('lopen')
- execute('wincmd K')
- execute('2', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('3', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('4', [[exe "normal \<CR>"]])
+ command('lrewind')
+ command('lopen')
+ command('wincmd K')
+ command('2')
+ command([[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('3')
+ command([[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('4')
+ command([[exe "normal \<CR>"]])
-- Record the 'buftype' of window 1 (the location list) and the buffer name
-- of window 2 (the current "test protocol" buffer), then go back to the
-- result buffer.
- execute('1wincmd w')
- execute('let locationListWindowBufType = &buftype')
- execute('2wincmd w')
- execute('let bufferName = expand("%")')
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('1wincmd w')
+ command('let locationListWindowBufType = &buftype')
+ command('2wincmd w')
+ command('let bufferName = expand("%")')
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
- execute([[call append(line("$"), "Test C:")]])
- execute([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
- execute([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
- execute('w')
- execute('wincmd o')
- execute('b 1')
+ command([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
+ command([[call append(line("$"), "Test C:")]])
+ command([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
+ command([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
+ command('w')
+ command('wincmd o')
+ command('b 1')
-- Assert buffer contents.
expect([[
-
+
Test A:
- file name displayed: test://bar.txt
- quickfix claims that the file name displayed is: test://bar.txt
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
index 23f1427cb5..6b63a317f1 100644
--- a/test/functional/legacy/097_glob_path_spec.lua
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -4,7 +4,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
if helpers.pending_win32(pending) then return end
@@ -19,26 +19,26 @@ describe('glob() and globpath()', function()
it('is working', function()
-- Make sure glob() doesn't use the shell
- execute('set shell=doesnotexist')
+ command('set shell=doesnotexist')
-- Consistent sorting of file names
- execute('set nofileignorecase')
+ command('set nofileignorecase')
- execute([[$put =glob('Xxx\{')]])
- execute([[$put =glob('Xxx\$')]])
+ command([[$put =glob('Xxx\{')]])
+ command([[$put =glob('Xxx\$')]])
- execute('w! Xxx{')
- execute([[w! Xxx\$]])
- execute([[$put =glob('Xxx\{')]])
- execute([[$put =glob('Xxx\$')]])
+ command('silent w! Xxx{')
+ command([[w! Xxx\$]])
+ command([[$put =glob('Xxx\{')]])
+ command([[$put =glob('Xxx\$')]])
- execute("$put =string(globpath('sautest/autoload', '*.vim'))")
- execute("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))")
+ command("$put =string(globpath('sautest/autoload', '*.vim'))")
+ command("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))")
expect([=[
-
-
-
+
+
+
Xxx{
Xxx$
'sautest/autoload/Test104.vim
diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua
index fa29e5fbe8..eff755221c 100644
--- a/test/functional/legacy/101_hlsearch_spec.lua
+++ b/test/functional/legacy/101_hlsearch_spec.lua
@@ -2,52 +2,52 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('v:hlsearch', function()
setup(clear)
it('is working', function()
-- Last abc: Q
- execute('new')
- execute([[call setline(1, repeat(['aaa'], 10))]])
- execute('set hlsearch nolazyredraw')
- execute('let r=[]')
- execute('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
- execute('/aaa')
- execute('AddR')
- execute('nohlsearch')
- execute('AddR')
- execute('let v:hlsearch=1')
- execute('AddR')
- execute('let v:hlsearch=0')
- execute('AddR')
- execute('set hlsearch')
- execute('AddR')
- execute('let v:hlsearch=0')
- execute('AddR')
+ feed_command('new')
+ feed_command([[call setline(1, repeat(['aaa'], 10))]])
+ feed_command('set hlsearch nolazyredraw')
+ feed_command('let r=[]')
+ feed_command('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
+ feed_command('/aaa')
+ feed_command('AddR')
+ feed_command('nohlsearch')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=1')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
+ feed_command('set hlsearch')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
feed('n:AddR<cr>')
- execute('let v:hlsearch=0')
- execute('AddR')
- execute('/')
- execute('AddR')
- execute('set nohls')
- execute('/')
- execute('AddR')
- execute('let r1=r[0][0]')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
+ feed_command('/')
+ feed_command('AddR')
+ feed_command('set nohls')
+ feed_command('/')
+ feed_command('AddR')
+ feed_command('let r1=r[0][0]')
-- I guess it is not guaranteed that screenattr outputs always the same character
- execute([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
- execute('try')
- execute(' let v:hlsearch=[]')
- execute('catch')
- execute([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
- execute('endtry')
- execute('bwipeout!')
- execute('$put=r')
- execute('call garbagecollect(1)')
- execute('call getchar()')
- execute('1d', '1d')
+ feed_command([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
+ feed_command('try')
+ feed_command(' let v:hlsearch=[]')
+ feed_command('catch')
+ feed_command([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
+ feed_command('endtry')
+ feed_command('bwipeout!')
+ feed_command('$put=r')
+ feed_command('call garbagecollect(1)')
+ feed_command('call getchar()')
+ feed_command('1d', '1d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua
index c1a6c57956..c8ee423ff3 100644
--- a/test/functional/legacy/102_fnameescape_spec.lua
+++ b/test/functional/legacy/102_fnameescape_spec.lua
@@ -2,19 +2,19 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
describe('fnameescape', function()
setup(clear)
it('is working', function()
- execute('let fname = "Xspa ce"')
- execute('try', 'exe "w! " . fnameescape(fname)', "put='Space'", 'endtry')
- execute('let fname = "Xemark!"')
- execute('try', 'exe "w! " . fnameescape(fname)', "put='ExclamationMark'", 'endtry')
+ command('let fname = "Xspa ce"')
+ command('try | exe "w! " . fnameescape(fname) | put=\'Space\' | endtry')
+ command('let fname = "Xemark!"')
+ command('try | exe "w! " . fnameescape(fname) | put=\'ExclamationMark\' | endtry')
expect([[
-
+
Space
ExclamationMark]])
end)
diff --git a/test/functional/legacy/104_let_assignment_spec.lua b/test/functional/legacy/104_let_assignment_spec.lua
index 27c3715231..a03bb026f6 100644
--- a/test/functional/legacy/104_let_assignment_spec.lua
+++ b/test/functional/legacy/104_let_assignment_spec.lua
@@ -2,13 +2,13 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
describe(':let', function()
setup(clear)
it('is working', function()
- execute('set runtimepath+=test/functional/fixtures')
+ command('set runtimepath+=test/functional/fixtures')
-- Test to not autoload when assigning. It causes internal error.
source([[
@@ -34,7 +34,7 @@ describe(':let', function()
endfor]])
-- Remove empty line
- execute('1d')
+ command('1d')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua
index 2b17d63378..5d76adc786 100644
--- a/test/functional/legacy/106_errorformat_spec.lua
+++ b/test/functional/legacy/106_errorformat_spec.lua
@@ -2,19 +2,19 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local command, expect = helpers.command, helpers.expect
describe('errorformat', function()
setup(clear)
it('is working', function()
- execute("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
- execute("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
- execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
- execute("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
- execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
- execute("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']")
- execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+ command("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
+ command("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
+ command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+ command("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
+ command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+ command("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']")
+ command("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
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 610bac7f21..836a0f8f24 100644
--- a/test/functional/legacy/107_adjust_window_and_contents_spec.lua
+++ b/test/functional/legacy/107_adjust_window_and_contents_spec.lua
@@ -2,8 +2,11 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
+
+local wait = helpers.wait
+local clear = helpers.clear
local insert = helpers.insert
-local clear, execute = helpers.clear, helpers.execute
+local command = helpers.command
if helpers.pending_win32(pending) then return end
@@ -15,31 +18,34 @@ describe('107', function()
screen:attach()
insert('start:')
- execute('new')
- execute('call setline(1, range(1,256))')
- execute('let r=[]')
- execute('func! GetScreenStr(row)')
- execute(' let str = ""')
- execute(' for c in range(1,3)')
- execute(' let str .= nr2char(screenchar(a:row, c))')
- execute(' endfor')
- execute(' return str')
- execute('endfunc')
- execute([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
- execute('let s3=GetScreenStr(1)')
- execute('wincmd p')
- execute('call add(r, [line("w0"), s3])')
- execute([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
- execute('let s3=GetScreenStr(1)')
- execute('wincmd p')
- execute('call add(r, [line("w0"), s3])')
- execute([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
- execute('let s3=GetScreenStr(1)')
- execute(':wincmd p')
- execute('call add(r, [line("w0"), s3])')
- execute('bwipeout!')
- execute('$put=r')
- execute('call garbagecollect(1)')
+ wait()
+ command('new')
+ command('call setline(1, range(1,256))')
+ command('let r=[]')
+ command([[
+ func! GetScreenStr(row)
+ let str = ""
+ for c in range(1,3)
+ let str .= nr2char(screenchar(a:row, c))
+ endfor
+ return str
+ endfunc
+ ]])
+ command([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
+ command('let s3=GetScreenStr(1)')
+ command('wincmd p')
+ command('call add(r, [line("w0"), s3])')
+ command([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
+ command('let s3=GetScreenStr(1)')
+ command('wincmd p')
+ command('call add(r, [line("w0"), s3])')
+ command([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
+ command('let s3=GetScreenStr(1)')
+ command(':wincmd p')
+ command('call add(r, [line("w0"), s3])')
+ command('bwipeout!')
+ command('$put=r')
+ command('call garbagecollect(1)')
screen:expect([[
start: |
@@ -55,7 +61,7 @@ describe('107', function()
~ |
~ |
~ |
- :call garbagecollect(1) |
+ 3 more lines |
]])
end)
end)
diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
index a03092e446..b2e2fa4ed3 100644
--- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua
+++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua
@@ -2,32 +2,32 @@
local helpers = require('test.functional.helpers')(after_each)
local feed, clear = helpers.feed, helpers.clear
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('108', function()
before_each(clear)
it('is working', function()
- execute('lang mess C')
- execute('function! Foo()')
- execute(' let var1 = 1')
- execute(' let var2 = Bar(var1) + 9')
- execute(' return var2')
- execute('endfunction')
- execute('function! Bar(var)')
- execute(' let var1 = 2 + a:var')
- execute(' let var2 = Bazz(var1) + 4')
- execute(' return var2')
- execute('endfunction')
- execute('function! Bazz(var)')
- execute(' let var1 = 3 + a:var')
- execute(' let var3 = "another var"')
- execute(' return var1')
- execute('endfunction')
- execute('new')
- execute('debuggreedy')
- execute('redir => out')
- execute('debug echo Foo()')
+ feed_command('lang mess C')
+ feed_command('function! Foo()')
+ feed_command(' let var1 = 1')
+ feed_command(' let var2 = Bar(var1) + 9')
+ feed_command(' return var2')
+ feed_command('endfunction')
+ feed_command('function! Bar(var)')
+ feed_command(' let var1 = 2 + a:var')
+ feed_command(' let var2 = Bazz(var1) + 4')
+ feed_command(' return var2')
+ feed_command('endfunction')
+ feed_command('function! Bazz(var)')
+ feed_command(' let var1 = 3 + a:var')
+ feed_command(' let var3 = "another var"')
+ feed_command(' return var1')
+ feed_command('endfunction')
+ feed_command('new')
+ feed_command('debuggreedy')
+ feed_command('redir => out')
+ feed_command('debug echo Foo()')
feed('step<cr>')
feed('step<cr>')
feed('step<cr>')
@@ -83,9 +83,9 @@ describe('108', function()
feed('fram<cr>')
feed([[echo "\n- final result 19:"<cr>]])
feed('cont<cr>')
- execute('0debuggreedy')
- execute('redir END')
- execute('$put =out')
+ feed_command('0debuggreedy')
+ feed_command('redir END')
+ feed_command('$put =out')
-- Assert buffer contents.
expect([=[
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index b9075620dc..191f145095 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -1,7 +1,7 @@
-- Test argument list commands
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
+local clear, command, eq = helpers.clear, helpers.command, helpers.eq
local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq
if helpers.pending_win32(pending) then return end
@@ -10,12 +10,12 @@ describe('argument list commands', function()
before_each(clear)
local function init_abc()
- execute('args a b c')
- execute('next')
+ command('args a b c')
+ command('next')
end
local function reset_arglist()
- execute('arga a | %argd')
+ command('arga a | %argd')
end
local function assert_fails(cmd, err)
@@ -23,183 +23,185 @@ describe('argument list commands', function()
end
it('test that argidx() works', function()
- execute('args a b c')
- execute('last')
+ command('args a b c')
+ command('last')
eq(2, eval('argidx()'))
- execute('%argdelete')
+ command('%argdelete')
eq(0, eval('argidx()'))
- execute('args a b c')
+ command('args a b c')
eq(0, eval('argidx()'))
- execute('next')
+ command('next')
eq(1, eval('argidx()'))
- execute('next')
+ command('next')
eq(2, eval('argidx()'))
- execute('1argdelete')
+ command('1argdelete')
eq(1, eval('argidx()'))
- execute('1argdelete')
+ command('1argdelete')
eq(0, eval('argidx()'))
- execute('1argdelete')
+ command('1argdelete')
eq(0, eval('argidx()'))
end)
it('test that argadd() works', function()
- execute('%argdelete')
- execute('argadd a b c')
+ -- Fails with “E474: Invalid argument”. Not sure whether it is how it is
+ -- supposed to behave.
+ -- command('%argdelete')
+ command('argadd a b c')
eq(0, eval('argidx()'))
- execute('%argdelete')
- execute('argadd a')
+ command('%argdelete')
+ command('argadd a')
eq(0, eval('argidx()'))
- execute('argadd b c d')
+ command('argadd b c d')
eq(0, eval('argidx()'))
init_abc()
- execute('argadd x')
+ command('argadd x')
eq({'a', 'b', 'x', 'c'}, eval('argv()'))
eq(1, eval('argidx()'))
init_abc()
- execute('0argadd x')
+ command('0argadd x')
eq({'x', 'a', 'b', 'c'}, eval('argv()'))
eq(2, eval('argidx()'))
init_abc()
- execute('1argadd x')
+ command('1argadd x')
eq({'a', 'x', 'b', 'c'}, eval('argv()'))
eq(2, eval('argidx()'))
init_abc()
- execute('$argadd x')
+ command('$argadd x')
eq({'a', 'b', 'c', 'x'}, eval('argv()'))
eq(1, eval('argidx()'))
init_abc()
- execute('$argadd x')
- execute('+2argadd y')
+ command('$argadd x')
+ command('+2argadd y')
eq({'a', 'b', 'c', 'x', 'y'}, eval('argv()'))
eq(1, eval('argidx()'))
- execute('%argd')
- execute('edit d')
- execute('arga')
+ command('%argd')
+ command('edit d')
+ command('arga')
eq(1, eval('len(argv())'))
eq('d', eval('get(argv(), 0, "")'))
- execute('%argd')
- execute('new')
- execute('arga')
+ command('%argd')
+ command('new')
+ command('arga')
eq(0, eval('len(argv())'))
end)
it('test for [count]argument and [count]argdelete commands', function()
reset_arglist()
- execute('let save_hidden = &hidden')
- execute('set hidden')
- execute('let g:buffers = []')
- execute('augroup TEST')
- execute([[au BufEnter * call add(buffers, expand('%:t'))]])
- execute('augroup END')
-
- execute('argadd a b c d')
- execute('$argu')
- execute('$-argu')
- execute('-argu')
- execute('1argu')
- execute('+2argu')
-
- execute('augroup TEST')
- execute('au!')
- execute('augroup END')
+ command('let save_hidden = &hidden')
+ command('set hidden')
+ command('let g:buffers = []')
+ command('augroup TEST')
+ command([[au BufEnter * call add(buffers, expand('%:t'))]])
+ command('augroup END')
+
+ command('argadd a b c d')
+ command('$argu')
+ command('$-argu')
+ command('-argu')
+ command('1argu')
+ command('+2argu')
+
+ command('augroup TEST')
+ command('au!')
+ command('augroup END')
eq({'d', 'c', 'b', 'a', 'c'}, eval('g:buffers'))
- execute('redir => result')
- execute('ar')
- execute('redir END')
+ command('redir => result')
+ command('ar')
+ command('redir END')
eq(1, eval([[result =~# 'a b \[c] d']]))
- execute('.argd')
+ command('.argd')
eq({'a', 'b', 'd'}, eval('argv()'))
- execute('-argd')
+ command('-argd')
eq({'a', 'd'}, eval('argv()'))
- execute('$argd')
+ command('$argd')
eq({'a'}, eval('argv()'))
- execute('1arga c')
- execute('1arga b')
- execute('$argu')
- execute('$arga x')
+ command('1arga c')
+ command('1arga b')
+ command('$argu')
+ command('$arga x')
eq({'a', 'b', 'c', 'x'}, eval('argv()'))
- execute('0arga Y')
+ command('0arga Y')
eq({'Y', 'a', 'b', 'c', 'x'}, eval('argv()'))
- execute('%argd')
+ command('%argd')
eq({}, eval('argv()'))
- execute('arga a b c d e f')
- execute('2,$-argd')
+ command('arga a b c d e f')
+ command('2,$-argd')
eq({'a', 'f'}, eval('argv()'))
- execute('let &hidden = save_hidden')
+ command('let &hidden = save_hidden')
-- Setting the argument list should fail when the current buffer has
-- unsaved changes
- execute('%argd')
- execute('enew!')
- execute('set modified')
+ command('%argd')
+ command('enew!')
+ command('set modified')
assert_fails('args x y z', 'E37:')
- execute('args! x y z')
+ command('args! x y z')
eq({'x', 'y', 'z'}, eval('argv()'))
eq('x', eval('expand("%:t")'))
- execute('%argdelete')
+ command('%argdelete')
assert_fails('argument', 'E163:')
end)
it('test for 0argadd and 0argedit', function()
reset_arglist()
- execute('arga a b c d')
- execute('2argu')
- execute('0arga added')
+ command('arga a b c d')
+ command('2argu')
+ command('0arga added')
eq({'added', 'a', 'b', 'c', 'd'}, eval('argv()'))
- execute('%argd')
- execute('arga a b c d')
- execute('2argu')
- execute('0arge edited')
+ command('%argd')
+ command('arga a b c d')
+ command('2argu')
+ command('0arge edited')
eq({'edited', 'a', 'b', 'c', 'd'}, eval('argv()'))
- execute('2argu')
- execute('arga third')
+ command('2argu')
+ command('arga third')
eq({'edited', 'a', 'third', 'b', 'c', 'd'}, eval('argv()'))
end)
it('test for argc()', function()
reset_arglist()
eq(0, eval('argc()'))
- execute('argadd a b')
+ command('argadd a b')
eq(2, eval('argc()'))
end)
it('test for arglistid()', function()
reset_arglist()
- execute('arga a b')
+ command('arga a b')
eq(0, eval('arglistid()'))
- execute('split')
- execute('arglocal')
+ command('split')
+ command('arglocal')
eq(1, eval('arglistid()'))
- execute('tabnew | tabfirst')
+ command('tabnew | tabfirst')
eq(0, eval('arglistid(2)'))
eq(1, eval('arglistid(1, 1)'))
eq(0, eval('arglistid(2, 1)'))
eq(1, eval('arglistid(1, 2)'))
- execute('tabonly | only | enew!')
- execute('argglobal')
+ command('tabonly | only | enew!')
+ command('argglobal')
eq(0, eval('arglistid()'))
end)
@@ -207,95 +209,95 @@ describe('argument list commands', function()
reset_arglist()
eq({}, eval('argv()'))
eq('', eval('argv(2)'))
- execute('argadd a b c d')
+ command('argadd a b c d')
eq('c', eval('argv(2)'))
end)
it('test for :argedit command', function()
reset_arglist()
- execute('argedit a')
+ command('argedit a')
eq({'a'}, eval('argv()'))
eq('a', eval('expand("%:t")'))
- execute('argedit b')
+ command('argedit b')
eq({'a', 'b'}, eval('argv()'))
eq('b', eval('expand("%:t")'))
- execute('argedit a')
+ command('argedit a')
eq({'a', 'b'}, eval('argv()'))
eq('a', eval('expand("%:t")'))
- execute('argedit c')
+ command('argedit c')
eq({'a', 'c', 'b'}, eval('argv()'))
- execute('0argedit x')
+ command('0argedit x')
eq({'x', 'a', 'c', 'b'}, eval('argv()'))
- execute('enew! | set modified')
+ command('enew! | set modified')
assert_fails('argedit y', 'E37:')
- execute('argedit! y')
+ command('argedit! y')
eq({'x', 'y', 'a', 'c', 'b'}, eval('argv()'))
- execute('%argd')
+ command('%argd')
-- Nvim allows unescaped spaces in filename on all platforms. #6010
- execute('argedit a b')
+ command('argedit a b')
eq({'a b'}, eval('argv()'))
end)
it('test for :argdelete command', function()
reset_arglist()
- execute('args aa a aaa b bb')
- execute('argdelete a*')
+ command('args aa a aaa b bb')
+ command('argdelete a*')
eq({'b', 'bb'}, eval('argv()'))
eq('aa', eval('expand("%:t")'))
- execute('last')
- execute('argdelete %')
+ command('last')
+ command('argdelete %')
eq({'b'}, eval('argv()'))
assert_fails('argdelete', 'E471:')
assert_fails('1,100argdelete', 'E16:')
- execute('%argd')
+ command('%argd')
end)
it('test for the :next, :prev, :first, :last, :rewind commands', function()
reset_arglist()
- execute('args a b c d')
- execute('last')
+ command('args a b c d')
+ command('last')
eq(3, eval('argidx()'))
assert_fails('next', 'E165:')
- execute('prev')
+ command('prev')
eq(2, eval('argidx()'))
- execute('Next')
+ command('Next')
eq(1, eval('argidx()'))
- execute('first')
+ command('first')
eq(0, eval('argidx()'))
assert_fails('prev', 'E164:')
- execute('3next')
+ command('3next')
eq(3, eval('argidx()'))
- execute('rewind')
+ command('rewind')
eq(0, eval('argidx()'))
- execute('%argd')
+ command('%argd')
end)
it('test for autocommand that redefines the argument list, when doing ":all"', function()
- execute('autocmd BufReadPost Xxx2 next Xxx2 Xxx1')
- execute("call writefile(['test file Xxx1'], 'Xxx1')")
- execute("call writefile(['test file Xxx2'], 'Xxx2')")
- execute("call writefile(['test file Xxx3'], 'Xxx3')")
-
- execute('new')
+ command('autocmd BufReadPost Xxx2 next Xxx2 Xxx1')
+ command("call writefile(['test file Xxx1'], 'Xxx1')")
+ command("call writefile(['test file Xxx2'], 'Xxx2')")
+ command("call writefile(['test file Xxx3'], 'Xxx3')")
+
+ command('new')
-- redefine arglist; go to Xxx1
- execute('next! Xxx1 Xxx2 Xxx3')
+ command('next! Xxx1 Xxx2 Xxx3')
-- open window for all args
- execute('all')
+ command('all')
eq('test file Xxx1', eval('getline(1)'))
- execute('wincmd w')
- execute('wincmd w')
+ command('wincmd w')
+ command('wincmd w')
eq('test file Xxx1', eval('getline(1)'))
-- should now be in Xxx2
- execute('rewind')
+ command('rewind')
eq('test file Xxx2', eval('getline(1)'))
-
- execute('autocmd! BufReadPost Xxx2')
- execute('enew! | only')
- execute("call delete('Xxx1')")
- execute("call delete('Xxx2')")
- execute("call delete('Xxx3')")
- execute('argdelete Xxx*')
- execute('bwipe! Xxx1 Xxx2 Xxx3')
+
+ command('autocmd! BufReadPost Xxx2')
+ command('enew! | only')
+ command("call delete('Xxx1')")
+ command("call delete('Xxx2')")
+ command("call delete('Xxx3')")
+ command('argdelete Xxx*')
+ command('bwipe! Xxx1 Xxx2 Xxx3')
end)
end)
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index 5c7268486a..d6255d42e7 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -1,7 +1,7 @@
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
+local source, command = helpers.source, helpers.command
local exc_exec = helpers.exc_exec
local function expected_errors(errors)
@@ -55,7 +55,7 @@ describe('assert function:', function()
it('should change v:errors when expected is not equal to actual', function()
-- Lua does not tell integer from float.
- execute('call assert_equal(1, 1.0)')
+ command('call assert_equal(1, 1.0)')
expected_errors({'Expected 1 but got 1.0'})
end)
@@ -219,8 +219,8 @@ describe('assert function:', function()
-- assert_fails({cmd}, [, {error}])
describe('assert_fails', function()
it('should change v:errors when error does not match v:errmsg', function()
- execute([[call assert_fails('xxx', {})]])
- execute([[call assert_match("Expected {} but got 'E731:", v:errors[0])]])
+ command([[call assert_fails('xxx', {})]])
+ command([[call assert_match("Expected {} but got 'E731:", v:errors[0])]])
expected_errors({"Expected {} but got 'E731: using Dictionary as a String'"})
end)
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
index 06f7c1dd11..466e3ed830 100644
--- a/test/functional/legacy/autochdir_spec.lua
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -1,7 +1,7 @@
local lfs = require('lfs')
local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
-local eval, execute = helpers.eval, helpers.execute
+local eval, command = helpers.eval, helpers.command
describe('autochdir behavior', function()
local dir = 'Xtest-functional-legacy-autochdir'
@@ -17,9 +17,9 @@ describe('autochdir behavior', function()
-- Tests vim/vim/777 without test_autochdir().
it('sets filename', function()
- execute('set acd')
- execute('new')
- execute('w '..dir..'/Xtest')
+ command('set acd')
+ command('new')
+ command('w '..dir..'/Xtest')
eq('Xtest', eval("expand('%')"))
eq(dir, eval([[substitute(getcwd(), '.*[/\\]\(\k*\)', '\1', '')]]))
end)
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 28037e17c5..0c7e43bf31 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -4,7 +4,7 @@ local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
local curbuf, buf = helpers.curbuf, helpers.bufmeths
local curwin = helpers.curwin
local redir_exec = helpers.redir_exec
-local source, execute = helpers.source, helpers.execute
+local source, command = helpers.source, helpers.command
local function declare_hook_function()
source([[
@@ -23,9 +23,9 @@ local function declare_hook_function()
endfu
]])
end
-
+
local function set_hook(pattern)
- execute(
+ command(
'au OptionSet '
.. pattern ..
' :call AutoCommand(expand("<amatch>"), bufnr("%"), winnr())'
@@ -33,7 +33,7 @@ local function set_hook(pattern)
end
local function init_var()
- execute('let g:ret = []')
+ command('let g:ret = []')
end
local function get_result()
@@ -88,9 +88,9 @@ end
local function make_buffer()
local old_buf = curbuf()
- execute('botright new')
+ command('botright new')
local new_buf = curbuf()
- execute('wincmd p') -- move previous window
+ command('wincmd p') -- move previous window
neq(old_buf, new_buf)
eq(old_buf, curbuf())
@@ -100,10 +100,10 @@ end
local function get_new_window_number()
local old_win = curwin()
- execute('botright new')
+ command('botright new')
local new_win = curwin()
local new_winnr = redir_exec('echo winnr()')
- execute('wincmd p') -- move previous window
+ command('wincmd p') -- move previous window
neq(old_win, new_win)
eq(old_win, curwin())
@@ -122,42 +122,42 @@ describe('au OptionSet', function()
end)
it('should be called in setting number option', function()
- execute('set nu')
+ command('set nu')
expected_combination({'number', 0, 1, 'global'})
- execute('setlocal nonu')
+ command('setlocal nonu')
expected_combination({'number', 1, 0, 'local'})
- execute('setglobal nonu')
+ command('setglobal nonu')
expected_combination({'number', 1, 0, 'global'})
end)
it('should be called in setting autoindent option',function()
- execute('setlocal ai')
+ command('setlocal ai')
expected_combination({'autoindent', 0, 1, 'local'})
- execute('setglobal ai')
+ command('setglobal ai')
expected_combination({'autoindent', 0, 1, 'global'})
- execute('set noai')
+ command('set noai')
expected_combination({'autoindent', 1, 0, 'global'})
end)
it('should be called in inverting global autoindent option',function()
- execute('set ai!')
+ command('set ai!')
expected_combination({'autoindent', 0, 1, 'global'})
end)
it('should be called in being unset local autoindent option',function()
- execute('setlocal ai')
+ command('setlocal ai')
expected_combination({'autoindent', 0, 1, 'local'})
- execute('setlocal ai<')
+ command('setlocal ai<')
expected_combination({'autoindent', 1, 0, 'local'})
end)
it('should be called in setting global list and number option at the same time',function()
- execute('set list nu')
+ command('set list nu')
expected_combination(
{'list', 0, 1, 'global'},
{'number', 0, 1, 'global'}
@@ -165,41 +165,41 @@ describe('au OptionSet', function()
end)
it('should not print anything, use :noa', function()
- execute('noa set nolist nonu')
+ command('noa set nolist nonu')
expected_empty()
end)
it('should be called in setting local acd', function()
- execute('setlocal acd')
+ command('setlocal acd')
expected_combination({'autochdir', 0, 1, 'local'})
end)
it('should be called in setting autoread', function()
- execute('set noar')
+ command('set noar')
expected_combination({'autoread', 1, 0, 'global'})
- execute('setlocal ar')
+ command('setlocal ar')
expected_combination({'autoread', 0, 1, 'local'})
end)
it('should be called in inverting global autoread', function()
- execute('setglobal invar')
+ command('setglobal invar')
expected_combination({'autoread', 1, 0, 'global'})
end)
it('should be called in setting backspace option through :let', function()
- execute('let &bs=""')
+ command('let &bs=""')
expected_combination({'backspace', 'indent,eol,start', '', 'global'})
end)
describe('being set by setbufvar()', function()
it('should not trigger because option name is invalid', function()
- execute('call setbufvar(1, "&l:bk", 1)')
+ command('silent! call setbufvar(1, "&l:bk", 1)')
expected_empty()
end)
it('should trigger using correct option name', function()
- execute('call setbufvar(1, "&backup", 1)')
+ command('call setbufvar(1, "&backup", 1)')
expected_combination({'backup', 0, 1, 'local'})
end)
@@ -207,7 +207,7 @@ describe('au OptionSet', function()
local new_buffer = make_buffer()
local new_bufnr = buf.get_number(new_buffer)
- execute('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
+ command('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
expected_combination({'buftype', '', 'nofile', 'local', {bufnr = new_bufnr}})
end)
end)
@@ -224,16 +224,16 @@ describe('au OptionSet', function()
it('should be called iff setting readonly', function()
set_hook('readonly')
- execute('set nu')
+ command('set nu')
expected_empty()
- execute('setlocal ro')
+ command('setlocal ro')
expected_combination({'readonly', 0, 1, 'local'})
- execute('setglobal ro')
+ command('setglobal ro')
expected_combination({'readonly', 0, 1, 'global'})
- execute('set noro')
+ command('set noro')
expected_combination({'readonly', 1, 0, 'global'})
end)
@@ -241,14 +241,14 @@ describe('au OptionSet', function()
it('should not trigger because option name does not match with backup', function()
set_hook('backup')
- execute('call setbufvar(1, "&l:bk", 1)')
+ command('silent! call setbufvar(1, "&l:bk", 1)')
expected_empty()
end)
it('should trigger, use correct option name backup', function()
set_hook('backup')
- execute('call setbufvar(1, "&backup", 1)')
+ command('call setbufvar(1, "&backup", 1)')
expected_combination({'backup', 0, 1, 'local'})
end)
@@ -258,7 +258,7 @@ describe('au OptionSet', function()
local new_buffer = make_buffer()
local new_bufnr = buf.get_number(new_buffer)
- execute('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
+ command('call setbufvar(' .. new_bufnr .. ', "&buftype", "nofile")')
expected_combination({'buftype', '', 'nofile', 'local', {bufnr = new_bufnr}})
end)
end)
@@ -267,14 +267,14 @@ describe('au OptionSet', function()
it('should not trigger because option name does not match with backup', function()
set_hook('backup')
- execute('call setwinvar(1, "&l:bk", 1)')
+ command('silent! call setwinvar(1, "&l:bk", 1)')
expected_empty()
end)
it('should trigger, use correct option name backup', function()
set_hook('backup')
- execute('call setwinvar(1, "&backup", 1)')
+ command('call setwinvar(1, "&backup", 1)')
expected_combination({'backup', 0, 1, 'local'})
end)
@@ -283,7 +283,7 @@ describe('au OptionSet', function()
local new_winnr = get_new_window_number()
- execute('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
+ command('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
-- expected_combination({'cursorcolumn', 0, 1, 'local', {winnr = new_winnr}})
expected_empty()
end)
diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua
index 4110d66f5b..84d661c190 100644
--- a/test/functional/legacy/autoformat_join_spec.lua
+++ b/test/functional/legacy/autoformat_join_spec.lua
@@ -1,9 +1,9 @@
--- vim: set foldmethod=marker foldmarker=[[,]] :
-- Tests for setting the '[,'] marks when joining lines.
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 command, expect = helpers.command, helpers.expect
+local wait = helpers.wait
describe('autoformat join', function()
setup(clear)
@@ -21,12 +21,13 @@ Results:]])
feed('gg')
feed('0gqj<cr>')
+ wait()
- execute([[let a=string(getpos("'[")).'/'.string(getpos("']"))]])
- execute("g/^This line/;'}-join")
- execute([[let b=string(getpos("'[")).'/'.string(getpos("']"))]])
- execute("$put ='First test: Start/End '.string(a)")
- execute("$put ='Second test: Start/End '.string(b)")
+ command([[let a=string(getpos("'[")).'/'.string(getpos("']"))]])
+ command("g/^This line/;'}-join")
+ command([[let b=string(getpos("'[")).'/'.string(getpos("']"))]])
+ command("$put ='First test: Start/End '.string(a)")
+ command("$put ='Second test: Start/End '.string(b)")
expect([[
O sodales, ludite, vos qui attamen consulite per voster honur.
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
index 2504fe8e51..7594dba16c 100644
--- a/test/functional/legacy/breakindent_spec.lua
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -2,7 +2,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('breakindent', function()
setup(clear)
@@ -10,186 +10,186 @@ describe('breakindent', function()
it('is working', function()
insert('dummy text')
- execute('set wildchar=^E')
- execute('10new')
- execute('vsp')
- execute('vert resize 20')
- execute([[put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"]])
- execute('set ts=4 sw=4 sts=4 breakindent')
- execute('fu! ScreenChar(line, width)')
- execute(' let c=""')
- execute(' for i in range(1,a:width)')
- execute(' let c.=nr2char(screenchar(a:line, i))')
- execute(' endfor')
- execute([[ let c.="\n"]])
- execute(' for i in range(1,a:width)')
- execute(' let c.=nr2char(screenchar(a:line+1, i))')
- execute(' endfor')
- execute([[ let c.="\n"]])
- execute(' for i in range(1,a:width)')
- execute(' let c.=nr2char(screenchar(a:line+2, i))')
- execute(' endfor')
- execute(' return c')
- execute('endfu')
- execute('fu DoRecordScreen()')
- execute(' wincmd l')
- execute([[ $put =printf(\"\n%s\", g:test)]])
- execute(' $put =g:line1')
- execute(' wincmd p')
- execute('endfu')
- execute('set briopt=min:0')
- execute('let g:test="Test 1: Simple breakindent"')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test="Test 2: Simple breakindent + sbr=>>"')
- execute('set sbr=>>')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test ="Test 3: Simple breakindent + briopt:sbr"')
- execute('set briopt=sbr,min:0 sbr=++')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test ="Test 4: Simple breakindent + min width: 18"')
- execute('set sbr= briopt=min:18')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test =" Test 5: Simple breakindent + shift by 2"')
- execute('set briopt=shift:2,min:0')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test=" Test 6: Simple breakindent + shift by -1"')
- execute('set briopt=shift:-1,min:0')
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
- execute('let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"')
- execute('set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
- execute('let line1=ScreenChar(line("."),10)')
- execute('call DoRecordScreen()')
- execute('let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"')
- execute('set briopt=shift:1,sbr,min:0 nu sbr=# list lcs&vi')
- execute('let line1=ScreenChar(line("."),10)')
- execute('call DoRecordScreen()')
- execute([[let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"]])
- execute('set briopt-=sbr')
- execute('let line1=ScreenChar(line("."),10)')
- execute('call DoRecordScreen()')
- execute([[let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"]])
- execute('set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
- execute('let line1=ScreenChar(line("."),10)')
- execute('call DoRecordScreen()')
- execute('wincmd p')
- execute([[let g:test="\n Test 11: strdisplaywidth when breakindent is on"]])
- execute('set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
+ feed_command('set wildchar=^E')
+ feed_command('10new')
+ feed_command('vsp')
+ feed_command('vert resize 20')
+ feed_command([[put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"]])
+ feed_command('set ts=4 sw=4 sts=4 breakindent')
+ feed_command('fu! ScreenChar(line, width)')
+ feed_command(' let c=""')
+ feed_command(' for i in range(1,a:width)')
+ feed_command(' let c.=nr2char(screenchar(a:line, i))')
+ feed_command(' endfor')
+ feed_command([[ let c.="\n"]])
+ feed_command(' for i in range(1,a:width)')
+ feed_command(' let c.=nr2char(screenchar(a:line+1, i))')
+ feed_command(' endfor')
+ feed_command([[ let c.="\n"]])
+ feed_command(' for i in range(1,a:width)')
+ feed_command(' let c.=nr2char(screenchar(a:line+2, i))')
+ feed_command(' endfor')
+ feed_command(' return c')
+ feed_command('endfu')
+ feed_command('fu DoRecordScreen()')
+ feed_command(' wincmd l')
+ feed_command([[ $put =printf(\"\n%s\", g:test)]])
+ feed_command(' $put =g:line1')
+ feed_command(' wincmd p')
+ feed_command('endfu')
+ feed_command('set briopt=min:0')
+ feed_command('let g:test="Test 1: Simple breakindent"')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test="Test 2: Simple breakindent + sbr=>>"')
+ feed_command('set sbr=>>')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test ="Test 3: Simple breakindent + briopt:sbr"')
+ feed_command('set briopt=sbr,min:0 sbr=++')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test ="Test 4: Simple breakindent + min width: 18"')
+ feed_command('set sbr= briopt=min:18')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test =" Test 5: Simple breakindent + shift by 2"')
+ feed_command('set briopt=shift:2,min:0')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test=" Test 6: Simple breakindent + shift by -1"')
+ feed_command('set briopt=shift:-1,min:0')
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"')
+ feed_command('set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4')
+ feed_command('let line1=ScreenChar(line("."),10)')
+ feed_command('call DoRecordScreen()')
+ feed_command('let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"')
+ feed_command('set briopt=shift:1,sbr,min:0 nu sbr=# list lcs&vi')
+ feed_command('let line1=ScreenChar(line("."),10)')
+ feed_command('call DoRecordScreen()')
+ feed_command([[let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"]])
+ feed_command('set briopt-=sbr')
+ feed_command('let line1=ScreenChar(line("."),10)')
+ feed_command('call DoRecordScreen()')
+ feed_command([[let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"]])
+ feed_command('set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0')
+ feed_command('let line1=ScreenChar(line("."),10)')
+ feed_command('call DoRecordScreen()')
+ feed_command('wincmd p')
+ feed_command([[let g:test="\n Test 11: strdisplaywidth when breakindent is on"]])
+ feed_command('set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4')
-- Skip leading tab when calculating text width.
- execute('let text=getline(2)')
+ feed_command('let text=getline(2)')
-- Text wraps 3 times.
- execute('let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3')
- execute('$put =g:test')
- execute([[$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)]])
- execute([[let g:str="\t\t\t\t\t{"]])
- execute('let g:test=" Test 12: breakindent + long indent"')
- execute('wincmd p')
- execute('set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4')
- execute('$put =g:str')
+ feed_command('let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3')
+ feed_command('$put =g:test')
+ feed_command([[$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)]])
+ feed_command([[let g:str="\t\t\t\t\t{"]])
+ feed_command('let g:test=" Test 12: breakindent + long indent"')
+ feed_command('wincmd p')
+ feed_command('set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4')
+ feed_command('$put =g:str')
feed('zt')
- execute('let line1=ScreenChar(1,10)')
- execute('wincmd p')
- execute('call DoRecordScreen()')
+ feed_command('let line1=ScreenChar(1,10)')
+ feed_command('wincmd p')
+ feed_command('call DoRecordScreen()')
-- Test, that the string " a\tb\tc\td\te" is correctly displayed in a
-- 20 column wide window (see bug report
-- https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ ).
- execute('only')
- execute('vert 20new')
- execute('set all& breakindent briopt=min:10')
- execute([[call setline(1, [" a\tb\tc\td\te", " z y x w v"])]])
- execute([[/^\s*a]])
+ feed_command('only')
+ feed_command('vert 20new')
+ feed_command('set all& breakindent briopt=min:10')
+ feed_command([[call setline(1, [" a\tb\tc\td\te", " z y x w v"])]])
+ feed_command([[/^\s*a]])
feed('fbgjyl')
- execute('let line1 = @0')
- execute([[?^\s*z]])
+ feed_command('let line1 = @0')
+ feed_command([[?^\s*z]])
feed('fygjyl')
- execute('let line2 = @0')
- execute('quit!')
- execute([[$put ='Test 13: breakindent with wrapping Tab']])
- execute('$put =line1')
- execute('$put =line2')
-
- execute('let g:test="Test 14: breakindent + visual blockwise delete #1"')
- execute('set all& breakindent shada+=nX-test-breakindent.shada')
- execute('30vnew')
- execute('normal! 3a1234567890')
- execute('normal! a abcde')
- execute([[exec "normal! 0\<C-V>tex"]])
- execute('let line1=ScreenChar(line("."),8)')
- execute('call DoRecordScreen()')
-
- execute('let g:test="Test 15: breakindent + visual blockwise delete #2"')
- execute('%d')
- execute('normal! 4a1234567890')
- execute([[exec "normal! >>\<C-V>3f0x"]])
- execute('let line1=ScreenChar(line("."),20)')
- execute('call DoRecordScreen()')
- execute('quit!')
+ feed_command('let line2 = @0')
+ feed_command('quit!')
+ feed_command([[$put ='Test 13: breakindent with wrapping Tab']])
+ feed_command('$put =line1')
+ feed_command('$put =line2')
+
+ feed_command('let g:test="Test 14: breakindent + visual blockwise delete #1"')
+ feed_command('set all& breakindent shada+=nX-test-breakindent.shada')
+ feed_command('30vnew')
+ feed_command('normal! 3a1234567890')
+ feed_command('normal! a abcde')
+ feed_command([[exec "normal! 0\<C-V>tex"]])
+ feed_command('let line1=ScreenChar(line("."),8)')
+ feed_command('call DoRecordScreen()')
+
+ feed_command('let g:test="Test 15: breakindent + visual blockwise delete #2"')
+ feed_command('%d')
+ feed_command('normal! 4a1234567890')
+ feed_command([[exec "normal! >>\<C-V>3f0x"]])
+ feed_command('let line1=ScreenChar(line("."),20)')
+ feed_command('call DoRecordScreen()')
+ feed_command('quit!')
-- Assert buffer contents.
expect([[
-
+
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP
-
+
Test 1: Simple breakindent
abcd
qrst
GHIJ
-
+
Test 2: Simple breakindent + sbr=>>
abcd
>>qr
>>EF
-
+
Test 3: Simple breakindent + briopt:sbr
abcd
++ qrst
++ GHIJ
-
+
Test 4: Simple breakindent + min width: 18
abcd
qrstuv
IJKLMN
-
+
Test 5: Simple breakindent + shift by 2
abcd
qr
EF
-
+
Test 6: Simple breakindent + shift by -1
abcd
qrstu
HIJKL
-
+
Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr
2 ab
? m
? x
-
+
Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr
2 ^Iabcd
# opq
# BCD
-
+
Test 9: breakindent + shift by +1 + 'nu' + sbr=# list
2 ^Iabcd
#op
#AB
-
+
Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n
2 ab
~ mn
~ yz
-
+
Test 11: strdisplaywidth when breakindent is on
strdisplaywidth: 46 == calculated: 64
{
-
+
Test 12: breakindent + long indent
56
@@ -197,12 +197,12 @@ describe('breakindent', function()
Test 13: breakindent with wrapping Tab
d
w
-
+
Test 14: breakindent + visual blockwise delete #1
e
~
~
-
+
Test 15: breakindent + visual blockwise delete #2
1234567890
~
diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua
index c718da3736..72c9872163 100644
--- a/test/functional/legacy/changelist_spec.lua
+++ b/test/functional/legacy/changelist_spec.lua
@@ -3,7 +3,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('changelist', function()
setup(clear)
@@ -12,14 +12,14 @@ describe('changelist', function()
insert("1\n2")
feed('Gkylp')
- execute('set ul=100')
+ feed_command('set ul=100')
feed('Gylp')
- execute('set ul=100')
+ feed_command('set ul=100')
feed('gg')
- execute('vsplit')
- execute('try', 'normal g;', 'normal ggVGcpass', 'catch', 'normal ggVGcfail', 'endtry')
+ feed_command('vsplit')
+ feed_command('try', 'normal g;', 'normal ggVGcpass', 'catch', 'normal ggVGcfail', 'endtry')
expect('pass')
end)
diff --git a/test/functional/legacy/charsearch_spec.lua b/test/functional/legacy/charsearch_spec.lua
index ef3369728d..c1a59c9ee1 100644
--- a/test/functional/legacy/charsearch_spec.lua
+++ b/test/functional/legacy/charsearch_spec.lua
@@ -2,7 +2,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('charsearch', function()
setup(clear)
@@ -14,23 +14,23 @@ describe('charsearch', function()
Zabcdefghijkemnokqretkvwxyz]])
-- Check that "fe" and ";" work.
- execute('/^X')
+ feed_command('/^X')
feed('ylfep;;p,,p')
-- Check that save/restore works.
- execute('/^Y')
+ feed_command('/^Y')
feed('ylfep')
- execute('let csave = getcharsearch()')
+ feed_command('let csave = getcharsearch()')
feed('fip')
- execute('call setcharsearch(csave)')
+ feed_command('call setcharsearch(csave)')
feed(';p;p')
-- Check that setcharsearch() changes the settings.
- execute('/^Z')
+ feed_command('/^Z')
feed('ylfep')
- execute("call setcharsearch({'char': 'k'})")
+ feed_command("call setcharsearch({'char': 'k'})")
feed(';p')
- execute("call setcharsearch({'forward': 0})")
+ feed_command("call setcharsearch({'forward': 0})")
feed('$;p')
- execute("call setcharsearch({'until': 1})")
+ feed_command("call setcharsearch({'until': 1})")
feed(';;p')
-- Assert buffer contents.
diff --git a/test/functional/legacy/close_count_spec.lua b/test/functional/legacy/close_count_spec.lua
index ad1812f22e..9b932e2ef0 100644
--- a/test/functional/legacy/close_count_spec.lua
+++ b/test/functional/legacy/close_count_spec.lua
@@ -1,133 +1,134 @@
-- Tests for :[count]close! and :[count]hide
local helpers = require('test.functional.helpers')(after_each)
-local feed, eval, eq, clear, execute =
- helpers.feed, helpers.eval, helpers.eq, helpers.clear, helpers.execute
+
+local eq = helpers.eq
+local wait = helpers.wait
+local eval = helpers.eval
+local feed = helpers.feed
+local clear = helpers.clear
+local command = helpers.command
describe('close_count', function()
setup(clear)
it('is working', function()
- execute('let tests = []')
- execute('for i in range(5)')
- execute('new')
- execute('endfor')
- execute('4wincmd w')
- execute('close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('let tests = []')
+ command('for i in range(5)|new|endfor')
+ command('4wincmd w')
+ command('close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({6, 5, 4, 2, 1}, eval('buffers'))
- execute('1close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({5, 4, 2, 1}, eval('buffers'))
- execute('$close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('$close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({5, 4, 2}, eval('buffers'))
- execute('1wincmd w')
- execute('2close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1wincmd w')
+ command('2close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({5, 2}, eval('buffers'))
- execute('1wincmd w')
- execute('new')
- execute('new')
- execute('2wincmd w')
- execute('-1close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1wincmd w')
+ command('new')
+ command('new')
+ command('2wincmd w')
+ command('-1close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({7, 5, 2}, eval('buffers'))
- execute('2wincmd w')
- execute('+1close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('2wincmd w')
+ command('+1close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({7, 5}, eval('buffers'))
- execute('only!')
- execute('b1')
- execute('let tests = []')
- execute('for i in range(5)')
- execute('new')
- execute('endfor')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('only!')
+ command('b1')
+ command('let tests = []')
+ command('for i in range(5)|new|endfor')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({13, 12, 11, 10, 9, 1}, eval('buffers'))
- execute('4wincmd w')
- execute('.hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('4wincmd w')
+ command('.hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({13, 12, 11, 9, 1}, eval('buffers'))
- execute('1hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({12, 11, 9, 1}, eval('buffers'))
- execute('$hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('$hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({12, 11, 9}, eval('buffers'))
- execute('1wincmd w')
- execute('2hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1wincmd w')
+ command('2hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({12, 9}, eval('buffers'))
- execute('1wincmd w')
- execute('new')
- execute('new')
- execute('3wincmd w')
- execute('-hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1wincmd w')
+ command('new')
+ command('new')
+ command('3wincmd w')
+ command('-hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({15, 12, 9}, eval('buffers'))
- execute('2wincmd w')
- execute('+hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('2wincmd w')
+ command('+hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({15, 12}, eval('buffers'))
- execute('only!')
- execute('b1')
- execute('let tests = []')
- execute('set hidden')
- execute('for i in range(5)')
- execute('new')
- execute('endfor')
- execute('1wincmd w')
- execute('$ hide')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('only!')
+ command('b1')
+ command('let tests = []')
+ command('set hidden')
+ command('for i in range(5)|new|endfor')
+ command('1wincmd w')
+ command('$ hide')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({20, 19, 18, 17, 16}, eval('buffers'))
- execute('$-1 close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('$-1 close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({20, 19, 18, 16}, eval('buffers'))
- execute('1wincmd w')
- execute('.+close!')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ command('1wincmd w')
+ command('.+close!')
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({20, 18, 16}, eval('buffers'))
- execute('only!')
- execute('b1')
- execute('let tests = []')
- execute('set hidden')
- execute('for i in range(5)')
- execute('new')
- execute('endfor')
- execute('4wincmd w')
+ command('only!')
+ command('b1')
+ command('let tests = []')
+ command('set hidden')
+ command('for i in range(5)|new|endfor')
+ command('4wincmd w')
feed('<C-W>c<cr>')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ wait()
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({25, 24, 23, 21, 1}, eval('buffers'))
feed('1<C-W>c<cr>')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ wait()
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21, 1}, eval('buffers'))
feed('9<C-W>c<cr>')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ wait()
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({24, 23, 21}, eval('buffers'))
- execute('1wincmd w')
+ command('1wincmd w')
feed('2<C-W>c<cr>')
- execute('let buffers = []')
- execute('windo call add(buffers, bufnr("%"))')
+ wait()
+ command('let buffers = []')
+ command('windo call add(buffers, bufnr("%"))')
eq({24, 21}, eval('buffers'))
end)
end)
diff --git a/test/functional/legacy/command_count_spec.lua b/test/functional/legacy/command_count_spec.lua
index c463ada968..ad5368430a 100644
--- a/test/functional/legacy/command_count_spec.lua
+++ b/test/functional/legacy/command_count_spec.lua
@@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source, expect = helpers.clear, helpers.source, helpers.expect
-local execute = helpers.execute
+local feed_command = helpers.feed_command
describe('command_count', function()
it('is working', function()
@@ -87,35 +87,35 @@ describe('command_count', function()
arga a b c d
]])
-- This can not be in the source() call as it will produce errors.
- execute([[let v:errmsg = '']])
- execute('5argu')
- execute([[call add(g:lines, '5argu ' . v:errmsg)]])
- execute('$argu')
- execute([[call add(g:lines, '4argu ' . expand('%:t'))]])
- execute([[let v:errmsg = '']])
- execute('1argu')
- execute([[call add(g:lines, '1argu ' . expand('%:t'))]])
- execute([[let v:errmsg = '']])
- execute('100b')
- execute([[call add(g:lines, '100b ' . v:errmsg)]])
- execute('split')
- execute('split')
- execute('split')
- execute('split')
- execute([[let v:errmsg = '']])
- execute('0close')
- execute([[call add(g:lines, '0close ' . v:errmsg)]])
- execute('$wincmd w')
- execute('$close')
- execute([[call add(g:lines, '$close ' . winnr())]])
- execute([[let v:errmsg = '']])
- execute('$+close')
- execute([[call add(g:lines, '$+close ' . v:errmsg)]])
- execute('$tabe')
- execute([[call add(g:lines, '$tabe ' . tabpagenr())]])
- execute([[let v:errmsg = '']])
- execute('$+tabe')
- execute([[call add(g:lines, '$+tabe ' . v:errmsg)]])
+ feed_command([[let v:errmsg = '']])
+ feed_command('5argu')
+ feed_command([[call add(g:lines, '5argu ' . v:errmsg)]])
+ feed_command('$argu')
+ feed_command([[call add(g:lines, '4argu ' . expand('%:t'))]])
+ feed_command([[let v:errmsg = '']])
+ feed_command('1argu')
+ feed_command([[call add(g:lines, '1argu ' . expand('%:t'))]])
+ feed_command([[let v:errmsg = '']])
+ feed_command('100b')
+ feed_command([[call add(g:lines, '100b ' . v:errmsg)]])
+ feed_command('split')
+ feed_command('split')
+ feed_command('split')
+ feed_command('split')
+ feed_command([[let v:errmsg = '']])
+ feed_command('0close')
+ feed_command([[call add(g:lines, '0close ' . v:errmsg)]])
+ feed_command('$wincmd w')
+ feed_command('$close')
+ feed_command([[call add(g:lines, '$close ' . winnr())]])
+ feed_command([[let v:errmsg = '']])
+ feed_command('$+close')
+ feed_command([[call add(g:lines, '$+close ' . v:errmsg)]])
+ feed_command('$tabe')
+ feed_command([[call add(g:lines, '$tabe ' . tabpagenr())]])
+ feed_command([[let v:errmsg = '']])
+ feed_command('$+tabe')
+ feed_command([[call add(g:lines, '$+tabe ' . v:errmsg)]])
source([[
only!
e x
diff --git a/test/functional/legacy/comparators_spec.lua b/test/functional/legacy/comparators_spec.lua
index 27879b0f65..32e830a0af 100644
--- a/test/functional/legacy/comparators_spec.lua
+++ b/test/functional/legacy/comparators_spec.lua
@@ -2,13 +2,13 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
-local eval, execute = helpers.eval, helpers.execute
+local eval, command = helpers.eval, helpers.command
describe('comparators', function()
before_each(clear)
it('is working', function()
- execute('set isident+=#')
+ command('set isident+=#')
eq(1, eval('1 is#1'))
end)
end)
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index cd19e31a79..aeaab335e8 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -1,6 +1,6 @@
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
+local eq, eval, command = helpers.eq, helpers.eval, helpers.command
if helpers.pending_win32(pending) then return end
@@ -8,30 +8,30 @@ describe('Test for delete()', function()
before_each(clear)
it('file delete', function()
- execute('split Xfile')
- execute("call setline(1, ['a', 'b'])")
- execute('wq')
+ command('split Xfile')
+ command("call setline(1, ['a', 'b'])")
+ command('wq')
eq(eval("['a', 'b']"), eval("readfile('Xfile')"))
eq(0, eval("delete('Xfile')"))
eq(-1, eval("delete('Xfile')"))
end)
it('directory delete', function()
- execute("call mkdir('Xdir1')")
+ command("call mkdir('Xdir1')")
eq(1, eval("isdirectory('Xdir1')"))
eq(0, eval("delete('Xdir1', 'd')"))
eq(0, eval("isdirectory('Xdir1')"))
eq(-1, eval("delete('Xdir1', 'd')"))
end)
it('recursive delete', function()
- execute("call mkdir('Xdir1')")
- execute("call mkdir('Xdir1/subdir')")
- execute("call mkdir('Xdir1/empty')")
- execute('split Xdir1/Xfile')
- execute("call setline(1, ['a', 'b'])")
- execute('w')
- execute('w Xdir1/subdir/Xfile')
- execute('close')
+ command("call mkdir('Xdir1')")
+ command("call mkdir('Xdir1/subdir')")
+ command("call mkdir('Xdir1/empty')")
+ command('split Xdir1/Xfile')
+ command("call setline(1, ['a', 'b'])")
+ command('w')
+ command('w Xdir1/subdir/Xfile')
+ command('close')
eq(1, eval("isdirectory('Xdir1')"))
eq(eval("['a', 'b']"), eval("readfile('Xdir1/Xfile')"))
@@ -57,8 +57,8 @@ describe('Test for delete()', function()
end)
it('symlink directory delete', function()
- execute("call mkdir('Xdir1')")
- execute("silent !ln -s Xdir1 Xlink")
+ command("call mkdir('Xdir1')")
+ command("silent !ln -s Xdir1 Xlink")
eq(1, eval("isdirectory('Xdir1')"))
eq(1, eval("isdirectory('Xlink')"))
-- Delete the link, not the directory
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 3684fe714d..d7ef508194 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -2,8 +2,11 @@
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 clear, command, expect = helpers.clear, helpers.command, helpers.expect
local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file
+local wait = helpers.wait
+local exc_exec = helpers.exc_exec
+local dedent = helpers.dedent
describe('eval', function()
setup(function()
@@ -37,17 +40,17 @@ describe('eval', function()
end)
it(':let', function()
- execute('so test_eval_setup.vim')
- execute([[let @" = 'abc']])
- execute('AR "')
- execute([[let @" = "abc\n"]])
+ command('so test_eval_setup.vim')
+ command([[let @" = 'abc']])
+ command('AR "')
+ command([[let @" = "abc\n"]])
source('AR "')
- execute([[let @" = "abc\<C-m>"]])
- execute('AR "')
- execute([[let @= = '"abc"']])
- execute('AR =')
+ command([[let @" = "abc\<C-m>"]])
+ command('AR "')
+ command([[let @= = '"abc"']])
+ command('AR =')
expect([[
-
+
": type v; value: abc (['abc']), expr: abc (['abc'])
": type V; value: abc]].."\000 (['abc']), expr: abc\000"..[[ (['abc'])
": type V; value: abc]].."\r\000 (['abc\r']), expr: abc\r\000 (['abc\r"..[['])
@@ -55,32 +58,33 @@ describe('eval', function()
end)
it('basic setreg() tests', function()
- execute('so test_eval_setup.vim')
+ command('so test_eval_setup.vim')
insert('{{{1 Basic setreg tests')
- execute([[call SetReg('a', 'abcA', 'c')]])
- execute([[call SetReg('b', 'abcB', 'v')]])
- execute([[call SetReg('c', 'abcC', 'l')]])
- execute([[call SetReg('d', 'abcD', 'V')]])
- execute([[call SetReg('e', 'abcE', 'b')]])
- execute([[call SetReg('f', 'abcF', "\<C-v>")]])
- execute([[call SetReg('g', 'abcG', 'b10')]])
- execute([[call SetReg('h', 'abcH', "\<C-v>10")]])
- execute([[call SetReg('I', 'abcI')]])
+ command([[call SetReg('a', 'abcA', 'c')]])
+ command([[call SetReg('b', 'abcB', 'v')]])
+ command([[call SetReg('c', 'abcC', 'l')]])
+ command([[call SetReg('d', 'abcD', 'V')]])
+ command([[call SetReg('e', 'abcE', 'b')]])
+ command([[call SetReg('f', 'abcF', "\<C-v>")]])
+ command([[call SetReg('g', 'abcG', 'b10')]])
+ command([[call SetReg('h', 'abcH', "\<C-v>10")]])
+ command([[call SetReg('I', 'abcI')]])
feed('Go{{{1 Appending single lines with setreg()<esc>')
- execute([[call SetReg('A', 'abcAc', 'c')]])
- execute([[call SetReg('A', 'abcAl', 'l')]])
- execute([[call SetReg('A', 'abcAc2','c')]])
- execute([[call SetReg('b', 'abcBc', 'ca')]])
- execute([[call SetReg('b', 'abcBb', 'ba')]])
- execute([[call SetReg('b', 'abcBc2','ca')]])
- execute([[call SetReg('b', 'abcBb2','b50a')]])
- execute([[call SetReg('C', 'abcCl', 'l')]])
- execute([[call SetReg('C', 'abcCc', 'c')]])
- execute([[call SetReg('D', 'abcDb', 'b')]])
- execute([[call SetReg('E', 'abcEb', 'b')]])
- execute([[call SetReg('E', 'abcEl', 'l')]])
- execute([[call SetReg('F', 'abcFc', 'c')]])
+ wait()
+ command([[call SetReg('A', 'abcAc', 'c')]])
+ command([[call SetReg('A', 'abcAl', 'l')]])
+ command([[call SetReg('A', 'abcAc2','c')]])
+ command([[call SetReg('b', 'abcBc', 'ca')]])
+ command([[call SetReg('b', 'abcBb', 'ba')]])
+ command([[call SetReg('b', 'abcBc2','ca')]])
+ command([[call SetReg('b', 'abcBb2','b50a')]])
+ command([[call SetReg('C', 'abcCl', 'l')]])
+ command([[call SetReg('C', 'abcCc', 'c')]])
+ command([[call SetReg('D', 'abcDb', 'b')]])
+ command([[call SetReg('E', 'abcEb', 'b')]])
+ command([[call SetReg('E', 'abcEl', 'l')]])
+ command([[call SetReg('F', 'abcFc', 'c')]])
expect([[
{{{1 Basic setreg tests
{{{2 setreg('a', 'abcA', 'c')
@@ -191,14 +195,14 @@ describe('eval', function()
end)
it('appending NL with setreg()', function()
- execute('so test_eval_setup.vim')
-
- execute([[call setreg('a', 'abcA2', 'c')]])
- execute([[call setreg('b', 'abcB2', 'v')]])
- execute([[call setreg('c', 'abcC2', 'l')]])
- execute([[call setreg('d', 'abcD2', 'V')]])
- execute([[call setreg('e', 'abcE2', 'b')]])
- execute([[call setreg('f', 'abcF2', "\<C-v>")]])
+ command('so test_eval_setup.vim')
+
+ command([[call setreg('a', 'abcA2', 'c')]])
+ command([[call setreg('b', 'abcB2', 'v')]])
+ command([[call setreg('c', 'abcC2', 'l')]])
+ command([[call setreg('d', 'abcD2', 'V')]])
+ command([[call setreg('e', 'abcE2', 'b')]])
+ command([[call setreg('f', 'abcF2', "\<C-v>")]])
-- These registers where set like this in the old test_eval.in but never
-- copied to the output buffer with SetReg(). They do not appear in
-- test_eval.ok. Therefore they are commented out.
@@ -206,14 +210,14 @@ describe('eval', function()
--execute([[call setreg('h', 'abcH2', "\<C-v>10")]])
--execute([[call setreg('I', 'abcI2')]])
- execute([[call SetReg('A', "\n")]])
- execute([[call SetReg('B', "\n", 'c')]])
- execute([[call SetReg('C', "\n")]])
- execute([[call SetReg('D', "\n", 'l')]])
- execute([[call SetReg('E', "\n")]])
- execute([[call SetReg('F', "\n", 'b')]])
+ command([[call SetReg('A', "\n")]])
+ command([[call SetReg('B', "\n", 'c')]])
+ command([[call SetReg('C', "\n")]])
+ command([[call SetReg('D', "\n", 'l')]])
+ command([[call SetReg('E', "\n")]])
+ command([[call SetReg('F', "\n", 'b')]])
expect([[
-
+
{{{2 setreg('A', ']]..'\000'..[[')
A: type V; value: abcA2]].."\000 (['abcA2']), expr: abcA2\000"..[[ (['abcA2'])
==
@@ -228,19 +232,19 @@ describe('eval', function()
C: type V; value: abcC2]].."\000\000 (['abcC2', '']), expr: abcC2\000\000"..[[ (['abcC2', ''])
==
abcC2
-
+
==
{{{2 setreg('D', ']]..'\000'..[[', 'l')
D: type V; value: abcD2]].."\000\000 (['abcD2', '']), expr: abcD2\000\000"..[[ (['abcD2', ''])
==
abcD2
-
+
==
{{{2 setreg('E', ']]..'\000'..[[')
E: type V; value: abcE2]].."\000\000 (['abcE2', '']), expr: abcE2\000\000"..[[ (['abcE2', ''])
==
abcE2
-
+
==
{{{2 setreg('F', ']]..'\000'..[[', 'b')
F: type ]].."\0220; value: abcF2\000 (['abcF2', '']), expr: abcF2\000"..[[ (['abcF2', ''])
@@ -250,27 +254,27 @@ describe('eval', function()
end)
it('setting and appending list with setreg()', function()
- execute('so test_eval_setup.vim')
-
- execute([[$put ='{{{1 Setting lists with setreg()']])
- execute([=[call SetReg('a', ['abcA3'], 'c')]=])
- execute([=[call SetReg('b', ['abcB3'], 'l')]=])
- execute([=[call SetReg('c', ['abcC3'], 'b')]=])
- execute([=[call SetReg('d', ['abcD3'])]=])
- execute([=[call SetReg('e', [1, 2, 'abc', 3])]=])
- execute([=[call SetReg('f', [1, 2, 3])]=])
-
- execute([[$put ='{{{1 Appending lists with setreg()']])
- execute([=[call SetReg('A', ['abcA3c'], 'c')]=])
- execute([=[call SetReg('b', ['abcB3l'], 'la')]=])
- execute([=[call SetReg('C', ['abcC3b'], 'lb')]=])
- execute([=[call SetReg('D', ['abcD32'])]=])
- execute([=[call SetReg('A', ['abcA32'])]=])
- execute([=[call SetReg('B', ['abcB3c'], 'c')]=])
- execute([=[call SetReg('C', ['abcC3l'], 'l')]=])
- execute([=[call SetReg('D', ['abcD3b'], 'b')]=])
+ command('so test_eval_setup.vim')
+
+ command([[$put ='{{{1 Setting lists with setreg()']])
+ command([=[call SetReg('a', ['abcA3'], 'c')]=])
+ command([=[call SetReg('b', ['abcB3'], 'l')]=])
+ command([=[call SetReg('c', ['abcC3'], 'b')]=])
+ command([=[call SetReg('d', ['abcD3'])]=])
+ command([=[call SetReg('e', [1, 2, 'abc', 3])]=])
+ command([=[call SetReg('f', [1, 2, 3])]=])
+
+ command([[$put ='{{{1 Appending lists with setreg()']])
+ command([=[call SetReg('A', ['abcA3c'], 'c')]=])
+ command([=[call SetReg('b', ['abcB3l'], 'la')]=])
+ command([=[call SetReg('C', ['abcC3b'], 'lb')]=])
+ command([=[call SetReg('D', ['abcD32'])]=])
+ command([=[call SetReg('A', ['abcA32'])]=])
+ command([=[call SetReg('B', ['abcB3c'], 'c')]=])
+ command([=[call SetReg('C', ['abcC3l'], 'l')]=])
+ command([=[call SetReg('D', ['abcD3b'], 'b')]=])
expect([[
-
+
{{{1 Setting lists with setreg()
{{{2 setreg('a', ['abcA3'], 'c')
a: type v; value: abcA3 (['abcA3']), expr: abcA3 (['abcA3'])
@@ -359,9 +363,9 @@ describe('eval', function()
-- the next expect() easier to write. This is neccessary because null
-- bytes on a line by itself don't play well together with the dedent
-- function used in expect().
- execute('%delete')
- execute([[$put ='{{{1 Appending lists with NL with setreg()']])
- execute([=[call SetReg('A', ["\n", 'abcA3l2'], 'l')]=])
+ command('%delete')
+ command([[$put ='{{{1 Appending lists with NL with setreg()']])
+ command([=[call SetReg('A', ["\n", 'abcA3l2'], 'l')]=])
expect(
'\n'..
'{{{1 Appending lists with NL with setreg()\n'..
@@ -374,8 +378,8 @@ describe('eval', function()
'\000\n'..
'abcA3l2\n'..
'==')
- execute('%delete')
- execute([=[call SetReg('B', ["\n", 'abcB3c2'], 'c')]=])
+ command('%delete')
+ command([=[call SetReg('B', ["\n", 'abcB3c2'], 'c')]=])
expect(
'\n'..
"{{{2 setreg('B', ['\000', 'abcB3c2'], 'c')\n"..
@@ -386,8 +390,8 @@ describe('eval', function()
'abcB3c\n'..
'\000\n'..
'abcB3c2=')
- execute('%delete')
- execute([=[call SetReg('C', ["\n", 'abcC3b2'], 'b')]=])
+ command('%delete')
+ command([=[call SetReg('C', ["\n", 'abcC3b2'], 'b')]=])
expect(
'\n'..
"{{{2 setreg('C', ['\000', 'abcC3b2'], 'b')\n"..
@@ -398,8 +402,8 @@ describe('eval', function()
' abcC3l\n'..
' \000\n'..
' abcC3b2')
- execute('%delete')
- execute([=[call SetReg('D', ["\n", 'abcD3b50'],'b50')]=])
+ command('%delete')
+ command([=[call SetReg('D', ["\n", 'abcD3b50'],'b50')]=])
expect(
'\n'..
"{{{2 setreg('D', ['\000', 'abcD3b50'], 'b50')\n"..
@@ -416,8 +420,8 @@ describe('eval', function()
-- to make the expect() calls easier to write. Otherwise the null byte can
-- make trouble on a line on its own.
it('setting lists with NLs with setreg(), part 1', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=])
expect(
'\n'..
"{{{2 setreg('a', ['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"..
@@ -432,8 +436,8 @@ describe('eval', function()
end)
it('setting lists with NLs with setreg(), part 2', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=])
expect(
'\n'..
"{{{2 setreg('b', ['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'], 'c')\n"..
@@ -447,8 +451,8 @@ describe('eval', function()
end)
it('setting lists with NLs with setreg(), part 3', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=])
expect(
'\n'..
"{{{2 setreg('c', ['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'], 'l')\n"..
@@ -462,8 +466,8 @@ describe('eval', function()
'==')
end)
it('setting lists with NLs with setreg(), part 4', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=])
expect(
'\n'..
"{{{2 setreg('d', ['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'], 'b')\n"..
@@ -476,8 +480,8 @@ describe('eval', function()
' abcD4b-4\000abcD4b-4-2')
end)
it('setting lists with NLs with setreg(), part 5', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=])
expect(
'\n'..
"{{{2 setreg('e', ['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'], 'b10')\n"..
@@ -494,32 +498,32 @@ describe('eval', function()
-- Precondition: "a is actually unset and "0 is nonempty
eq('', eval("getregtype('a')"))
eq('', eval("getreg('a')"))
- execute("call setreg('0','text')")
+ command("call setreg('0','text')")
-- This used to return a NULL list
-- which setreg didn't handle
- execute("let x = getreg('a',1,1)")
- execute("call setreg('0',x)")
+ command("let x = getreg('a',1,1)")
+ command("call setreg('0',x)")
-- nvim didn't crash and "0 was emptied
eq(2, eval("1+1"))
eq({}, eval("getreg('0',1,1)"))
-- x is a mutable list
- execute("let y = x")
+ command("let y = x")
eq({}, eval("y"))
- execute("call add(x, 'item')")
+ command("call add(x, 'item')")
eq({'item'}, eval("y"))
end)
it('search and expressions', function()
- execute('so test_eval_setup.vim')
- execute([=[call SetReg('/', ['abc/'])]=])
- execute([=[call SetReg('/', ["abc/\n"])]=])
- execute([=[call SetReg('=', ['"abc/"'])]=])
- execute([=[call SetReg('=', ["\"abc/\n\""])]=])
+ command('so test_eval_setup.vim')
+ command([=[call SetReg('/', ['abc/'])]=])
+ command([=[call SetReg('/', ["abc/\n"])]=])
+ command([=[call SetReg('=', ['"abc/"'])]=])
+ command([=[call SetReg('=', ["\"abc/\n\""])]=])
expect([[
-
+
{{{2 setreg('/', ['abc/'])
/: type v; value: abc/ (['abc/']), expr: abc/ (['abc/'])
==
@@ -536,35 +540,35 @@ describe('eval', function()
describe('system clipboard', function()
before_each(function()
- execute('let &runtimepath = "test/functional/fixtures,".&runtimepath')
- execute('call getreg("*")') -- force load of provider
+ command('let &runtimepath = "test/functional/fixtures,".&runtimepath')
+ command('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).
-
+
Note: system clipboard is saved, changed and restored.
-
+
clipboard contents
something else]])
- execute('so test_eval_setup.vim')
+ command('so test_eval_setup.vim')
-- Save and restore system clipboard.
- execute("let _clipreg = ['*', getreg('*'), getregtype('*')]")
- execute('let _clipopt = &cb')
- execute("let &cb='unnamed'")
- execute('5y')
- execute('AR *')
- execute('tabdo :windo :echo "hi"')
- execute('6y')
- execute('AR *')
- execute('let &cb=_clipopt')
- execute("call call('setreg', _clipreg)")
+ command("let _clipreg = ['*', getreg('*'), getregtype('*')]")
+ command('let _clipopt = &cb')
+ command("let &cb='unnamed'")
+ command('5y')
+ command('AR *')
+ command('tabdo :windo :echo "hi"')
+ command('6y')
+ command('AR *')
+ command('let &cb=_clipopt')
+ command("call call('setreg', _clipreg)")
expect([[
Some first line (this text was at the top of the old test_eval.in).
-
+
Note: system clipboard is saved, changed and restored.
-
+
clipboard contents
something else
*: type V; value: clipboard contents]]..'\00'..[[ (['clipboard contents']), expr: clipboard contents]]..'\00'..[[ (['clipboard contents'])
@@ -582,17 +586,17 @@ describe('eval', function()
$put =v:exception
endtry
endfun]])
- execute([[call ErrExe('call setreg()')]])
- execute([[call ErrExe('call setreg(1)')]])
- execute([[call ErrExe('call setreg(1, 2, 3, 4)')]])
- execute([=[call ErrExe('call setreg([], 2)')]=])
- execute([[call ErrExe('call setreg(1, {})')]])
- execute([=[call ErrExe('call setreg(1, 2, [])')]=])
- execute([=[call ErrExe('call setreg("/", ["1", "2"])')]=])
- execute([=[call ErrExe('call setreg("=", ["1", "2"])')]=])
- execute([=[call ErrExe('call setreg(1, ["", "", [], ""])')]=])
+ command([[call ErrExe('call setreg()')]])
+ command([[call ErrExe('call setreg(1)')]])
+ command([[call ErrExe('call setreg(1, 2, 3, 4)')]])
+ command([=[call ErrExe('call setreg([], 2)')]=])
+ command([[call ErrExe('call setreg(1, {})')]])
+ command([=[call ErrExe('call setreg(1, 2, [])')]=])
+ command([=[call ErrExe('call setreg("/", ["1", "2"])')]=])
+ command([=[call ErrExe('call setreg("=", ["1", "2"])')]=])
+ command([=[call ErrExe('call setreg(1, ["", "", [], ""])')]=])
expect([[
-
+
Executing call setreg()
Vim(call):E119: Not enough arguments for function: setreg
Executing call setreg(1)
@@ -614,48 +618,38 @@ describe('eval', function()
end)
it('function name not starting with a capital', function()
- execute('try')
- execute(' func! g:test()')
- execute(' echo "test"')
- execute(' endfunc')
- execute('catch')
- execute(' let tmp = v:exception')
- execute('endtry')
- eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()', eval('tmp'))
+ eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()\\nendfunction',
+ exc_exec(dedent([[
+ function! g:test()
+ endfunction]])))
end)
it('Function name followed by #', function()
- execute('try')
- execute(' func! test2() "#')
- execute(' echo "test2"')
- execute(' endfunc')
- execute('catch')
- execute(' let tmp = v:exception')
- execute('endtry')
- eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#', eval('tmp'))
+ eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#\\nendfunction',
+ exc_exec(dedent([[
+ function! test2() "#
+ endfunction]])))
end)
it('function name includes a colon', function()
- execute('try')
- execute(' func! b:test()')
- execute(' echo "test"')
- execute(' endfunc')
- execute('catch')
- execute(' let tmp = v:exception')
- execute('endtry')
- eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()', eval('tmp'))
+ eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()\\nendfunction',
+ exc_exec(dedent([[
+ function! b:test()
+ endfunction]])))
end)
it('function name starting with/without "g:", buffer-local funcref', function()
- execute('function! g:Foo(n)')
- execute(" $put ='called Foo(' . a:n . ')'")
- execute('endfunction')
- execute("let b:my_func = function('Foo')")
- execute('call b:my_func(1)')
- execute('echo g:Foo(2)')
- execute('echo Foo(3)')
+ command([[
+ function! g:Foo(n)
+ $put ='called Foo(' . a:n . ')'
+ endfunction
+ ]])
+ command("let b:my_func = function('Foo')")
+ command('call b:my_func(1)')
+ command('echo g:Foo(2)')
+ command('echo Foo(3)')
expect([[
-
+
called Foo(1)
called Foo(2)
called Foo(3)]])
@@ -664,20 +658,20 @@ describe('eval', function()
it('script-local function used in Funcref must exist', function()
source([[
" Vim script used in test_eval.in. Needed for script-local function.
-
+
func! s:Testje()
return "foo"
endfunc
-
+
let Bar = function('s:Testje')
-
+
$put ='s:Testje exists: ' . exists('s:Testje')
$put ='func s:Testje exists: ' . exists('*s:Testje')
$put ='Bar exists: ' . exists('Bar')
$put ='func Bar exists: ' . exists('*Bar')
]])
expect([[
-
+
s:Testje exists: 0
func s:Testje exists: 1
Bar exists: 1
@@ -685,12 +679,8 @@ describe('eval', function()
end)
it("using $ instead of '$' must give an error", function()
- execute('try')
- execute(" call append($, 'foobar')")
- execute('catch')
- execute(' let tmp = v:exception')
- execute('endtry')
- eq('Vim(call):E116: Invalid arguments for function append', eval('tmp'))
+ eq('Vim(call):E116: Invalid arguments for function append',
+ exc_exec('call append($, "foobar")'))
end)
it('getcurpos/setpos', function()
@@ -699,13 +689,16 @@ describe('eval', function()
012345678
start:]])
- execute('/^012345678')
+ command('/^012345678')
feed('6l')
- execute('let sp = getcurpos()')
+ wait()
+ command('let sp = getcurpos()')
feed('0')
- execute("call setpos('.', sp)")
+ wait()
+ command("call setpos('.', sp)")
feed('jyl')
- execute('$put')
+ wait()
+ command('$put')
expect([[
012345678
012345678
@@ -715,18 +708,18 @@ describe('eval', function()
end)
it('substring and variable name', function()
- execute("let str = 'abcdef'")
- execute('let n = 3')
+ command("let str = 'abcdef'")
+ command('let n = 3')
eq('def', eval('str[n:]'))
eq('abcd', eval('str[:n]'))
eq('d', eval('str[n:n]'))
- execute('unlet n')
- execute('let nn = 3')
+ command('unlet n')
+ command('let nn = 3')
eq('def', eval('str[nn:]'))
eq('abcd', eval('str[:nn]'))
eq('d', eval('str[nn:nn]'))
- execute('unlet nn')
- execute('let b:nn = 4')
+ command('unlet nn')
+ command('let b:nn = 4')
eq('ef', eval('str[b:nn:]'))
eq('abcde', eval('str[:b:nn]'))
eq('e', eval('str[b:nn:b:nn]'))
diff --git a/test/functional/legacy/fixeol_spec.lua b/test/functional/legacy/fixeol_spec.lua
index 1e9e832536..801451b300 100644
--- a/test/functional/legacy/fixeol_spec.lua
+++ b/test/functional/legacy/fixeol_spec.lua
@@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')(after_each)
local feed = helpers.feed
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
if helpers.pending_win32(pending) then return end
@@ -25,38 +25,38 @@ describe('fixeol', function()
it('is working', function()
-- First write two test files – with and without trailing EOL.
-- Use Unix fileformat for consistency.
- execute('set ff=unix')
- execute('enew!')
+ feed_command('set ff=unix')
+ feed_command('enew!')
feed('awith eol<esc>:w! XXEol<cr>')
- execute('enew!')
- execute('set noeol nofixeol')
+ feed_command('enew!')
+ feed_command('set noeol nofixeol')
feed('awithout eol<esc>:w! XXNoEol<cr>')
- execute('set eol fixeol')
- execute('bwipe XXEol XXNoEol')
+ feed_command('set eol fixeol')
+ feed_command('bwipe XXEol XXNoEol')
-- Try editing files with 'fixeol' disabled.
- execute('e! XXEol')
+ feed_command('e! XXEol')
feed('ostays eol<esc>:set nofixeol<cr>')
- execute('w! XXTestEol')
- execute('e! XXNoEol')
+ feed_command('w! XXTestEol')
+ feed_command('e! XXNoEol')
feed('ostays without<esc>:set nofixeol<cr>')
- execute('w! XXTestNoEol')
- execute('bwipe XXEol XXNoEol XXTestEol XXTestNoEol')
- execute('set fixeol')
+ feed_command('w! XXTestNoEol')
+ feed_command('bwipe XXEol XXNoEol XXTestEol XXTestNoEol')
+ feed_command('set fixeol')
-- Append "END" to each file so that we can see what the last written char was.
feed('ggdGaEND<esc>:w >>XXEol<cr>')
- execute('w >>XXNoEol')
- execute('w >>XXTestEol')
- execute('w >>XXTestNoEol')
+ feed_command('w >>XXNoEol')
+ feed_command('w >>XXTestEol')
+ feed_command('w >>XXTestNoEol')
-- Concatenate the results.
- execute('e! test.out')
+ feed_command('e! test.out')
feed('a0<esc>:$r XXEol<cr>')
- execute('$r XXNoEol')
+ feed_command('$r XXNoEol')
feed('Go1<esc>:$r XXTestEol<cr>')
- execute('$r XXTestNoEol')
- execute('w')
+ feed_command('$r XXTestNoEol')
+ feed_command('w')
-- Assert buffer contents.
expect([=[
diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua
index 1b65f1ce95..12875460e0 100644
--- a/test/functional/legacy/function_sort_spec.lua
+++ b/test/functional/legacy/function_sort_spec.lua
@@ -1,10 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear = helpers.clear
+
local eq = helpers.eq
+local neq = helpers.neq
local eval = helpers.eval
-local execute = helpers.execute
+local clear = helpers.clear
+local source = helpers.source
local exc_exec = helpers.exc_exec
-local neq = helpers.neq
describe('sort', function()
before_each(clear)
@@ -31,14 +32,17 @@ describe('sort', function()
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')
+ source([[
+ function Compare1(a, b) abort
+ call sort(range(3), 'Compare2')
+ return a:a - a:b
+ endfunc
+
+ function Compare2(a, b) abort
+ return a:a - a:b
+ endfunc
+ ]])
+
eq({1, 3, 5}, eval("sort([3, 1, 5], 'Compare1')"))
end)
diff --git a/test/functional/legacy/getcwd_spec.lua b/test/functional/legacy/getcwd_spec.lua
index dcb56eb242..8fb31ccd22 100644
--- a/test/functional/legacy/getcwd_spec.lua
+++ b/test/functional/legacy/getcwd_spec.lua
@@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')(after_each)
local eq, eval, source = helpers.eq, helpers.eval, helpers.source
-local call, clear, execute = helpers.call, helpers.clear, helpers.execute
+local call, clear, command = helpers.call, helpers.clear, helpers.command
if helpers.pending_win32(pending) then return end
@@ -39,48 +39,48 @@ describe('getcwd', function()
return bufname . ' ' . dirname . ' ' . lflag
endfunction
]])
- execute('new')
- execute('let cwd=getcwd()')
+ command('new')
+ command('let cwd=getcwd()')
call('mkdir', 'Xtopdir')
- execute('silent cd Xtopdir')
+ command('silent cd Xtopdir')
call('mkdir', 'Xdir1')
call('mkdir', 'Xdir2')
call('mkdir', 'Xdir3')
- execute('new a')
- execute('new b')
- execute('new c')
- execute('3wincmd w')
- execute('silent lcd Xdir1')
+ command('new a')
+ command('new b')
+ command('new c')
+ command('3wincmd w')
+ command('silent lcd Xdir1')
eq('a Xdir1 1', eval('GetCwdInfo(0, 0)'))
- execute('wincmd W')
+ command('wincmd W')
eq('b Xtopdir 0', eval('GetCwdInfo(0, 0)'))
- execute('wincmd W')
- execute('silent lcd Xdir3')
+ command('wincmd W')
+ command('silent lcd Xdir3')
eq('c Xdir3 1', eval('GetCwdInfo(0, 0)'))
eq('a Xdir1 1', eval('GetCwdInfo(bufwinnr("a"), 0)'))
eq('b Xtopdir 0', eval('GetCwdInfo(bufwinnr("b"), 0)'))
eq('c Xdir3 1', eval('GetCwdInfo(bufwinnr("c"), 0)'))
- execute('wincmd W')
+ command('wincmd W')
eq('a Xdir1 1', eval('GetCwdInfo(bufwinnr("a"), tabpagenr())'))
eq('b Xtopdir 0', eval('GetCwdInfo(bufwinnr("b"), tabpagenr())'))
eq('c Xdir3 1', eval('GetCwdInfo(bufwinnr("c"), tabpagenr())'))
- execute('tabnew x')
- execute('new y')
- execute('new z')
- execute('3wincmd w')
+ command('tabnew x')
+ command('new y')
+ command('new z')
+ command('3wincmd w')
eq('x Xtopdir 0', eval('GetCwdInfo(0, 0)'))
- execute('wincmd W')
- execute('silent lcd Xdir2')
+ command('wincmd W')
+ command('silent lcd Xdir2')
eq('y Xdir2 1', eval('GetCwdInfo(0, 0)'))
- execute('wincmd W')
- execute('silent lcd Xdir3')
+ command('wincmd W')
+ command('silent lcd Xdir3')
eq('z Xdir3 1', eval('GetCwdInfo(0, 0)'))
eq('x Xtopdir 0', eval('GetCwdInfo(bufwinnr("x"), 0)'))
eq('y Xdir2 1', eval('GetCwdInfo(bufwinnr("y"), 0)'))
eq('z Xdir3 1', eval('GetCwdInfo(bufwinnr("z"), 0)'))
- execute('let tp_nr = tabpagenr()')
- execute('tabrewind')
+ command('let tp_nr = tabpagenr()')
+ command('tabrewind')
eq('x Xtopdir 0', eval('GetCwdInfo(3, tp_nr)'))
eq('y Xdir2 1', eval('GetCwdInfo(2, tp_nr)'))
eq('z Xdir3 1', eval('GetCwdInfo(1, tp_nr)'))
diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua
index 82e7e3010f..029d95206e 100644
--- a/test/functional/legacy/glob2regpat_spec.lua
+++ b/test/functional/legacy/glob2regpat_spec.lua
@@ -1,16 +1,15 @@
-- Tests for signs
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
+local clear, exc_exec = helpers.clear, helpers.exc_exec
+local eq, eval = helpers.eq, helpers.eval
describe('glob2regpat()', function()
before_each(clear)
it('handles invalid input', function()
- execute('call glob2regpat(1.33)')
- helpers.feed('<cr>')
- neq(nil, string.find(eval('v:errmsg'), '^E806:'))
+ eq('Vim(call):E806: using Float as a String',
+ exc_exec('call glob2regpat(1.33)'))
end)
it('returns ^$ for empty input', function()
eq('^$', eval("glob2regpat('')"))
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
index a76718ed8e..15273a4ad5 100644
--- a/test/functional/legacy/increment_spec.lua
+++ b/test/functional/legacy/increment_spec.lua
@@ -1,7 +1,7 @@
-- Tests for using Ctrl-A/Ctrl-X on visual selections
local helpers = require('test.functional.helpers')(after_each)
-local source, execute = helpers.source, helpers.execute
+local source, command = helpers.source, helpers.command
local call, clear = helpers.call, helpers.clear
local eq, nvim = helpers.eq, helpers.meths
@@ -742,14 +742,14 @@ describe('Ctrl-A/Ctrl-X on visual selections', function()
local id = string.format('%02d', i)
it('works on Test ' .. id, function()
- execute('set nrformats&vi') -- &vi makes Vim compatible
+ command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_visual_increment_' .. id)
eq({}, nvim.get_vvar('errors'))
end)
end
it('does not drop leading zeroes', function()
- execute('set nrformats&vi') -- &vi makes Vim compatible
+ command('set nrformats&vi') -- &vi makes Vim compatible
call('Test_normal_increment_01')
eq({}, nvim.get_vvar('errors'))
end)
diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua
index 3142f040b3..e53c9dc6ce 100644
--- a/test/functional/legacy/insertcount_spec.lua
+++ b/test/functional/legacy/insertcount_spec.lua
@@ -2,7 +2,7 @@
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 feed_command, expect = helpers.feed_command, helpers.expect
describe('insertcount', function()
setup(clear)
@@ -13,7 +13,7 @@ describe('insertcount', function()
Second line
Last line]])
- execute('/Second')
+ feed_command('/Second')
feed('4gro')
expect([[
diff --git a/test/functional/legacy/join_spec.lua b/test/functional/legacy/join_spec.lua
index 3c4da8119c..d683d25eb0 100644
--- a/test/functional/legacy/join_spec.lua
+++ b/test/functional/legacy/join_spec.lua
@@ -2,19 +2,19 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
-local eval, execute = helpers.eval, helpers.execute
+local eval, command = helpers.eval, helpers.command
describe('joining lines', function()
before_each(clear)
it('is working', function()
- execute('new')
- execute([[call setline(1, ['one', 'two', 'three', 'four'])]])
- execute('normal J')
+ command('new')
+ command([[call setline(1, ['one', 'two', 'three', 'four'])]])
+ command('normal J')
eq('one two', eval('getline(1)'))
- execute('%del')
- execute([[call setline(1, ['one', 'two', 'three', 'four'])]])
- execute('normal 10J')
+ command('%del')
+ command([[call setline(1, ['one', 'two', 'three', 'four'])]])
+ command('normal 10J')
eq('one two three four', eval('getline(1)'))
end)
end)
diff --git a/test/functional/legacy/lispwords_spec.lua b/test/functional/legacy/lispwords_spec.lua
index 2ec51dca1b..57d8d51377 100644
--- a/test/functional/legacy/lispwords_spec.lua
+++ b/test/functional/legacy/lispwords_spec.lua
@@ -2,7 +2,7 @@ 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 command = helpers.command
local source = helpers.source
describe('lispwords', function()
@@ -17,7 +17,7 @@ describe('lispwords', function()
eq('bar,baz,quux', eval('&l:lispwords'))
eq('bar,baz,quux', eval('&lispwords'))
- execute('setlocal lispwords<')
+ command('setlocal lispwords<')
eq('foo,bar,baz', eval('&g:lispwords'))
eq('foo,bar,baz', eval('&l:lispwords'))
eq('foo,bar,baz', eval('&lispwords'))
diff --git a/test/functional/legacy/listchars_spec.lua b/test/functional/legacy/listchars_spec.lua
index d2838cddb6..3c0fa48e76 100644
--- a/test/functional/legacy/listchars_spec.lua
+++ b/test/functional/legacy/listchars_spec.lua
@@ -2,12 +2,12 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe("'listchars'", function()
before_each(function()
clear()
- execute('set listchars&vi')
+ feed_command('set listchars&vi')
end)
it("works with 'list'", function()
@@ -26,14 +26,14 @@ describe("'listchars'", function()
dd ee
]])
- execute('let g:lines = []')
+ feed_command('let g:lines = []')
-- Set up 'listchars', switch on 'list', and use the "GG" mapping to record
-- what the buffer lines look like.
- execute('set listchars+=tab:>-,space:.,trail:<')
- execute('set list')
- execute('/^start:/')
- execute('normal! jzt')
+ feed_command('set listchars+=tab:>-,space:.,trail:<')
+ feed_command('set list')
+ feed_command('/^start:/')
+ feed_command('normal! jzt')
feed('GG<cr>')
feed('GG<cr>')
feed('GG<cr>')
@@ -41,7 +41,7 @@ describe("'listchars'", function()
feed('GGH')
-- Repeat without displaying "trail" spaces.
- execute('set listchars-=trail:<')
+ feed_command('set listchars-=trail:<')
feed('GG<cr>')
feed('GG<cr>')
feed('GG<cr>')
@@ -49,8 +49,8 @@ describe("'listchars'", function()
feed('GG')
-- Delete the buffer contents and :put the collected lines.
- execute('%d')
- execute('put =g:lines', '1d')
+ feed_command('%d')
+ feed_command('put =g:lines', '1d')
-- Assert buffer contents.
expect([[
@@ -76,21 +76,21 @@ describe("'listchars'", function()
-- Set up 'listchars', switch 'list' *off* (:list must show the 'listchars'
-- even when 'list' is off), then run :list and collect the output.
- execute('set listchars+=tab:>-,space:.,trail:<')
- execute('set nolist')
- execute('/^start:/')
- execute('redir! => g:lines')
- execute('+1,$list')
- execute('redir END')
+ feed_command('set listchars+=tab:>-,space:.,trail:<')
+ feed_command('set nolist')
+ feed_command('/^start:/')
+ feed_command('redir! => g:lines')
+ feed_command('+1,$list')
+ feed_command('redir END')
-- Delete the buffer contents and :put the collected lines.
- execute('%d')
- execute('put =g:lines', '1d')
+ feed_command('%d')
+ feed_command('put =g:lines', '1d')
-- Assert buffer contents.
expect([[
-
-
+
+
..fff>--<<$
>-------gg>-----$
.....h>-$
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua
index eb979edc69..d39125c9e6 100644
--- a/test/functional/legacy/listlbr_spec.lua
+++ b/test/functional/legacy/listlbr_spec.lua
@@ -2,7 +2,7 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('listlbr', function()
setup(clear)
@@ -11,13 +11,13 @@ describe('listlbr', function()
insert([[
dummy text]])
- execute('set wildchar=^E')
- execute('10new')
- execute('vsp')
- execute('vert resize 20')
- execute([[put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"]])
- execute('norm! zt')
- execute('set ts=4 sw=4 sts=4 linebreak sbr=+ wrap')
+ feed_command('set wildchar=^E')
+ feed_command('10new')
+ feed_command('vsp')
+ feed_command('vert resize 20')
+ feed_command([[put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"]])
+ feed_command('norm! zt')
+ feed_command('set ts=4 sw=4 sts=4 linebreak sbr=+ wrap')
source([[
fu! ScreenChar(width)
let c=''
@@ -36,128 +36,128 @@ describe('listlbr', function()
wincmd p
endfu
]])
- execute('let g:test="Test 1: set linebreak"')
- execute('redraw!')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
-
- execute('let g:test="Test 2: set linebreak + set list"')
- execute('set linebreak list listchars=')
- execute('redraw!')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
-
- execute('let g:test ="Test 3: set linebreak nolist"')
- execute('set nolist linebreak')
- execute('redraw!')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
-
- execute('let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"')
- execute('set nolist linebreak ts=8')
- execute([[let line="1\t".repeat('a', winwidth(0)-2)]])
- execute('$put =line')
- execute('$')
- execute('norm! zt')
- execute('redraw!')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
- execute([[let line="_S_\t bla"]])
- execute('$put =line')
- execute('$')
- execute('norm! zt')
-
- execute('let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"')
- execute('set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab')
- execute('syn match ConcealVar contained /_/ conceal')
- execute('syn match All /.*/ contains=ConcealVar')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
- execute('set cpo&vim linebreak')
-
- execute('let g:test ="Test 6: set linebreak with visual block mode"')
- execute('let line="REMOVE: this not"')
- execute('$put =g:test')
- execute('$put =line')
- execute('let line="REMOVE: aaaaaaaaaaaaa"')
- execute('$put =line')
- execute('1/^REMOVE:')
+ feed_command('let g:test="Test 1: set linebreak"')
+ feed_command('redraw!')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
+
+ feed_command('let g:test="Test 2: set linebreak + set list"')
+ feed_command('set linebreak list listchars=')
+ feed_command('redraw!')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
+
+ feed_command('let g:test ="Test 3: set linebreak nolist"')
+ feed_command('set nolist linebreak')
+ feed_command('redraw!')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
+
+ feed_command('let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"')
+ feed_command('set nolist linebreak ts=8')
+ feed_command([[let line="1\t".repeat('a', winwidth(0)-2)]])
+ feed_command('$put =line')
+ feed_command('$')
+ feed_command('norm! zt')
+ feed_command('redraw!')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
+ feed_command([[let line="_S_\t bla"]])
+ feed_command('$put =line')
+ feed_command('$')
+ feed_command('norm! zt')
+
+ feed_command('let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"')
+ feed_command('set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab')
+ feed_command('syn match ConcealVar contained /_/ conceal')
+ feed_command('syn match All /.*/ contains=ConcealVar')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
+ feed_command('set cpo&vim linebreak')
+
+ feed_command('let g:test ="Test 6: set linebreak with visual block mode"')
+ feed_command('let line="REMOVE: this not"')
+ feed_command('$put =g:test')
+ feed_command('$put =line')
+ feed_command('let line="REMOVE: aaaaaaaaaaaaa"')
+ feed_command('$put =line')
+ feed_command('1/^REMOVE:')
feed('0<C-V>jf x')
- execute('$put')
- execute('set cpo&vim linebreak')
+ feed_command('$put')
+ feed_command('set cpo&vim linebreak')
- execute('let g:test ="Test 7: set linebreak with visual block mode and v_b_A"')
- execute('$put =g:test')
+ feed_command('let g:test ="Test 7: set linebreak with visual block mode and v_b_A"')
+ feed_command('$put =g:test')
feed('Golong line: <esc>40afoobar <esc>aTARGET at end<esc>')
- execute([[exe "norm! $3B\<C-v>eAx\<Esc>"]])
- execute('set cpo&vim linebreak sbr=')
+ feed_command([[exe "norm! $3B\<C-v>eAx\<Esc>"]])
+ feed_command('set cpo&vim linebreak sbr=')
- execute('let g:test ="Test 8: set linebreak with visual char mode and changing block"')
- execute('$put =g:test')
+ feed_command('let g:test ="Test 8: set linebreak with visual char mode and changing block"')
+ feed_command('$put =g:test')
feed('Go1111-1111-1111-11-1111-1111-1111<esc>0f-lv3lc2222<esc>bgj.')
- execute('let g:test ="Test 9: using redo after block visual mode"')
- execute('$put =g:test')
+ feed_command('let g:test ="Test 9: using redo after block visual mode"')
+ feed_command('$put =g:test')
feed('Go<CR>')
feed('aaa<CR>')
feed('aaa<CR>')
feed('a<ESC>2k<C-V>2j~e.<CR>')
- execute('let g:test ="Test 10: using normal commands after block-visual"')
- execute('$put =g:test')
- execute('set linebreak')
+ feed_command('let g:test ="Test 10: using normal commands after block-visual"')
+ feed_command('$put =g:test')
+ feed_command('set linebreak')
feed('Go<cr>')
feed('abcd{ef<cr>')
feed('ghijklm<cr>')
feed('no}pqrs<esc>2k0f{<C-V><C-V>c%<esc>')
- execute('let g:test ="Test 11: using block replace mode after wrapping"')
- execute('$put =g:test')
- execute('set linebreak wrap')
+ feed_command('let g:test ="Test 11: using block replace mode after wrapping"')
+ feed_command('$put =g:test')
+ feed_command('set linebreak wrap')
feed('Go<esc>150aa<esc>yypk147|<C-V>jr0<cr>')
- execute('let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$"')
- execute('set list listchars=space:_,trail:-,tab:>-,eol:$')
- execute('$put =g:test')
- execute([[let line="a aaaaaaaaaaaaaaaaaaaaaa\ta "]])
- execute('$put =line')
- execute('$')
- execute('norm! zt')
- execute('redraw!')
- execute('let line=ScreenChar(winwidth(0))')
- execute('call DoRecordScreen()')
+ feed_command('let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$"')
+ feed_command('set list listchars=space:_,trail:-,tab:>-,eol:$')
+ feed_command('$put =g:test')
+ feed_command([[let line="a aaaaaaaaaaaaaaaaaaaaaa\ta "]])
+ feed_command('$put =line')
+ feed_command('$')
+ feed_command('norm! zt')
+ feed_command('redraw!')
+ feed_command('let line=ScreenChar(winwidth(0))')
+ feed_command('call DoRecordScreen()')
-- Assert buffer contents.
expect([[
-
+
abcdef hijklmn pqrstuvwxyz_1060ABCDEFGHIJKLMNOP
-
+
Test 1: set linebreak
abcdef
+hijklmn
+pqrstuvwxyz_1060ABC
+DEFGHIJKLMNOP
-
+
Test 2: set linebreak + set list
^Iabcdef hijklmn^I
+pqrstuvwxyz_1060ABC
+DEFGHIJKLMNOP
-
+
Test 3: set linebreak nolist
abcdef
+hijklmn
+pqrstuvwxyz_1060ABC
+DEFGHIJKLMNOP
1 aaaaaaaaaaaaaaaaaa
-
+
Test 4: set linebreak with tab and 1 line as long as screen: should break!
1
+aaaaaaaaaaaaaaaaaa
~
~
_S_ bla
-
+
Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)
Sabbbbbb bla
~
@@ -173,19 +173,19 @@ describe('listlbr', function()
Test 8: set linebreak with visual char mode and changing block
1111-2222-1111-11-1111-2222-1111
Test 9: using redo after block visual mode
-
+
AaA
AaA
A
Test 10: using normal commands after block-visual
-
+
abcdpqrs
Test 11: using block replace mode after wrapping
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0aaa
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
a aaaaaaaaaaaaaaaaaaaaaa a
-
+
Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$
a_
aaaaaaaaaaaaaaaaaaaa
diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua
index 1712219d04..56a5652184 100644
--- a/test/functional/legacy/mapping_spec.lua
+++ b/test/functional/legacy/mapping_spec.lua
@@ -2,7 +2,7 @@
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
+local feed_command, expect, wait = helpers.feed_command, helpers.expect, helpers.wait
describe('mapping', function()
before_each(clear)
@@ -13,7 +13,7 @@ describe('mapping', function()
]])
-- Abbreviations with р (0x80) should work.
- execute('inoreab чкпр vim')
+ feed_command('inoreab чкпр vim')
feed('GAчкпр <esc>')
expect([[
@@ -23,61 +23,61 @@ describe('mapping', function()
it('Ctrl-c works in Insert mode', function()
-- Mapping of ctrl-c in insert mode
- execute('set cpo-=< cpo-=k')
- execute('inoremap <c-c> <ctrl-c>')
- execute('cnoremap <c-c> dummy')
- execute('cunmap <c-c>')
+ feed_command('set cpo-=< cpo-=k')
+ feed_command('inoremap <c-c> <ctrl-c>')
+ feed_command('cnoremap <c-c> dummy')
+ feed_command('cunmap <c-c>')
feed('GA<cr>')
feed('TEST2: CTRL-C |')
wait()
feed('<c-c>A|<cr><esc>')
wait()
- execute('unmap <c-c>')
- execute('unmap! <c-c>')
+ feed_command('unmap <c-c>')
+ feed_command('unmap! <c-c>')
expect([[
-
+
TEST2: CTRL-C |<ctrl-c>A|
]])
end)
it('Ctrl-c works in Visual mode', function()
- execute([[vnoremap <c-c> :<C-u>$put ='vmap works'<cr>]])
+ feed_command([[vnoremap <c-c> :<C-u>$put ='vmap works'<cr>]])
feed('GV')
-- XXX: For some reason the mapping is only triggered
-- when <C-c> is in a separate feed command.
wait()
feed('<c-c>')
- execute('vunmap <c-c>')
+ feed_command('vunmap <c-c>')
expect([[
-
+
vmap works]])
end)
it('langmap', function()
-- langmap should not get remapped in insert mode.
- execute('inoremap { FAIL_ilangmap')
- execute('set langmap=+{ langnoremap')
+ feed_command('inoremap { FAIL_ilangmap')
+ feed_command('set langmap=+{ langnoremap')
feed('o+<esc>')
-- Insert mode expr mapping with langmap.
- execute('inoremap <expr> { "FAIL_iexplangmap"')
+ feed_command('inoremap <expr> { "FAIL_iexplangmap"')
feed('o+<esc>')
-- langmap should not get remapped in cmdline mode.
- execute('cnoremap { FAIL_clangmap')
+ feed_command('cnoremap { FAIL_clangmap')
feed('o+<esc>')
- execute('cunmap {')
+ feed_command('cunmap {')
-- cmdline mode expr mapping with langmap.
- execute('cnoremap <expr> { "FAIL_cexplangmap"')
+ feed_command('cnoremap <expr> { "FAIL_cexplangmap"')
feed('o+<esc>')
- execute('cunmap {')
+ feed_command('cunmap {')
-- Assert buffer contents.
expect([[
-
+
+
+
+
@@ -91,10 +91,10 @@ describe('mapping', function()
]])
-- Vim's issue #212 (feedkeys insert mapping at current position)
- execute('nnoremap . :call feedkeys(".", "in")<cr>')
+ feed_command('nnoremap . :call feedkeys(".", "in")<cr>')
feed('/^a b<cr>')
feed('0qqdw.ifoo<esc>qj0@q<esc>')
- execute('unmap .')
+ feed_command('unmap .')
expect([[
fooc d
fooc d
@@ -103,23 +103,23 @@ describe('mapping', function()
it('i_CTRL-G_U', function()
-- <c-g>U<cursor> works only within a single line
- execute('imapclear')
- execute('imap ( ()<c-g>U<left>')
+ feed_command('imapclear')
+ feed_command('imap ( ()<c-g>U<left>')
feed('G2o<esc>ki<cr>Test1: text with a (here some more text<esc>k.')
-- test undo
feed('G2o<esc>ki<cr>Test2: text wit a (here some more text [und undo]<c-g>u<esc>k.u')
- execute('imapclear')
- execute('set whichwrap=<,>,[,]')
+ feed_command('imapclear')
+ feed_command('set whichwrap=<,>,[,]')
feed('G3o<esc>2k')
- execute([[:exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."]])
+ feed_command([[:exe ":norm! iTest3: text with a (parenthesis here\<C-G>U\<Right>new line here\<esc>\<up>\<up>."]])
expect([[
-
-
+
+
Test1: text with a (here some more text)
Test1: text with a (here some more text)
-
-
+
+
Test2: text wit a (here some more text [und undo])
new line here
Test3: text with a (parenthesis here
diff --git a/test/functional/legacy/marks_spec.lua b/test/functional/legacy/marks_spec.lua
index 6ecba70f08..bcec179ca2 100644
--- a/test/functional/legacy/marks_spec.lua
+++ b/test/functional/legacy/marks_spec.lua
@@ -1,6 +1,6 @@
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 clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('marks', function()
before_each(function()
@@ -9,14 +9,14 @@ describe('marks', function()
it('restores a deleted mark after delete-undo-redo-undo', function()
insert([[
-
+
textline A
textline B
textline C
-
+
Results:]])
- execute([[:/^\t/+1]])
+ feed_command([[:/^\t/+1]])
feed([[maddu<C-R>u]])
source([[
let g:a = string(getpos("'a"))
@@ -24,11 +24,11 @@ describe('marks', function()
]])
expect([=[
-
+
textline A
textline B
textline C
-
+
Results:
Mark after delete-undo-redo-undo: [0, 3, 2, 0]]=])
end)
diff --git a/test/functional/legacy/nested_function_spec.lua b/test/functional/legacy/nested_function_spec.lua
index be9b66ee38..7a2ba1ecf2 100644
--- a/test/functional/legacy/nested_function_spec.lua
+++ b/test/functional/legacy/nested_function_spec.lua
@@ -2,7 +2,7 @@
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
+local command, expect, source = helpers.command, helpers.expect, helpers.source
describe('test_nested_function', function()
setup(clear)
@@ -36,7 +36,7 @@ describe('test_nested_function', function()
: endfunction
: call s:{fn}()
:endfunction]])
- execute('call NestedFunc()')
+ command('call NestedFunc()')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index 2d851819e3..c280888dda 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -1,7 +1,7 @@
-- Tests for 'packpath' and :packadd
local helpers = require('test.functional.helpers')(after_each)
-local clear, source, execute = helpers.clear, helpers.source, helpers.execute
+local clear, source, command = helpers.clear, helpers.source, helpers.command
local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
local feed = helpers.feed
@@ -263,12 +263,12 @@ describe('packadd', function()
[2] = {bold = true, reverse = true}
})
- execute([[let optdir1 = &packpath . '/pack/mine/opt']])
- execute([[let optdir2 = &packpath . '/pack/candidate/opt']])
- execute([[call mkdir(optdir1 . '/pluginA', 'p')]])
- execute([[call mkdir(optdir1 . '/pluginC', 'p')]])
- execute([[call mkdir(optdir2 . '/pluginB', 'p')]])
- execute([[call mkdir(optdir2 . '/pluginC', 'p')]])
+ command([[let optdir1 = &packpath . '/pack/mine/opt']])
+ command([[let optdir2 = &packpath . '/pack/candidate/opt']])
+ command([[call mkdir(optdir1 . '/pluginA', 'p')]])
+ command([[call mkdir(optdir1 . '/pluginC', 'p')]])
+ command([[call mkdir(optdir2 . '/pluginB', 'p')]])
+ command([[call mkdir(optdir2 . '/pluginC', 'p')]])
end)
it('works', function()
diff --git a/test/functional/legacy/search_mbyte_spec.lua b/test/functional/legacy/search_mbyte_spec.lua
index a5a5822a45..a365f79cdf 100644
--- a/test/functional/legacy/search_mbyte_spec.lua
+++ b/test/functional/legacy/search_mbyte_spec.lua
@@ -1,6 +1,10 @@
local helpers = require('test.functional.helpers')(after_each)
+
+local wait = helpers.wait
+local clear = helpers.clear
local insert = helpers.insert
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local expect = helpers.expect
+local command = helpers.command
describe('search_mbyte', function()
before_each(clear)
@@ -8,17 +12,18 @@ describe('search_mbyte', function()
it("search('multi-byte char', 'bce')", function()
insert([=[
Results:
-
+
Test bce:
A]=])
+ wait()
- execute('/^Test bce:/+1')
- execute([[$put =search('A', 'bce', line('.'))]])
+ command('/^Test bce:/+1')
+ command([[$put =search('A', 'bce', line('.'))]])
-- Assert buffer contents.
expect([=[
Results:
-
+
Test bce:
4]=])
diff --git a/test/functional/legacy/searchpos_spec.lua b/test/functional/legacy/searchpos_spec.lua
index 7d4b7a3734..60f1edcd3f 100644
--- a/test/functional/legacy/searchpos_spec.lua
+++ b/test/functional/legacy/searchpos_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local call = helpers.call
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local insert = helpers.insert
@@ -19,7 +19,7 @@ describe('searchpos', function()
call('cursor', 1, 2)
eq({2, 1, 1}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]]))
- execute('set cpo-=c')
+ command('set cpo-=c')
call('cursor', 1, 2)
eq({1, 2, 2}, eval([[searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW')]]))
call('cursor', 1, 3)
diff --git a/test/functional/legacy/set_spec.lua b/test/functional/legacy/set_spec.lua
index 11f371569d..deb268b1e8 100644
--- a/test/functional/legacy/set_spec.lua
+++ b/test/functional/legacy/set_spec.lua
@@ -1,30 +1,30 @@
-- Tests for :set
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, eval, eq =
- helpers.clear, helpers.execute, helpers.eval, helpers.eq
+local clear, command, eval, eq =
+ helpers.clear, helpers.command, helpers.eval, helpers.eq
describe(':set', function()
before_each(clear)
it('handles backslash properly', function()
- execute('set iskeyword=a,b,c')
- execute('set iskeyword+=d')
+ command('set iskeyword=a,b,c')
+ command('set iskeyword+=d')
eq('a,b,c,d', eval('&iskeyword'))
- execute([[set iskeyword+=\\,e]])
+ command([[set iskeyword+=\\,e]])
eq([[a,b,c,d,\,e]], eval('&iskeyword'))
- execute('set iskeyword-=e')
+ command('set iskeyword-=e')
eq([[a,b,c,d,\]], eval('&iskeyword'))
- execute([[set iskeyword-=\]])
+ command([[set iskeyword-=\]])
eq('a,b,c,d', eval('&iskeyword'))
end)
it('recognizes a trailing comma with +=', function()
- execute('set wildignore=*.png,')
- execute('set wildignore+=*.jpg')
+ command('set wildignore=*.png,')
+ command('set wildignore+=*.jpg')
eq('*.png,*.jpg', eval('&wildignore'))
end)
end)
diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua
index e80a32455a..0e65edbcf8 100644
--- a/test/functional/legacy/signs_spec.lua
+++ b/test/functional/legacy/signs_spec.lua
@@ -1,23 +1,23 @@
-- Tests for signs
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, command, expect = helpers.clear, helpers.command, helpers.expect
describe('signs', function()
setup(clear)
it('is working', function()
- execute('sign define JumpSign text=x')
- execute([[exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')]])
+ command('sign define JumpSign text=x')
+ command([[exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')]])
-- Split the window to the bottom to verify :sign-jump will stay in the current
-- window if the buffer is displayed there.
- execute('bot split')
- execute([[exe 'sign jump 42 buffer=' . bufnr('')]])
- execute([[call append(line('$'), winnr())]])
+ command('bot split')
+ command([[exe 'sign jump 42 buffer=' . bufnr('')]])
+ command([[call append(line('$'), winnr())]])
-- Assert buffer contents.
expect([[
-
+
2]])
end)
end)
diff --git a/test/functional/legacy/textobjects_spec.lua b/test/functional/legacy/textobjects_spec.lua
index 15a93e3819..96f655cc41 100644
--- a/test/functional/legacy/textobjects_spec.lua
+++ b/test/functional/legacy/textobjects_spec.lua
@@ -1,14 +1,14 @@
local helpers = require('test.functional.helpers')(after_each)
local call = helpers.call
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local expect = helpers.expect
local source = helpers.source
describe('Text object', function()
before_each(function()
clear()
- execute('set shada=')
+ command('set shada=')
source([[
function SelectionOut(data)
new
@@ -27,7 +27,7 @@ describe('Text object', function()
end)
it('Test for vi) without cpo-M', function()
- execute('set cpo-=M')
+ command('set cpo-=M')
call('SelectionOut', '(red \\(blue) green)')
expect([[
@@ -38,7 +38,7 @@ describe('Text object', function()
end)
it('Test for vi) with cpo-M #1', function()
- execute('set cpo+=M')
+ command('set cpo+=M')
call('SelectionOut', '(red \\(blue) green)')
expect([[
@@ -49,7 +49,7 @@ describe('Text object', function()
end)
it('Test for vi) with cpo-M #2', function()
- execute('set cpo+=M')
+ command('set cpo+=M')
call('SelectionOut', '(red (blue\\) green)')
expect([[
diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua
index 4d4f55b9eb..02de6ab735 100644
--- a/test/functional/legacy/utf8_spec.lua
+++ b/test/functional/legacy/utf8_spec.lua
@@ -2,9 +2,10 @@
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 command, expect = helpers.command, helpers.expect
local eq, eval = helpers.eq, helpers.eval
local source = helpers.source
+local wait = helpers.wait
describe('utf8', function()
before_each(clear)
@@ -12,16 +13,17 @@ describe('utf8', function()
it('is working', function()
insert('start:')
- execute('new')
- execute('call setline(1, ["aaa", "あああ", "bbb"])')
+ command('new')
+ command('call setline(1, ["aaa", "あああ", "bbb"])')
-- Visual block Insert adjusts for multi-byte char
feed('gg0l<C-V>jjIx<Esc>')
+ wait()
- execute('let r = getline(1, "$")')
- execute('bwipeout!')
- execute('$put=r')
- execute('call garbagecollect(1)')
+ command('let r = getline(1, "$")')
+ command('bwipeout!')
+ command('$put=r')
+ command('call garbagecollect(1)')
expect([[
start:
@@ -75,7 +77,7 @@ describe('utf8', function()
feed(":Test3 <C-L>'<C-B>$put='<CR>")
expect([[
-
+
Test1
Test2 あた
Test3 N]])
diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua
index 171ec3de92..5412903866 100644
--- a/test/functional/legacy/wordcount_spec.lua
+++ b/test/functional/legacy/wordcount_spec.lua
@@ -2,8 +2,9 @@
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 clear, command = helpers.clear, helpers.command
local eq, eval = helpers.eq, helpers.eval
+local wait = helpers.wait
if helpers.pending_win32(pending) then return end
@@ -11,14 +12,13 @@ describe('wordcount', function()
before_each(clear)
it('is working', function()
- execute('set selection=inclusive')
- execute('fileformat=unix')
- execute('fileformats=unix')
+ command('set selection=inclusive fileformat=unix fileformats=unix')
insert([=[
RESULT test:]=])
+ wait()
- execute('new')
+ command('new')
source([=[
function DoRecordWin(...)
wincmd k
@@ -59,7 +59,7 @@ describe('wordcount', function()
)
-- Test 2: some words, cursor at start
- execute([[call PutInWindow('one two three')]])
+ command([[call PutInWindow('one two three')]])
eq(eval('DoRecordWin([1, 1, 0])'),
eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, 'bytes': 15, 'cursor_bytes': 1}]
@@ -67,7 +67,7 @@ describe('wordcount', function()
)
-- Test 3: some words, cursor at end
- execute([[call PutInWindow('one two three')]])
+ command([[call PutInWindow('one two three')]])
eq(eval('DoRecordWin([2, 99, 0])'),
eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 14}]
@@ -75,17 +75,17 @@ describe('wordcount', function()
)
-- Test 4: some words, cursor at end, ve=all
- execute('set ve=all')
- execute([[call PutInWindow('one two three')]])
+ command('set ve=all')
+ command([[call PutInWindow('one two three')]])
eq(eval('DoRecordWin([2,99,0])'),
eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 15}]
]=])
)
- execute('set ve=')
+ command('set ve=')
-- Test 5: several lines with words
- execute([=[call PutInWindow(['one two three', 'one two three', 'one two three'])]=])
+ command([=[call PutInWindow(['one two three', 'one two three', 'one two three'])]=])
eq(eval('DoRecordWin([4,99,0])'),
eval([=[
[['', 'one two three', 'one two three', 'one two three'], {'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, 'bytes': 43, 'cursor_bytes': 42}]
@@ -93,21 +93,21 @@ describe('wordcount', function()
)
-- Test 6: one line with BOM set
- execute([[call PutInWindow('one two three')]])
- execute('wincmd k')
- execute('set bomb')
- execute('wincmd j')
+ command([[call PutInWindow('one two three')]])
+ command('wincmd k')
+ command('set bomb')
+ command('wincmd j')
eq(eval('DoRecordWin([2,99,0])'),
eval([=[
[['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 18, 'cursor_bytes': 14}]
]=])
)
- execute('wincmd k')
- execute('set nobomb')
- execute('wincmd j')
+ command('wincmd k')
+ command('set nobomb')
+ command('wincmd j')
-- Test 7: one line with multibyte words
- execute([=[call PutInWindow(['Äne M¤ne Müh'])]=])
+ command([=[call PutInWindow(['Äne M¤ne Müh'])]=])
eq(eval('DoRecordWin([2,99,0])'),
eval([=[
[['', 'Äne M¤ne Müh'], {'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, 'bytes': 17, 'cursor_bytes': 16}]
@@ -115,7 +115,7 @@ describe('wordcount', function()
)
-- Test 8: several lines with multibyte words
- execute([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
+ command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
eq(eval('DoRecordWin([3,99,0])'),
eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, 'bytes': 36, 'cursor_bytes': 35}]
@@ -123,15 +123,16 @@ describe('wordcount', function()
)
-- Test 9: visual mode, complete buffer
- execute([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
- execute('wincmd k')
- execute('set ls=2 stl=%{STL()}')
+ command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
+ command('wincmd k')
+ command('set ls=2 stl=%{STL()}')
-- -- Start visual mode quickly and select complete buffer.
- execute('0')
+ command('0')
feed('V2jy<cr>')
- execute('set stl= ls=1')
- execute('let log=DoRecordWin([3,99,0])')
- execute('let log[1]=g:visual_stat')
+ wait()
+ command('set stl= ls=1')
+ command('let log=DoRecordWin([3,99,0])')
+ command('let log[1]=g:visual_stat')
eq(eval('log'),
eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, 'visual_words': 7, 'visual_bytes': 36}]
@@ -139,15 +140,16 @@ describe('wordcount', function()
)
-- Test 10: visual mode (empty)
- execute([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
- execute('wincmd k')
- execute('set ls=2 stl=%{STL()}')
+ command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
+ command('wincmd k')
+ command('set ls=2 stl=%{STL()}')
-- Start visual mode quickly and select complete buffer.
- execute('0')
+ command('0')
feed('v$y<cr>')
- execute('set stl= ls=1')
- execute('let log=DoRecordWin([3,99,0])')
- execute('let log[1]=g:visual_stat')
+ wait()
+ command('set stl= ls=1')
+ command('let log=DoRecordWin([3,99,0])')
+ command('let log[1]=g:visual_stat')
eq(eval('log'),
eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, 'visual_words': 0, 'visual_bytes': 1}]
@@ -155,15 +157,16 @@ describe('wordcount', function()
)
-- Test 11: visual mode, single line
- execute([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
- execute('wincmd k')
- execute('set ls=2 stl=%{STL()}')
+ command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=])
+ command('wincmd k')
+ command('set ls=2 stl=%{STL()}')
-- Start visual mode quickly and select complete buffer.
- execute('2')
+ command('2')
feed('0v$y<cr>')
- execute('set stl= ls=1')
- execute('let log=DoRecordWin([3,99,0])')
- execute('let log[1]=g:visual_stat')
+ wait()
+ command('set stl= ls=1')
+ command('let log=DoRecordWin([3,99,0])')
+ command('let log[1]=g:visual_stat')
eq(eval('log'),
eval([=[
[['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, 'visual_words': 3, 'visual_bytes': 16}]
diff --git a/test/functional/legacy/writefile_spec.lua b/test/functional/legacy/writefile_spec.lua
index 765d373b82..4d54e07d6a 100644
--- a/test/functional/legacy/writefile_spec.lua
+++ b/test/functional/legacy/writefile_spec.lua
@@ -1,23 +1,23 @@
-- Tests for writefile()
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, command, expect = helpers.clear, helpers.command, helpers.expect
describe('writefile', function()
setup(clear)
it('is working', function()
- execute('%delete _')
- execute('let f = tempname()')
- execute('call writefile(["over","written"], f, "b")')
- execute('call writefile(["hello","world"], f, "b")')
- execute('call writefile(["!", "good"], f, "a")')
- execute('call writefile(["morning"], f, "ab")')
- execute('call writefile(["", "vimmers"], f, "ab")')
- execute('bwipeout!')
- execute('$put =readfile(f)')
- execute('1 delete _')
- execute('call delete(f)')
+ command('%delete _')
+ command('let f = tempname()')
+ command('call writefile(["over","written"], f, "b")')
+ command('call writefile(["hello","world"], f, "b")')
+ command('call writefile(["!", "good"], f, "a")')
+ command('call writefile(["morning"], f, "ab")')
+ command('call writefile(["", "vimmers"], f, "ab")')
+ command('bwipeout!')
+ command('$put =readfile(f)')
+ command('1 delete _')
+ command('call delete(f)')
-- Assert buffer contents.
expect([[
diff --git a/test/functional/normal/count_spec.lua b/test/functional/normal/count_spec.lua
index 700e1f3e81..94f741250a 100644
--- a/test/functional/normal/count_spec.lua
+++ b/test/functional/normal/count_spec.lua
@@ -4,13 +4,13 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
describe('v:count/v:count1', function()
before_each(function()
clear()
- execute('map <silent> _x :<C-u>let g:count = "v:count=". v:count .", v:count1=". v:count1<CR>')
+ command('map <silent> _x :<C-u>let g:count = "v:count=". v:count .", v:count1=". v:count1<CR>')
end)
describe('in cmdwin', function()
diff --git a/test/functional/normal/fold_spec.lua b/test/functional/normal/fold_spec.lua
index 5584db20ba..00e83bedc8 100644
--- a/test/functional/normal/fold_spec.lua
+++ b/test/functional/normal/fold_spec.lua
@@ -4,14 +4,17 @@ local clear = helpers.clear
local insert = helpers.insert
local feed = helpers.feed
local expect = helpers.expect
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local funcs = helpers.funcs
-local foldlevel, foldclosedend = funcs.foldlevel, funcs.foldclosedend
+local foldlevel = funcs.foldlevel
+local foldclosedend = funcs.foldclosedend
local eq = helpers.eq
describe('Folds', function()
+ local tempfname = 'Xtest-fold.txt'
clear()
- before_each(function() execute('enew!') end)
+ before_each(function() feed_command('enew!') end)
+ after_each(function() os.remove(tempfname) end)
it('manual folding adjusts with filter', function()
insert([[
1
@@ -34,8 +37,8 @@ describe('Folds', function()
18
19
20]])
- execute('4,$fold', '%foldopen', '10,$fold', '%foldopen')
- execute('1,8! cat')
+ feed_command('4,$fold', '%foldopen', '10,$fold', '%foldopen')
+ feed_command('1,8! cat')
feed('5ggzdzMGdd')
expect([[
1
@@ -51,13 +54,13 @@ describe('Folds', function()
describe('adjusting folds after :move', function()
local function manually_fold_indent()
-- setting foldmethod twice is a trick to get vim to set the folds for me
- execute('set foldmethod=indent', 'set foldmethod=manual')
+ feed_command('set foldmethod=indent', 'set foldmethod=manual')
-- Ensure that all folds will get closed (makes it easier to test the
-- length of folds).
- execute('set foldminlines=0')
+ feed_command('set foldminlines=0')
-- Start with all folds open (so :move ranges aren't affected by closed
-- folds).
- execute('%foldopen!')
+ feed_command('%foldopen!')
end
local function get_folds()
@@ -72,16 +75,16 @@ describe('Folds', function()
-- This test is easy because we just need to ensure that the resulting
-- fold is the same as calculated when creating folds from scratch.
insert(insert_string)
- execute(move_command)
+ feed_command(move_command)
local after_move_folds = get_folds()
-- Doesn't change anything, but does call foldUpdateAll()
- execute('set foldminlines=0')
+ feed_command('set foldminlines=0')
eq(after_move_folds, get_folds())
-- Set up the buffer with insert_string for the manual fold testing.
- execute('enew!')
+ feed_command('enew!')
insert(insert_string)
manually_fold_indent()
- execute(move_command)
+ feed_command(move_command)
end
it('neither closes nor corrupts folds', function()
@@ -229,5 +232,131 @@ a
a]], '2,3m0')
eq({1, 2, 0, 0, 0}, get_folds())
end)
+ it('handles shifting all remaining folds', function()
+ test_move_indent([[
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+a]], '13m7')
+ eq({1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 1, 0}, get_folds())
+ end)
+ end)
+ it('updates correctly on :read', function()
+ -- luacheck: ignore 621
+ helpers.write_file(tempfname, [[
+ a
+
+
+ a]])
+ insert([[
+ a
+ a
+ a
+ a
+ ]])
+ feed_command('set foldmethod=indent', '2', '%foldopen')
+ feed_command('read ' .. tempfname)
+ -- Just to check we have the correct file text.
+ expect([[
+ a
+ a
+ a
+
+
+ a
+ a
+ a
+ ]])
+ for i = 1,2 do
+ eq(1, funcs.foldlevel(i))
+ end
+ for i = 3,5 do
+ eq(0, funcs.foldlevel(i))
+ end
+ for i = 6,8 do
+ eq(1, funcs.foldlevel(i))
+ end
+ end)
+ it('combines folds when removing separating space', function()
+ -- luacheck: ignore 621
+ insert([[
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ a
+ ]])
+ feed_command('set foldmethod=indent', '3,5d')
+ eq(5, funcs.foldclosedend(1))
+ end)
+ it("doesn't combine folds that have a specified end", function()
+ insert([[
+ {{{
+ }}}
+
+
+
+ {{{
+
+ }}}
+ ]])
+ feed_command('set foldmethod=marker', '3,5d', '%foldclose')
+ eq(2, funcs.foldclosedend(1))
+ end)
+ it('splits folds according to >N and <N with foldexpr', function()
+ helpers.source([[
+ function TestFoldExpr(lnum)
+ let thisline = getline(a:lnum)
+ if thisline == 'a'
+ return 1
+ elseif thisline == 'b'
+ return 0
+ elseif thisline == 'c'
+ return '<1'
+ elseif thisline == 'd'
+ return '>1'
+ endif
+ return 0
+ endfunction
+ ]])
+ helpers.write_file(tempfname, [[
+ b
+ b
+ a
+ a
+ d
+ a
+ a
+ c]])
+ insert([[
+ a
+ a
+ a
+ a
+ a
+ a
+ ]])
+ feed_command('set foldmethod=expr', 'set foldexpr=TestFoldExpr(v:lnum)', '2', 'foldopen')
+ feed_command('read ' .. tempfname, '%foldclose')
+ eq(2, funcs.foldclosedend(1))
+ eq(0, funcs.foldlevel(3))
+ eq(0, funcs.foldlevel(4))
+ eq(6, funcs.foldclosedend(5))
+ eq(10, funcs.foldclosedend(7))
+ eq(14, funcs.foldclosedend(11))
end)
end)
diff --git a/test/functional/normal/lang_spec.lua b/test/functional/normal/lang_spec.lua
new file mode 100644
index 0000000000..24d1262f5f
--- /dev/null
+++ b/test/functional/normal/lang_spec.lua
@@ -0,0 +1,63 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, insert, eq = helpers.clear, helpers.insert, helpers.eq
+local command, expect = helpers.command, helpers.expect
+local feed, eval = helpers.feed, helpers.eval
+local exc_exec = helpers.exc_exec
+
+describe('gu and gU', function()
+ before_each(clear)
+
+ it('works in any locale with default casemap', function()
+ eq('internal,keepascii', eval('&casemap'))
+ insert("iI")
+ feed("VgU")
+ expect("II")
+ feed("Vgu")
+ expect("ii")
+ end)
+
+ describe('works in Turkish locale', function()
+ clear()
+
+ local err = exc_exec('lang ctype tr_TR.UTF-8')
+ if err ~= 0 then
+ pending("Locale tr_TR.UTF-8 not supported", function() end)
+ return
+ end
+
+ before_each(function()
+ command('lang ctype tr_TR.UTF-8')
+ end)
+
+ it('with default casemap', function()
+ eq('internal,keepascii', eval('&casemap'))
+ -- expect ASCII behavior
+ insert("iI")
+ feed("VgU")
+ expect("II")
+ feed("Vgu")
+ expect("ii")
+ end)
+
+ it('with casemap=""', function()
+ command('set casemap=')
+ -- expect either Turkish locale behavior or ASCII behavior
+ local iupper = eval("toupper('i')")
+ if iupper == "İ" then
+ insert("iI")
+ feed("VgU")
+ expect("İI")
+ feed("Vgu")
+ expect("iı")
+ elseif iupper == "I" then
+ insert("iI")
+ feed("VgU")
+ expect("II")
+ feed("Vgu")
+ expect("ii")
+ else
+ error("expected toupper('i') to be either 'I' or 'İ'")
+ end
+ end)
+ end)
+end)
diff --git a/test/functional/normal/put_spec.lua b/test/functional/normal/put_spec.lua
index b3162364a6..148a35ec6b 100644
--- a/test/functional/normal/put_spec.lua
+++ b/test/functional/normal/put_spec.lua
@@ -8,23 +8,23 @@ local expect = helpers.expect
local eq = helpers.eq
local map = helpers.map
local filter = helpers.filter
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local curbuf_contents = helpers.curbuf_contents
local funcs = helpers.funcs
local dedent = helpers.dedent
local getreg = funcs.getreg
local function reset()
- execute('enew!')
+ feed_command('enew!')
insert([[
Line of words 1
Line of words 2]])
- execute('goto 1')
+ feed_command('goto 1')
feed('itest_string.<esc>u')
funcs.setreg('a', 'test_stringa', 'V')
funcs.setreg('b', 'test_stringb\ntest_stringb\ntest_stringb', 'b')
funcs.setreg('"', 'test_string"', 'v')
- execute('set virtualedit=')
+ feed_command('set virtualedit=')
end
-- We check the last inserted register ". in each of these tests because it is
@@ -164,7 +164,7 @@ describe('put command', function()
local function create_put_action(command_base, substitution)
local temp_val = command_base:gsub('put', substitution)
return function()
- execute(temp_val)
+ feed_command(temp_val)
return true
end
end
@@ -642,7 +642,7 @@ describe('put command', function()
-- Set curswant to '8' to be at the end of the tab character
-- This is where the cursor is put back after the 'u' command.
funcs.setpos('.', {0, 2, 1, 0, 8})
- execute('set autoindent')
+ feed_command('set autoindent')
end
)
end)
@@ -653,7 +653,7 @@ describe('put command', function()
test_stringx" Line of words 2]]
run_normal_mode_tests(test_string, 'p', function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 2, 1, 2, 3})
end)
end)
@@ -664,7 +664,7 @@ describe('put command', function()
Line of words 2]]
run_normal_mode_tests(test_string, 'p', function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 1, 16, 1, 17})
end, true)
end)
@@ -829,7 +829,7 @@ describe('put command', function()
'vp',
function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 2, 1, 2, 3})
end,
nil,
@@ -844,7 +844,7 @@ describe('put command', function()
base_expect_string,
'vp',
function()
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 1, 16, 2, 18})
end,
true,
@@ -906,7 +906,7 @@ describe('put command', function()
end)
it('should ring the bell when deleting if not appropriate', function()
- execute('goto 2')
+ feed_command('goto 2')
feed('i<bs><esc>')
expect([[
ine of words 1
@@ -921,7 +921,7 @@ describe('put command', function()
end)
it("should be unaffected by 'autoindent' with V\".2p", function()
- execute('set autoindent')
+ feed_command('set autoindent')
feed('i test_string.<esc>u')
feed('V".2p')
expect([[
diff --git a/test/functional/normal/undo_spec.lua b/test/functional/normal/undo_spec.lua
index 55429f2e1e..a023ca3d90 100644
--- a/test/functional/normal/undo_spec.lua
+++ b/test/functional/normal/undo_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local expect = helpers.expect
local feed = helpers.feed
local insert = helpers.insert
@@ -23,7 +23,7 @@ describe('u CTRL-R g- g+', function()
end
local function undo_and_redo(hist_pos, undo, redo, expect_str)
- execute('enew!')
+ command('enew!')
create_history(hist_pos)
local cur_contents = helpers.curbuf_contents()
feed(undo)
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index f57fe5fa23..f43d8eeafa 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local meths = helpers.meths
-local execute = helpers.execute
+local command = helpers.command
local clear = helpers.clear
local eval = helpers.eval
local eq = helpers.eq
@@ -25,7 +25,7 @@ describe('startup defaults', function()
local function expect_filetype(expected)
local screen = Screen.new(48, 4)
screen:attach()
- execute('filetype')
+ command('filetype')
screen:expect([[
^ |
~ |
diff --git a/test/functional/options/pastetoggle_spec.lua b/test/functional/options/pastetoggle_spec.lua
new file mode 100644
index 0000000000..ec3c60fe37
--- /dev/null
+++ b/test/functional/options/pastetoggle_spec.lua
@@ -0,0 +1,37 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local clear = helpers.clear
+local feed = helpers.feed
+local command = helpers.command
+local eq = helpers.eq
+local eval = helpers.eval
+local sleep = helpers.sleep
+
+describe("'pastetoggle' option", function()
+ before_each(function()
+ clear()
+ command('set nopaste')
+ command('set pastetoggle=a')
+ end)
+ it("toggles 'paste'", function()
+ eq(eval('&paste'), 0)
+ feed('a')
+ -- Need another key so that the vgetorpeek() function returns.
+ feed('j')
+ eq(eval('&paste'), 1)
+ end)
+ it("multiple key 'pastetoggle' is waited for", function()
+ eq(eval('&paste'), 0)
+ local pastetoggle = 'lllll'
+ command('set pastetoggle=' .. pastetoggle)
+ command('set timeoutlen=1 ttimeoutlen=10000')
+ feed(pastetoggle:sub(0, 2))
+ -- sleep() for long enough that vgetorpeek() is gotten into, but short
+ -- enough that ttimeoutlen is not reached.
+ sleep(200)
+ feed(pastetoggle:sub(3, -1))
+ -- Need another key so that the vgetorpeek() function returns.
+ feed('j')
+ eq(eval('&paste'), 1)
+ end)
+end)
diff --git a/test/functional/options/shortmess_spec.lua b/test/functional/options/shortmess_spec.lua
index 22e8a39b79..99a574ec46 100644
--- a/test/functional/options/shortmess_spec.lua
+++ b/test/functional/options/shortmess_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local clear, execute = helpers.clear, helpers.execute
+local clear, feed_command = helpers.clear, helpers.feed_command
if helpers.pending_win32(pending) then return end
@@ -19,7 +19,7 @@ describe("'shortmess'", function()
describe('"F" flag', function()
it('hides messages about the files read', function()
- execute('e test')
+ feed_command('e test')
screen:expect([[
^ |
~ |
@@ -27,8 +27,8 @@ describe("'shortmess'", function()
~ |
"test" is a directory |
]])
- execute('set shortmess=F')
- execute('e test')
+ feed_command('set shortmess=F')
+ feed_command('e test')
screen:expect([[
^ |
~ |
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua
index 52dc008707..644cd46092 100644
--- a/test/functional/plugin/health_spec.lua
+++ b/test/functional/plugin/health_spec.lua
@@ -1,6 +1,8 @@
local helpers = require('test.functional.helpers')(after_each)
local plugin_helpers = require('test.functional.plugin.helpers')
+local command = helpers.command
+
describe('health.vim', function()
before_each(function()
plugin_helpers.reset()
@@ -8,7 +10,7 @@ describe('health.vim', function()
-- health#broken#check()
-- health#success1#check()
-- health#success2#check()
- helpers.execute("set runtimepath+=test/functional/fixtures")
+ command("set runtimepath+=test/functional/fixtures")
end)
it("reports", function()
@@ -43,7 +45,7 @@ describe('health.vim', function()
describe(":CheckHealth", function()
it("concatenates multiple reports", function()
- helpers.execute("CheckHealth success1 success2")
+ command("CheckHealth success1 success2")
helpers.expect([[
health#success1#check
@@ -62,7 +64,7 @@ describe('health.vim', function()
end)
it("gracefully handles broken healthcheck", function()
- helpers.execute("CheckHealth broken")
+ command("CheckHealth broken")
helpers.expect([[
health#broken#check
@@ -74,7 +76,7 @@ describe('health.vim', function()
end)
it("gracefully handles invalid healthcheck", function()
- helpers.execute("CheckHealth non_existent_healthcheck")
+ command("CheckHealth non_existent_healthcheck")
helpers.expect([[
health#non_existent_healthcheck#check
diff --git a/test/functional/plugin/matchparen_spec.lua b/test/functional/plugin/matchparen_spec.lua
index 3e1ab70daf..51ec7e4870 100644
--- a/test/functional/plugin/matchparen_spec.lua
+++ b/test/functional/plugin/matchparen_spec.lua
@@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local plugin_helpers = require('test.functional.plugin.helpers')
local Screen = require('test.functional.ui.screen')
-local execute = helpers.execute
+local command = helpers.command
local meths = helpers.meths
local feed = helpers.feed
local eq = helpers.eq
@@ -23,7 +23,7 @@ describe('matchparen', function()
end)
it('uses correct column after i_<Up>. Vim patch 7.4.1296', function()
- execute('set noautoindent nosmartindent nocindent laststatus=0')
+ command('set noautoindent nosmartindent nocindent laststatus=0')
eq(1, meths.get_var('loaded_matchparen'))
feed('ivoid f_test()<cr>')
feed('{<cr>')
diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua
index a4e9a49c8a..89a546675f 100644
--- a/test/functional/provider/python3_spec.lua
+++ b/test/functional/provider/python3_spec.lua
@@ -2,6 +2,7 @@ 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
+local feed_command = helpers.feed_command
do
clear()
@@ -30,6 +31,15 @@ describe('python3 commands and functions', function()
eq({100, 0}, eval('g:set_by_python3'))
end)
+ it('does not truncate error message <1 MB', function()
+ -- XXX: Python limits the error name to 200 chars, so this test is
+ -- mostly bogus.
+ local very_long_symbol = string.rep('a', 1200)
+ feed_command(':silent! py3 print('..very_long_symbol..' b)')
+ -- Truncated error message would not contain this (last) line.
+ eq('SyntaxError: invalid syntax', eval('v:errmsg'))
+ end)
+
it('python3_execute with nested commands', function()
command([[python3 vim.command('python3 vim.command("python3 vim.command(\'let set_by_nested_python3 = 555\')")')]])
eq(555, eval('g:set_by_nested_python3'))
diff --git a/test/functional/spell/spellfile_spec.lua b/test/functional/spell/spellfile_spec.lua
new file mode 100644
index 0000000000..afd2c1bce4
--- /dev/null
+++ b/test/functional/spell/spellfile_spec.lua
@@ -0,0 +1,110 @@
+local helpers = require('test.functional.helpers')(after_each)
+local lfs = require('lfs')
+
+local eq = helpers.eq
+local clear = helpers.clear
+local meths = helpers.meths
+local exc_exec = helpers.exc_exec
+local rmdir = helpers.rmdir
+local write_file = helpers.write_file
+
+local testdir = 'Xtest-functional-spell-spellfile.d'
+
+describe('spellfile', function()
+ before_each(function()
+ clear()
+ rmdir(testdir)
+ lfs.mkdir(testdir)
+ lfs.mkdir(testdir .. '/spell')
+ end)
+ after_each(function()
+ rmdir(testdir)
+ end)
+ -- ┌ Magic string (#VIMSPELLMAGIC)
+ -- │ ┌ Spell file version (#VIMSPELLVERSION)
+ local spellheader = 'VIMspell\050'
+ it('errors out when prefcond section is truncated', function()
+ meths.set_option('runtimepath', testdir)
+ write_file(testdir .. '/spell/en.ascii.spl',
+ -- ┌ Section identifier (#SN_PREFCOND)
+ -- │ ┌ Section flags (#SNF_REQUIRED or zero)
+ -- │ │ ┌ Section length (4 bytes, MSB first)
+ spellheader .. '\003\001\000\000\000\003'
+ -- ┌ Number of regexes in section (2 bytes, MSB first)
+ -- │ ┌ Condition length (1 byte)
+ -- │ │ ┌ Condition regex (missing!)
+ .. '\000\001\001')
+ meths.set_option('spelllang', 'en')
+ eq('Vim(set):E758: Truncated spell file',
+ exc_exec('set spell'))
+ end)
+ it('errors out when prefcond regexp contains NUL byte', function()
+ meths.set_option('runtimepath', testdir)
+ write_file(testdir .. '/spell/en.ascii.spl',
+ -- ┌ Section identifier (#SN_PREFCOND)
+ -- │ ┌ Section flags (#SNF_REQUIRED or zero)
+ -- │ │ ┌ Section length (4 bytes, MSB first)
+ spellheader .. '\003\001\000\000\000\008'
+ -- ┌ Number of regexes in section (2 bytes, MSB first)
+ -- │ ┌ Condition length (1 byte)
+ -- │ │ ┌ Condition regex
+ -- │ │ │ ┌ End of sections marker
+ .. '\000\001\005ab\000cd\255'
+ -- ┌ LWORDTREE tree length (4 bytes)
+ -- │ ┌ KWORDTREE tree length (4 bytes)
+ -- │ │ ┌ PREFIXTREE tree length
+ .. '\000\000\000\000\000\000\000\000\000\000\000\000')
+ meths.set_option('spelllang', 'en')
+ eq('Vim(set):E759: Format error in spell file',
+ exc_exec('set spell'))
+ end)
+ it('errors out when region contains NUL byte', function()
+ meths.set_option('runtimepath', testdir)
+ write_file(testdir .. '/spell/en.ascii.spl',
+ -- ┌ Section identifier (#SN_REGION)
+ -- │ ┌ Section flags (#SNF_REQUIRED or zero)
+ -- │ │ ┌ Section length (4 bytes, MSB first)
+ spellheader .. '\000\001\000\000\000\008'
+ -- ┌ Regions ┌ End of sections marker
+ .. '01234\00067\255'
+ -- ┌ LWORDTREE tree length (4 bytes)
+ -- │ ┌ KWORDTREE tree length (4 bytes)
+ -- │ │ ┌ PREFIXTREE tree length
+ .. '\000\000\000\000\000\000\000\000\000\000\000\000')
+ meths.set_option('spelllang', 'en')
+ eq('Vim(set):E759: Format error in spell file',
+ exc_exec('set spell'))
+ end)
+ it('errors out when SAL section contains NUL byte', function()
+ meths.set_option('runtimepath', testdir)
+ write_file(testdir .. '/spell/en.ascii.spl',
+ -- ┌ Section identifier (#SN_SAL)
+ -- │ ┌ Section flags (#SNF_REQUIRED or zero)
+ -- │ │ ┌ Section length (4 bytes, MSB first)
+ spellheader .. '\005\001\000\000\000\008'
+ -- ┌ salflags
+ -- │ ┌ salcount (2 bytes, MSB first)
+ -- │ │ ┌ salfromlen (1 byte)
+ -- │ │ │ ┌ Special character
+ -- │ │ │ │┌ salfrom (should not contain NUL)
+ -- │ │ │ ││ ┌ saltolen
+ -- │ │ │ ││ │ ┌ salto
+ -- │ │ │ ││ │ │┌ End of sections marker
+ .. '\000\000\001\0024\000\0017\255'
+ -- ┌ LWORDTREE tree length (4 bytes)
+ -- │ ┌ KWORDTREE tree length (4 bytes)
+ -- │ │ ┌ PREFIXTREE tree length
+ .. '\000\000\000\000\000\000\000\000\000\000\000\000')
+ meths.set_option('spelllang', 'en')
+ eq('Vim(set):E759: Format error in spell file',
+ exc_exec('set spell'))
+ end)
+ it('errors out when spell header contains NUL bytes', function()
+ meths.set_option('runtimepath', testdir)
+ write_file(testdir .. '/spell/en.ascii.spl',
+ spellheader:sub(1, -3) .. '\000\000')
+ meths.set_option('spelllang', 'en')
+ eq('Vim(set):E757: This does not look like a spell file',
+ exc_exec('set spell'))
+ end)
+end)
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index 129390a7a5..48b8512bf0 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -2,7 +2,7 @@ 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
-local eval, execute, source = helpers.eval, helpers.execute, helpers.source
+local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.source
local eq, neq = helpers.eq, helpers.neq
local write_file = helpers.write_file
@@ -13,7 +13,7 @@ describe('terminal buffer', function()
before_each(function()
clear()
- execute('set modifiable swapfile undolevels=20')
+ feed_command('set modifiable swapfile undolevels=20')
wait()
screen = thelpers.screen_setup()
end)
@@ -86,7 +86,7 @@ describe('terminal buffer', function()
it('sends data to the terminal when the "put" operator is used', function()
feed('<c-\\><c-n>gg"ayj')
- execute('let @a = "appended " . @a')
+ feed_command('let @a = "appended " . @a')
feed('"ap"ap')
screen:expect([[
^tty ready |
@@ -112,8 +112,8 @@ describe('terminal buffer', function()
it('sends data to the terminal when the ":put" command is used', function()
feed('<c-\\><c-n>gg"ayj')
- execute('let @a = "appended " . @a')
- execute('put a')
+ feed_command('let @a = "appended " . @a')
+ feed_command('put a')
screen:expect([[
^tty ready |
appended tty ready |
@@ -124,7 +124,7 @@ describe('terminal buffer', function()
:put a |
]])
-- line argument is only used to move the cursor
- execute('6put a')
+ feed_command('6put a')
screen:expect([[
tty ready |
appended tty ready |
@@ -147,7 +147,7 @@ describe('terminal buffer', function()
{4:~ }|
:bd! |
]])
- execute('bnext')
+ feed_command('bnext')
screen:expect([[
^ |
{4:~ }|
@@ -162,7 +162,7 @@ describe('terminal buffer', function()
it('handles loss of focus gracefully', function()
-- Change the statusline to avoid printing the file name, which varies.
nvim('set_option', 'statusline', '==========')
- execute('set laststatus=0')
+ feed_command('set laststatus=0')
-- Save the buffer number of the terminal for later testing.
local tbuf = eval('bufnr("%")')
@@ -191,16 +191,16 @@ describe('terminal buffer', function()
]])
neq(tbuf, eval('bufnr("%")'))
- execute('quit!') -- Should exit the new window, not the terminal.
+ feed_command('quit!') -- Should exit the new window, not the terminal.
eq(tbuf, eval('bufnr("%")'))
- execute('set laststatus=1') -- Restore laststatus to the default.
+ feed_command('set laststatus=1') -- Restore laststatus to the default.
end)
it('term_close() use-after-free #4393', function()
- execute('terminal yes')
+ feed_command('terminal yes')
feed([[<C-\><C-n>]])
- execute('bdelete!')
+ feed_command('bdelete!')
end)
end)
@@ -217,12 +217,12 @@ describe('No heap-buffer-overflow when using', function()
end)
it('termopen(echo) #3161', function()
- execute('edit ' .. testfilename)
+ feed_command('edit ' .. testfilename)
-- Move cursor away from the beginning of the line
feed('$')
-- Let termopen() modify the buffer
- execute('call termopen("echo")')
+ feed_command('call termopen("echo")')
wait()
- execute('bdelete!')
+ feed_command('bdelete!')
end)
end)
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
index 84f14585fa..84d0322f12 100644
--- a/test/functional/terminal/cursor_spec.lua
+++ b/test/functional/terminal/cursor_spec.lua
@@ -2,7 +2,8 @@ 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
-local nvim_dir, execute = helpers.nvim_dir, helpers.execute
+local nvim_dir, command = helpers.nvim_dir, helpers.command
+local feed_command = helpers.feed_command
local hide_cursor = thelpers.hide_cursor
local show_cursor = thelpers.show_cursor
@@ -138,7 +139,8 @@ describe('cursor with customized highlighting', function()
[3] = {bold = true},
})
screen:attach({rgb=false})
- execute('call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
+ command('call termopen(["'..nvim_dir..'/tty-test"])')
+ feed_command('startinsert')
end)
it('overrides the default highlighting', function()
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
index 42a5c768bb..d2b2d8a60c 100644
--- a/test/functional/terminal/edit_spec.lua
+++ b/test/functional/terminal/edit_spec.lua
@@ -45,11 +45,8 @@ describe(':edit term://*', function()
local bufcontents = {}
local winheight = curwinmeths.get_height()
local buf_cont_start = rep_size - sb - winheight + 2
- local function bufline (i)
- return ('%d: foobar'):format(i)
- end
for i = buf_cont_start,(rep_size - 1) do
- bufcontents[#bufcontents + 1] = bufline(i)
+ bufcontents[#bufcontents + 1] = ('%d: foobar'):format(i)
end
bufcontents[#bufcontents + 1] = ''
bufcontents[#bufcontents + 1] = '[Process exited 0]'
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua
index 9bb683f25f..be0fd9f8ff 100644
--- a/test/functional/terminal/ex_terminal_spec.lua
+++ b/test/functional/terminal/ex_terminal_spec.lua
@@ -2,7 +2,7 @@ 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
-local execute, eval = helpers.execute, helpers.eval
+local feed_command, eval = helpers.feed_command, helpers.eval
if helpers.pending_win32(pending) then return end
@@ -23,11 +23,11 @@ describe(':terminal', function()
echomsg "msg3"
]])
-- Invoke a command that emits frequent terminal activity.
- execute([[terminal while true; do echo X; done]])
+ feed_command([[terminal while true; do echo X; done]])
helpers.feed([[<C-\><C-N>]])
wait()
- helpers.sleep(10) -- Let some terminal activity happen.
- execute("messages")
+ screen:sleep(10) -- Let some terminal activity happen.
+ feed_command("messages")
screen:expect([[
msg1 |
msg2 |
@@ -37,14 +37,14 @@ describe(':terminal', function()
end)
it("in normal-mode :split does not move cursor", function()
- execute([[terminal while true; do echo foo; sleep .1; done]])
+ feed_command([[terminal while true; do echo foo; sleep .1; done]])
helpers.feed([[<C-\><C-N>M]]) -- move cursor away from last line
wait()
eq(3, eval("line('$')")) -- window height
eq(2, eval("line('.')")) -- cursor is in the middle
- execute('vsplit')
+ feed_command('vsplit')
eq(2, eval("line('.')")) -- cursor stays where we put it
- execute('split')
+ feed_command('split')
eq(2, eval("line('.')")) -- cursor stays where we put it
end)
@@ -65,7 +65,7 @@ describe(':terminal (with fake shell)', function()
-- Invokes `:terminal {cmd}` using a fake shell (shell-test.c) which prints
-- the {cmd} and exits immediately .
local function terminal_with_fake_shell(cmd)
- execute("terminal "..(cmd and cmd or ""))
+ feed_command("terminal "..(cmd and cmd or ""))
end
it('with no argument, acts like termopen()', function()
@@ -157,7 +157,7 @@ describe(':terminal (with fake shell)', function()
end)
it('works with findfile()', function()
- execute('terminal')
+ feed_command('terminal')
eq('term://', string.match(eval('bufname("%")'), "^term://"))
eq('scripts/shadacat.py', eval('findfile("scripts/shadacat.py", ".")'))
end)
@@ -173,7 +173,7 @@ describe(':terminal (with fake shell)', function()
]])
eq('term://', string.match(eval('bufname("%")'), "^term://"))
helpers.feed([[<C-\><C-N>]])
- execute([[find */shadacat.py]])
+ feed_command([[find */shadacat.py]])
eq('scripts/shadacat.py', eval('bufname("%")'))
end)
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua
index 934c01e3bf..3b04d17705 100644
--- a/test/functional/terminal/helpers.lua
+++ b/test/functional/terminal/helpers.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(nil)
local Screen = require('test.functional.ui.screen')
local nvim_dir = helpers.nvim_dir
-local execute, nvim = helpers.execute, helpers.nvim
+local feed_command, nvim = helpers.feed_command, helpers.nvim
local function feed_data(data)
nvim('set_var', 'term_data', data)
@@ -58,15 +58,15 @@ local function screen_setup(extra_rows, command, cols)
screen:attach({rgb=false})
- execute('enew | call termopen('..command..')')
+ feed_command('enew | call termopen('..command..')')
nvim('input', '<CR>')
local vim_errmsg = nvim('eval', 'v:errmsg')
if vim_errmsg and "" ~= vim_errmsg then
error(vim_errmsg)
end
- execute('setlocal scrollback=10')
- execute('startinsert')
+ feed_command('setlocal scrollback=10')
+ feed_command('startinsert')
-- tty-test puts the terminal into raw mode and echoes input. Tests work by
-- feeding termcodes to control the display and asserting by screen:expect.
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index 0fe463401e..bb40770235 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -2,7 +2,7 @@ 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
-local nvim_dir, execute = helpers.nvim_dir, helpers.execute
+local nvim_dir, command = helpers.nvim_dir, helpers.command
local eq, eval = helpers.eq, helpers.eval
if helpers.pending_win32(pending) then return end
@@ -27,7 +27,8 @@ describe('terminal window highlighting', function()
[11] = {background = 11},
})
screen:attach({rgb=false})
- execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
+ command('enew | call termopen(["'..nvim_dir..'/tty-test"])')
+ feed('i')
screen:expect([[
tty ready |
{10: } |
@@ -130,7 +131,8 @@ describe('terminal window highlighting with custom palette', function()
})
screen:attach({rgb=true})
nvim('set_var', 'terminal_color_3', '#123456')
- execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert')
+ command('enew | call termopen(["'..nvim_dir..'/tty-test"])')
+ feed('i')
screen:expect([[
tty ready |
{7: } |
@@ -164,9 +166,9 @@ describe('synIDattr()', function()
before_each(function()
clear()
screen = Screen.new(50, 7)
- execute('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black')
+ command('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black')
-- Salmon #fa8072 Maroon #800000
- execute('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon')
+ command('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon')
end)
it('returns cterm-color if RGB-capable UI is _not_ attached', function()
@@ -213,8 +215,8 @@ describe('fg/bg special colors', function()
before_each(function()
clear()
screen = Screen.new(50, 7)
- execute('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black')
- execute('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg')
+ command('highlight Normal ctermfg=145 ctermbg=16 guifg=#ff0000 guibg=Black')
+ command('highlight Visual ctermfg=bg ctermbg=fg guifg=bg guibg=fg guisp=bg')
end)
it('resolve to "Normal" values', function()
@@ -251,7 +253,7 @@ describe('fg/bg special colors', function()
screen:attach({rgb=true})
local new_guibg = '#282c34'
local new_guifg = '#abb2bf'
- execute('highlight Normal guifg='..new_guifg..' guibg='..new_guibg)
+ command('highlight Normal guifg='..new_guifg..' guibg='..new_guibg)
eq(new_guibg, eval('synIDattr(hlID("Visual"), "fg#")'))
eq(new_guifg, eval('synIDattr(hlID("Visual"), "bg#")'))
eq(new_guibg, eval('synIDattr(hlID("Visual"), "sp#")'))
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 4ead288a19..05f81295c2 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -2,7 +2,7 @@ local Screen = require('test.functional.ui.screen')
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
+local feed, nvim_dir, feed_command = helpers.feed, helpers.nvim_dir, helpers.feed_command
local eval = helpers.eval
local command = helpers.command
local wait = helpers.wait
@@ -339,7 +339,7 @@ describe('terminal prints more lines than the screen height and exits', function
clear()
local screen = Screen.new(30, 7)
screen:attach({rgb=false})
- execute('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert')
+ feed_command('call termopen(["'..nvim_dir..'/tty-test", "10"]) | startinsert')
wait()
screen:expect([[
line6 |
@@ -451,7 +451,14 @@ describe("'scrollback' option", function()
it(':setlocal in a normal buffer is an error', function()
command('new')
- execute('setlocal scrollback=42')
+
+ -- :setlocal to -1 is NOT an error.
+ feed_command('setlocal scrollback=-1')
+ eq(nil, string.match(eval("v:errmsg"), "E%d*:"))
+ feed('<CR>')
+
+ -- :setlocal to anything except -1 is an error.
+ feed_command('setlocal scrollback=42')
feed('<CR>')
eq('E474:', string.match(eval("v:errmsg"), "E%d*:"))
eq(-1, curbufmeths.get_option('scrollback'))
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 90051b8cd5..b14bceecdd 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2,9 +2,10 @@
-- as a simple way to send keys and assert screen state.
local helpers = require('test.functional.helpers')(after_each)
local thelpers = require('test.functional.terminal.helpers')
-local feed = thelpers.feed_data
-local execute = helpers.execute
+local feed_data = thelpers.feed_data
+local feed_command = helpers.feed_command
local nvim_dir = helpers.nvim_dir
+local retry = helpers.retry
if helpers.pending_win32(pending) then return end
@@ -34,7 +35,7 @@ describe('tui', function()
end)
it('accepts basic utf-8 input', function()
- feed('iabc\ntest1\ntest2')
+ feed_data('iabc\ntest1\ntest2')
screen:expect([[
abc |
test1 |
@@ -44,7 +45,7 @@ describe('tui', function()
{3:-- INSERT --} |
{3:-- TERMINAL --} |
]])
- feed('\027')
+ feed_data('\027')
screen:expect([[
abc |
test1 |
@@ -59,8 +60,8 @@ describe('tui', function()
it('interprets leading <Esc> byte as ALT modifier in normal-mode', function()
local keys = 'dfghjkl'
for c in keys:gmatch('.') do
- execute('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>')
- feed('\027'..c)
+ feed_command('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>')
+ feed_data('\027'..c)
end
screen:expect([[
alt-j |
@@ -71,7 +72,7 @@ describe('tui', function()
|
{3:-- TERMINAL --} |
]])
- feed('gg')
+ feed_data('gg')
screen:expect([[
{1:a}lt-d |
alt-f |
@@ -90,7 +91,7 @@ describe('tui', function()
-- Example: for input ALT+j:
-- * Vim (Nvim prior to #3982) sets high-bit, inserts "ê".
-- * Nvim (after #3982) inserts "j".
- feed('i\027j')
+ feed_data('i\027j')
screen:expect([[
j{1: } |
{4:~ }|
@@ -103,10 +104,10 @@ describe('tui', function()
end)
it('accepts ascii control sequences', function()
- feed('i')
- feed('\022\007') -- ctrl+g
- feed('\022\022') -- ctrl+v
- feed('\022\013') -- ctrl+m
+ feed_data('i')
+ feed_data('\022\007') -- ctrl+g
+ feed_data('\022\022') -- ctrl+v
+ feed_data('\022\013') -- ctrl+m
screen:expect([[
{9:^G^V^M}{1: } |
{4:~ }|
@@ -119,7 +120,7 @@ describe('tui', function()
end)
it('automatically sends <Paste> for bracketed paste sequences', function()
- feed('i\027[200~')
+ feed_data('i\027[200~')
screen:expect([[
{1: } |
{4:~ }|
@@ -129,7 +130,7 @@ describe('tui', function()
{3:-- INSERT (paste) --} |
{3:-- TERMINAL --} |
]])
- feed('pasted from terminal')
+ feed_data('pasted from terminal')
screen:expect([[
pasted from terminal{1: } |
{4:~ }|
@@ -139,7 +140,7 @@ describe('tui', function()
{3:-- INSERT (paste) --} |
{3:-- TERMINAL --} |
]])
- feed('\027[201~')
+ feed_data('\027[201~')
screen:expect([[
pasted from terminal{1: } |
{4:~ }|
@@ -152,12 +153,12 @@ describe('tui', function()
end)
it('can handle arbitrarily long bursts of input', function()
- execute('set ruler')
+ feed_command('set ruler')
local t = {}
for i = 1, 3000 do
t[i] = 'item ' .. tostring(i)
end
- feed('i\027[200~'..table.concat(t, '\n')..'\027[201~')
+ feed_data('i\027[200~'..table.concat(t, '\n')..'\027[201~')
screen:expect([[
item 2997 |
item 2998 |
@@ -180,7 +181,7 @@ describe('tui with non-tty file descriptors', function()
it('can handle pipes as stdout and stderr', function()
local screen = thelpers.screen_setup(0, '"'..helpers.nvim_prog
..' -u NONE -i NONE --cmd \'set noswapfile noshowcmd noruler\' --cmd \'normal iabc\' > /dev/null 2>&1 && cat testF && rm testF"')
- feed(':w testF\n:q\n')
+ feed_data(':w testF\n:q\n')
screen:expect([[
:w testF |
:q |
@@ -200,12 +201,13 @@ describe('tui focus event handling', function()
helpers.clear()
screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog
..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile noshowcmd noruler"]')
- execute('autocmd FocusGained * echo "gained"')
- execute('autocmd FocusLost * echo "lost"')
+ feed_data(":autocmd FocusGained * echo 'gained'\n")
+ feed_data(":autocmd FocusLost * echo 'lost'\n")
+ feed_data("\034\016") -- CTRL-\ CTRL-N
end)
it('can handle focus events in normal mode', function()
- feed('\027[I')
+ feed_data('\027[I')
screen:expect([[
{1: } |
{4:~ }|
@@ -216,7 +218,7 @@ describe('tui focus event handling', function()
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
{1: } |
{4:~ }|
@@ -229,9 +231,9 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in insert mode', function()
- execute('set noshowmode')
- feed('i')
- feed('\027[I')
+ feed_command('set noshowmode')
+ feed_data('i')
+ feed_data('\027[I')
screen:expect([[
{1: } |
{4:~ }|
@@ -241,7 +243,7 @@ describe('tui focus event handling', function()
gained |
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
{1: } |
{4:~ }|
@@ -254,8 +256,8 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in cmdline mode', function()
- feed(':')
- feed('\027[I')
+ feed_data(':')
+ feed_data('\027[I')
screen:expect([[
|
{4:~ }|
@@ -265,7 +267,7 @@ describe('tui focus event handling', function()
g{1:a}ined |
{3:-- TERMINAL --} |
]])
- feed('\027[O')
+ feed_data('\027[O')
screen:expect([[
|
{4:~ }|
@@ -278,30 +280,36 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in terminal mode', function()
- execute('set shell='..nvim_dir..'/shell-test')
- execute('set laststatus=0')
- execute('set noshowmode')
- execute('terminal')
- feed('\027[I')
- screen:expect([[
- ready $ |
- [Process exited 0]{1: } |
- |
- |
- |
- gained |
- {3:-- TERMINAL --} |
- ]])
- feed('\027[O')
- screen:expect([[
- ready $ |
- [Process exited 0]{1: } |
- |
- |
- |
- lost |
- {3:-- TERMINAL --} |
- ]])
+ feed_data(':set shell='..nvim_dir..'/shell-test\n')
+ feed_data(':set noshowmode laststatus=0\n')
+
+ retry(2, 3 * screen.timeout, function()
+ feed_data(':terminal\n')
+ feed_data('\027[I')
+ screen:expect([[
+ ready $ |
+ [Process exited 0]{1: } |
+ |
+ |
+ |
+ gained |
+ {3:-- TERMINAL --} |
+ ]])
+ feed_data('\027[O')
+ screen:expect([[
+ ready $ |
+ [Process exited 0]{1: } |
+ |
+ |
+ |
+ lost |
+ {3:-- TERMINAL --} |
+ ]])
+
+ -- If retry is needed...
+ feed_data("\034\016") -- CTRL-\ CTRL-N
+ feed_data(':bwipeout!\n')
+ end)
end)
end)
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
index d3386a641e..4867e0d9fa 100644
--- a/test/functional/terminal/window_split_tab_spec.lua
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -2,7 +2,7 @@ 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
-local execute = helpers.execute
+local feed_command = helpers.feed_command
if helpers.pending_win32(pending) then return end
@@ -26,7 +26,7 @@ describe('terminal', function()
it('resets its size when entering terminal window', function()
feed('<c-\\><c-n>')
- execute('2split')
+ feed_command('2split')
screen:expect([[
rows: 2, cols: 50 |
{2:^ } |
@@ -39,7 +39,7 @@ describe('terminal', function()
========== |
:2split |
]])
- execute('wincmd p')
+ feed_command('wincmd p')
screen:expect([[
tty ready |
rows: 2, cols: 50 |
@@ -52,7 +52,7 @@ describe('terminal', function()
========== |
:wincmd p |
]])
- execute('wincmd p')
+ feed_command('wincmd p')
screen:expect([[
rows: 2, cols: 50 |
{2:^ } |
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 53fe303762..e1e11203e0 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -1,7 +1,8 @@
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
+local command, request, neq = helpers.command, helpers.request, helpers.neq
if helpers.pending_win32(pending) then return end
@@ -11,7 +12,7 @@ describe('Buffer highlighting', function()
before_each(function()
clear()
- execute("syntax on")
+ command('syntax on')
screen = Screen.new(40, 8)
screen:attach()
screen:set_default_attr_ids({
@@ -106,7 +107,7 @@ describe('Buffer highlighting', function()
combining highlights
from different sources]])
- execute("hi ImportantWord gui=bold cterm=bold")
+ command("hi ImportantWord gui=bold cterm=bold")
id1 = add_hl(0, "ImportantWord", 0, 2, 8)
add_hl(id1, "ImportantWord", 1, 12, -1)
add_hl(id1, "ImportantWord", 2, 0, 9)
@@ -131,7 +132,7 @@ describe('Buffer highlighting', function()
{1:~ }|
{1:~ }|
{1:~ }|
- :hi ImportantWord gui=bold cterm=bold |
+ |
]])
end)
@@ -145,7 +146,7 @@ describe('Buffer highlighting', function()
{1:~ }|
{1:~ }|
{1:~ }|
- :hi ImportantWord gui=bold cterm=bold |
+ |
]])
end)
@@ -159,7 +160,7 @@ describe('Buffer highlighting', function()
{1:~ }|
{1:~ }|
{1:~ }|
- :hi ImportantWord gui=bold cterm=bold |
+ |
]])
end)
@@ -175,7 +176,7 @@ describe('Buffer highlighting', function()
{1:~ }|
{1:~ }|
{1:~ }|
- :hi ImportantWord gui=bold cterm=bold |
+ |
]])
end)
@@ -192,7 +193,7 @@ describe('Buffer highlighting', function()
|
]])
- execute(':3move 4')
+ command(':3move 4')
screen:expect([[
a {5:longer} example |
|
@@ -201,7 +202,7 @@ describe('Buffer highlighting', function()
{1:~ }|
{1:~ }|
{1:~ }|
- ::3move 4 |
+ |
]])
end)
end)
diff --git a/test/functional/ui/cursor_spec.lua b/test/functional/ui/cursor_spec.lua
new file mode 100644
index 0000000000..abe0e0b1fd
--- /dev/null
+++ b/test/functional/ui/cursor_spec.lua
@@ -0,0 +1,213 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear, meths = helpers.clear, helpers.meths
+local eq = helpers.eq
+local command = helpers.command
+
+describe('ui/cursor', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(25, 5)
+ screen:attach()
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ it("'guicursor' is published as a UI event", function()
+ local expected_mode_info = {
+ [1] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 0,
+ cursor_shape = 'block',
+ name = 'normal',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'n' },
+ [2] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 0,
+ cursor_shape = 'block',
+ name = 'visual',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'v' },
+ [3] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 25,
+ cursor_shape = 'vertical',
+ name = 'insert',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'i' },
+ [4] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 20,
+ cursor_shape = 'horizontal',
+ name = 'replace',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'r' },
+ [5] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 0,
+ cursor_shape = 'block',
+ name = 'cmdline_normal',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'c' },
+ [6] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 25,
+ cursor_shape = 'vertical',
+ name = 'cmdline_insert',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'ci' },
+ [7] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 20,
+ cursor_shape = 'horizontal',
+ name = 'cmdline_replace',
+ hl_id = 46,
+ id_lm = 47,
+ mouse_shape = 0,
+ short_name = 'cr' },
+ [8] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 50,
+ cursor_shape = 'horizontal',
+ name = 'operator',
+ hl_id = 46,
+ id_lm = 46,
+ mouse_shape = 0,
+ short_name = 'o' },
+ [9] = {
+ blinkoff = 250,
+ blinkon = 400,
+ blinkwait = 700,
+ cell_percentage = 35,
+ cursor_shape = 'vertical',
+ name = 'visual_select',
+ hl_id = 46,
+ id_lm = 46,
+ mouse_shape = 0,
+ short_name = 've' },
+ [10] = {
+ name = 'cmdline_hover',
+ mouse_shape = 0,
+ short_name = 'e' },
+ [11] = {
+ name = 'statusline_hover',
+ mouse_shape = 0,
+ short_name = 's' },
+ [12] = {
+ name = 'statusline_drag',
+ mouse_shape = 0,
+ short_name = 'sd' },
+ [13] = {
+ name = 'vsep_hover',
+ mouse_shape = 0,
+ short_name = 'vs' },
+ [14] = {
+ name = 'vsep_drag',
+ mouse_shape = 0,
+ short_name = 'vd' },
+ [15] = {
+ name = 'more',
+ mouse_shape = 0,
+ short_name = 'm' },
+ [16] = {
+ name = 'more_lastline',
+ mouse_shape = 0,
+ short_name = 'ml' },
+ [17] = {
+ blinkoff = 150,
+ blinkon = 175,
+ blinkwait = 175,
+ cell_percentage = 0,
+ cursor_shape = 'block',
+ name = 'showmatch',
+ hl_id = 46,
+ id_lm = 46,
+ short_name = 'sm' },
+ }
+
+ screen:expect(function()
+ -- Default 'guicursor' published on startup.
+ eq(expected_mode_info, screen._mode_info)
+ eq(true, screen._cursor_style_enabled)
+ eq('normal', screen.mode)
+ end)
+
+ -- Event is published ONLY if the cursor style changed.
+ screen._mode_info = nil
+ command("echo 'test'")
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ test |
+ ]], nil, nil, function()
+ eq(nil, screen._mode_info)
+ end)
+
+ -- Change the cursor style.
+ meths.set_option('guicursor', 'n-v-c:ver35-blinkwait171-blinkoff172-blinkon173,ve:hor35,o:ver50,i-ci:block,r-cr:hor90,sm:ver42')
+ screen:expect(function()
+ local named = {}
+ for _, m in ipairs(screen._mode_info) do
+ named[m.name] = m
+ end
+ eq('vertical', named.normal.cursor_shape)
+ eq('horizontal', named.visual_select.cursor_shape)
+ eq('vertical', named.operator.cursor_shape)
+ eq('block', named.insert.cursor_shape)
+ eq('vertical', named.showmatch.cursor_shape)
+ eq(171, named.normal.blinkwait)
+ eq(172, named.normal.blinkoff)
+ eq(173, named.normal.blinkon)
+ end)
+ end)
+
+ it("empty 'guicursor' sets cursor_shape=block in all modes", function()
+ meths.set_option('guicursor', '')
+ screen:expect(function()
+ -- Empty 'guicursor' sets enabled=false.
+ eq(false, screen._cursor_style_enabled)
+ for _, m in ipairs(screen._mode_info) do
+ if m['cursor_shape'] ~= nil then
+ eq('block', m.cursor_shape)
+ eq(0, m.blinkon)
+ end
+ end
+ end)
+ end)
+
+end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 7a1b8c91e7..2bda907c33 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -2,23 +2,23 @@ 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
-local execute, request, eq = helpers.execute, helpers.request, helpers.eq
+local command = helpers.command
+local eval = helpers.eval
+local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq
-if helpers.pending_win32(pending) then return end
-
-describe('color scheme compatibility', function()
+describe('colorscheme compatibility', function()
before_each(function()
clear()
end)
it('t_Co is set to 256 by default', function()
- eq('256', request('vim_eval', '&t_Co'))
+ eq('256', eval('&t_Co'))
request('nvim_set_option', 't_Co', '88')
- eq('88', request('vim_eval', '&t_Co'))
+ eq('88', eval('&t_Co'))
end)
end)
-describe('manual syntax highlight', function()
+describe('highlight: `:syntax manual`', function()
-- When using manual syntax highlighting, it should be preserved even when
-- switching buffers... bug did only occur without :set hidden
-- Ref: vim patch 7.4.1236
@@ -41,18 +41,18 @@ describe('manual syntax highlight', function()
end)
it("works with buffer switch and 'hidden'", function()
- execute('e tmp1.vim')
- execute('e Xtest-functional-ui-highlight.tmp.vim')
- execute('filetype on')
- execute('syntax manual')
- execute('set ft=vim')
- execute('set syntax=ON')
+ feed_command('e tmp1.vim')
+ feed_command('e Xtest-functional-ui-highlight.tmp.vim')
+ feed_command('filetype on')
+ feed_command('syntax manual')
+ feed_command('set ft=vim')
+ feed_command('set syntax=ON')
feed('iecho 1<esc>0')
- execute('set hidden')
- execute('w')
- execute('bn')
- execute('bp')
+ feed_command('set hidden')
+ feed_command('w')
+ feed_command('bn')
+ feed_command('bp')
screen:expect([[
{1:^echo} 1 |
{0:~ }|
@@ -63,32 +63,32 @@ describe('manual syntax highlight', function()
end)
it("works with buffer switch and 'nohidden'", function()
- execute('e tmp1.vim')
- execute('e Xtest-functional-ui-highlight.tmp.vim')
- execute('filetype on')
- execute('syntax manual')
- execute('set ft=vim')
- execute('set syntax=ON')
+ command('e tmp1.vim')
+ command('e Xtest-functional-ui-highlight.tmp.vim')
+ command('filetype on')
+ command('syntax manual')
+ command('set filetype=vim fileformat=unix')
+ command('set syntax=ON')
feed('iecho 1<esc>0')
- execute('set nohidden')
- execute('w')
- execute('bn')
- execute('bp')
+ command('set nohidden')
+ command('w')
+ command('silent bn')
+ eq("tmp1.vim", eval("fnamemodify(bufname('%'), ':t')"))
+ feed_command('silent bp')
+ eq("Xtest-functional-ui-highlight.tmp.vim", eval("fnamemodify(bufname('%'), ':t')"))
screen:expect([[
{1:^echo} 1 |
{0:~ }|
{0:~ }|
{0:~ }|
- <ht.tmp.vim" 1L, 7C |
+ :silent bp |
]])
end)
end)
-describe('Default highlight groups', function()
- -- Test the default attributes for highlight groups shown by the :highlight
- -- command
+describe('highlight defaults', function()
local screen
before_each(function()
@@ -107,7 +107,7 @@ describe('Default highlight groups', function()
[1] = {reverse = true, bold = true}, -- StatusLine
[2] = {reverse = true} -- StatusLineNC
})
- execute('sp', 'vsp', 'vsp')
+ feed_command('sp', 'vsp', 'vsp')
screen:expect([[
^ {2:|} {2:|} |
{0:~ }{2:|}{0:~ }{2:|}{0:~ }|
@@ -200,58 +200,31 @@ describe('Default highlight groups', function()
it('insert mode text', function()
feed('i')
+ screen:try_resize(53, 4)
screen:expect([[
^ |
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
{1:-- INSERT --} |
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold = true}})
end)
it('end of file markers', function()
+ screen:try_resize(53, 4)
screen:expect([[
^ |
{1:~ }|
{1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
- {1:~ }|
|
]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
end)
it('"wait return" text', function()
+ screen:try_resize(53, 4)
feed(':ls<cr>')
screen:expect([[
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
:ls |
1 %a "[No Name]" line 1 |
{1:Press ENTER or type command to continue}^ |
@@ -259,89 +232,84 @@ describe('Default highlight groups', function()
[1] = {bold = true, foreground = Screen.colors.SeaGreen}})
feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
end)
+
it('can be cleared and linked to other highlight groups', function()
- execute('highlight clear ModeMsg')
+ screen:try_resize(53, 4)
+ feed_command('highlight clear ModeMsg')
feed('i')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
-- INSERT -- |
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {bold=true}})
feed('<esc>')
- execute('highlight CustomHLGroup guifg=red guibg=green')
- execute('highlight link ModeMsg CustomHLGroup')
+ feed_command('highlight CustomHLGroup guifg=red guibg=green')
+ feed_command('highlight link ModeMsg CustomHLGroup')
feed('i')
screen:expect([[
^ |
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
{1:-- INSERT --} |
]], {[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
end)
+
it('can be cleared by assigning NONE', function()
- execute('syn keyword TmpKeyword neovim')
- execute('hi link TmpKeyword ErrorMsg')
+ screen:try_resize(53, 4)
+ feed_command('syn keyword TmpKeyword neovim')
+ feed_command('hi link TmpKeyword ErrorMsg')
insert('neovim')
screen:expect([[
{1:neovi^m} |
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
|
]], {
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
})
- execute("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
+ feed_command("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
.. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
screen:expect([[
neovi^m |
{0:~ }|
{0:~ }|
+ |
+ ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
+ end)
+
+ it('Cursor after `:hi clear|syntax reset` #6508', function()
+ command('highlight clear|syntax reset')
+ eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]]))
+ end)
+
+ it('Whitespace highlight', function()
+ screen:try_resize(53, 4)
+ feed_command('highlight NonText gui=NONE guifg=#FF0000')
+ feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
+ insert(' ne \t o\tv im ')
+ screen:expect([[
+ ne{0:.>----.}o{0:>-----}v{0:..}im{0:*^*¬} |
{0:~ }|
{0:~ }|
+ |
+ ]], {
+ [0] = {foreground=Screen.colors.Red},
+ [1] = {foreground=Screen.colors.Blue},
+ })
+ feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
+ screen:expect([[
+ ne{1:.>----.}o{1:>-----}v{1:..}im{1:*^*}{0:¬} |
{0:~ }|
{0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
+ :highlight Whitespace gui=NONE guifg=#0000FF |
+ ]], {
+ [0] = {foreground=Screen.colors.Red},
+ [1] = {foreground=Screen.colors.Blue},
+ })
end)
end)
@@ -355,19 +323,19 @@ describe('guisp (special/undercurl)', function()
end)
it('can be set and is applied like foreground or background', function()
- execute('syntax on')
- execute('syn keyword TmpKeyword neovim')
- execute('syn keyword TmpKeyword1 special')
- execute('syn keyword TmpKeyword2 specialwithbg')
- execute('syn keyword TmpKeyword3 specialwithfg')
- execute('hi! Awesome guifg=red guibg=yellow guisp=red')
- execute('hi! Awesome1 guisp=red')
- execute('hi! Awesome2 guibg=yellow guisp=red')
- execute('hi! Awesome3 guifg=red guisp=red')
- execute('hi link TmpKeyword Awesome')
- execute('hi link TmpKeyword1 Awesome1')
- execute('hi link TmpKeyword2 Awesome2')
- execute('hi link TmpKeyword3 Awesome3')
+ feed_command('syntax on')
+ feed_command('syn keyword TmpKeyword neovim')
+ feed_command('syn keyword TmpKeyword1 special')
+ feed_command('syn keyword TmpKeyword2 specialwithbg')
+ feed_command('syn keyword TmpKeyword3 specialwithfg')
+ feed_command('hi! Awesome guifg=red guibg=yellow guisp=red')
+ feed_command('hi! Awesome1 guisp=red')
+ feed_command('hi! Awesome2 guibg=yellow guisp=red')
+ feed_command('hi! Awesome3 guifg=red guisp=red')
+ feed_command('hi link TmpKeyword Awesome')
+ feed_command('hi link TmpKeyword1 Awesome1')
+ feed_command('hi link TmpKeyword2 Awesome2')
+ feed_command('hi link TmpKeyword3 Awesome3')
insert([[
neovim
awesome neovim
@@ -419,8 +387,8 @@ describe("'listchars' highlight", function()
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {background=Screen.colors.Grey90}
})
- execute('highlight clear ModeMsg')
- execute('set cursorline')
+ feed_command('highlight clear ModeMsg')
+ feed_command('set cursorline')
feed('i')
screen:expect([[
{1:^ }|
@@ -445,7 +413,7 @@ describe("'listchars' highlight", function()
{0:~ }|
|
]])
- execute('set nocursorline')
+ feed_command('set nocursorline')
screen:expect([[
abcdefg |
kkasd^f |
@@ -469,8 +437,8 @@ describe("'listchars' highlight", function()
^f |
|
]])
- execute('set cursorline')
- execute('set cursorcolumn')
+ feed_command('set cursorline')
+ feed_command('set cursorcolumn')
feed('kkiabcdefghijk<esc>hh')
screen:expect([[
kkasd {1: } |
@@ -509,11 +477,11 @@ describe("'listchars' highlight", function()
foreground=Screen.colors.Red,
},
})
- execute('highlight clear ModeMsg')
- execute('highlight SpecialKey guifg=#FF0000')
- execute('set cursorline')
- execute('set tabstop=8')
- execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed_command('highlight clear ModeMsg')
+ feed_command('highlight Whitespace guifg=#FF0000')
+ feed_command('set cursorline')
+ feed_command('set tabstop=8')
+ feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
feed('i\t abcd <cr>\t abcd <cr><esc>k')
screen:expect([[
{5:>-------.}abcd{5:*}{4:¬} |
@@ -530,7 +498,7 @@ describe("'listchars' highlight", function()
{4:~ }|
|
]])
- execute('set nocursorline')
+ feed_command('set nocursorline')
screen:expect([[
{5:^>-------.}abcd{5:*}{4:¬} |
{5:>-------.}abcd{5:*}{4:¬} |
@@ -538,7 +506,7 @@ describe("'listchars' highlight", function()
{4:~ }|
:set nocursorline |
]])
- execute('set nowrap')
+ feed_command('set nowrap')
feed('ALorem ipsum dolor sit amet<ESC>0')
screen:expect([[
{5:^>-------.}abcd{5:.}Lorem{4:>}|
@@ -547,7 +515,7 @@ describe("'listchars' highlight", function()
{4:~ }|
|
]])
- execute('set cursorline')
+ feed_command('set cursorline')
screen:expect([[
{2:^>-------.}{1:abcd}{2:.}{1:Lorem}{4:>}|
{5:>-------.}abcd{5:*}{4:¬} |
@@ -605,12 +573,12 @@ describe("'listchars' highlight", function()
bold=true,
},
})
- execute('highlight clear ModeMsg')
- execute('highlight SpecialKey guifg=#FF0000')
- execute('set cursorline')
- execute('set tabstop=8')
- execute('set nowrap')
- execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed_command('highlight clear ModeMsg')
+ feed_command('highlight Whitespace guifg=#FF0000')
+ feed_command('set cursorline')
+ feed_command('set tabstop=8')
+ feed_command('set nowrap')
+ feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
screen:expect([[
{2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
@@ -652,10 +620,10 @@ describe("'listchars' highlight", function()
[2] = {foreground=Screen.colors.Red},
[3] = {foreground=Screen.colors.Green1},
})
- execute('highlight clear ModeMsg')
- execute('highlight SpecialKey guifg=#FF0000')
- execute('highlight Error guifg=#00FF00')
- execute('set nowrap')
+ feed_command('highlight clear ModeMsg')
+ feed_command('highlight Whitespace guifg=#FF0000')
+ feed_command('highlight Error guifg=#00FF00')
+ feed_command('set nowrap')
feed('ia \t bc \t <esc>')
screen:expect([[
a bc ^ |
@@ -664,7 +632,7 @@ describe("'listchars' highlight", function()
{0:~ }|
|
]])
- execute('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
+ feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
screen:expect([[
a{2:.>-----.}bc{2:*>---*^*}{0:¬} |
{0:~ }|
@@ -672,7 +640,7 @@ describe("'listchars' highlight", function()
{0:~ }|
|
]])
- execute('match Error /\\s\\+$/')
+ feed_command('match Error /\\s\\+$/')
screen:expect([[
a{2:.>-----.}bc{3:*>---*^*}{0:¬} |
{0:~ }|
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 3b31da0397..a7be1a9dc8 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -1,10 +1,11 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
+local command = helpers.command
local curbufmeths = helpers.curbufmeths
local eq = helpers.eq
local eval = helpers.eval
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local expect = helpers.expect
local feed = helpers.feed
local insert = helpers.insert
@@ -21,9 +22,9 @@ local default_text = [[
local function common_setup(screen, inccommand, text)
if screen then
- execute("syntax on")
- execute("set nohlsearch")
- execute("hi Substitute guifg=red guibg=yellow")
+ command("syntax on")
+ command("set nohlsearch")
+ command("hi Substitute guifg=red guibg=yellow")
screen:attach()
screen:set_default_attr_ids({
[1] = {foreground = Screen.colors.Fuchsia},
@@ -46,7 +47,7 @@ local function common_setup(screen, inccommand, text)
})
end
- execute("set inccommand=" .. (inccommand and inccommand or ""))
+ command("set inccommand=" .. (inccommand and inccommand or ""))
if text then
insert(text)
@@ -91,8 +92,8 @@ describe(":substitute, 'inccommand' preserves", function()
local screen = Screen.new(30,10)
common_setup(screen, "split", "ABC")
- execute("%s/AB/BA/")
- execute("ls")
+ feed_command("%s/AB/BA/")
+ feed_command("ls")
screen:expect([[
{15:~ }|
@@ -111,25 +112,25 @@ describe(":substitute, 'inccommand' preserves", function()
for _, case in pairs{"", "split", "nosplit"} do
it("various delimiters (inccommand="..case..")", function()
insert(default_text)
- execute("set inccommand=" .. case)
+ feed_command("set inccommand=" .. case)
local delims = { '/', '#', ';', '%', ',', '@', '!', ''}
for _,delim in pairs(delims) do
- execute("%s"..delim.."lines"..delim.."LINES"..delim.."g")
+ feed_command("%s"..delim.."lines"..delim.."LINES"..delim.."g")
expect([[
Inc substitution on
two LINES
]])
- execute("undo")
+ feed_command("undo")
end
end)
end
for _, case in pairs{"", "split", "nosplit"} do
it("'undolevels' (inccommand="..case..")", function()
- execute("set undolevels=139")
- execute("setlocal undolevels=34")
- execute("set inccommand=" .. case)
+ feed_command("set undolevels=139")
+ feed_command("setlocal undolevels=34")
+ feed_command("set inccommand=" .. case)
insert("as")
feed(":%s/as/glork/<enter>")
eq(meths.get_option('undolevels'), 139)
@@ -139,8 +140,8 @@ describe(":substitute, 'inccommand' preserves", function()
for _, case in ipairs({"", "split", "nosplit"}) do
it("empty undotree() (inccommand="..case..")", function()
- execute("set undolevels=1000")
- execute("set inccommand=" .. case)
+ feed_command("set undolevels=1000")
+ feed_command("set inccommand=" .. case)
local expected_undotree = eval("undotree()")
-- Start typing an incomplete :substitute command.
@@ -157,8 +158,8 @@ describe(":substitute, 'inccommand' preserves", function()
for _, case in ipairs({"", "split", "nosplit"}) do
it("undotree() with branches (inccommand="..case..")", function()
- execute("set undolevels=1000")
- execute("set inccommand=" .. case)
+ feed_command("set undolevels=1000")
+ feed_command("set inccommand=" .. case)
-- Make some changes.
feed([[isome text 1<C-\><C-N>]])
feed([[osome text 2<C-\><C-N>]])
@@ -192,7 +193,7 @@ describe(":substitute, 'inccommand' preserves", function()
for _, case in pairs{"", "split", "nosplit"} do
it("b:changedtick (inccommand="..case..")", function()
- execute("set inccommand=" .. case)
+ feed_command("set inccommand=" .. case)
feed([[isome text 1<C-\><C-N>]])
feed([[osome text 2<C-\><C-N>]])
local expected_tick = eval("b:changedtick")
@@ -271,18 +272,18 @@ describe(":substitute, 'inccommand' preserves undo", function()
local function test_sub(substring, split, redoable)
clear()
- execute("set inccommand=" .. split)
+ feed_command("set inccommand=" .. split)
insert("1")
feed("o2<esc>")
- execute("undo")
+ feed_command("undo")
feed("o3<esc>")
if redoable then
feed("o4<esc>")
- execute("undo")
+ feed_command("undo")
end
feed(substring.. "<enter>")
- execute("undo")
+ feed_command("undo")
feed("g-")
expect([[
@@ -297,15 +298,15 @@ describe(":substitute, 'inccommand' preserves undo", function()
local function test_notsub(substring, split, redoable)
clear()
- execute("set inccommand=" .. split)
+ feed_command("set inccommand=" .. split)
insert("1")
feed("o2<esc>")
- execute("undo")
+ feed_command("undo")
feed("o3<esc>")
if redoable then
feed("o4<esc>")
- execute("undo")
+ feed_command("undo")
end
feed(substring .. "<esc>")
@@ -331,7 +332,7 @@ describe(":substitute, 'inccommand' preserves undo", function()
local function test_threetree(substring, split)
clear()
- execute("set inccommand=" .. split)
+ feed_command("set inccommand=" .. split)
insert("1")
feed("o2<esc>")
@@ -424,22 +425,22 @@ describe(":substitute, 'inccommand' preserves undo", function()
for _, case in pairs(cases) do
clear()
common_setup(nil, case, default_text)
- execute("set undolevels=0")
+ feed_command("set undolevels=0")
feed("1G0")
insert("X")
feed(":%s/tw/MO/<esc>")
- execute("undo")
+ feed_command("undo")
expect(default_text)
- execute("undo")
+ feed_command("undo")
expect(default_text:gsub("Inc", "XInc"))
- execute("undo")
+ feed_command("undo")
- execute("%s/tw/MO/g")
+ feed_command("%s/tw/MO/g")
expect(default_text:gsub("tw", "MO"))
- execute("undo")
+ feed_command("undo")
expect(default_text)
- execute("undo")
+ feed_command("undo")
expect(default_text:gsub("tw", "MO"))
end
end)
@@ -450,13 +451,13 @@ describe(":substitute, 'inccommand' preserves undo", function()
for _, case in pairs(cases) do
clear()
common_setup(screen, case, default_text)
- execute("set undolevels=1")
+ feed_command("set undolevels=1")
feed("1G0")
insert("X")
feed("IY<esc>")
feed(":%s/tw/MO/<esc>")
- -- execute("undo") here would cause "Press ENTER".
+ -- feed_command("undo") here would cause "Press ENTER".
feed("u")
expect(default_text:gsub("Inc", "XInc"))
feed("u")
@@ -508,13 +509,13 @@ describe(":substitute, 'inccommand' preserves undo", function()
for _, case in pairs(cases) do
clear()
common_setup(screen, case, default_text)
- execute("set undolevels=2")
+ feed_command("set undolevels=2")
feed("2GAx<esc>")
feed("Ay<esc>")
feed("Az<esc>")
feed(":%s/tw/AR<esc>")
- -- using execute("undo") here will result in a "Press ENTER" prompt
+ -- feed_command("undo") here would cause "Press ENTER".
feed("u")
expect(default_text:gsub("lines", "linesxy"))
feed("u")
@@ -601,9 +602,9 @@ describe(":substitute, 'inccommand' preserves undo", function()
clear()
common_setup(screen, case, default_text)
- execute("set undolevels=-1")
+ feed_command("set undolevels=-1")
feed(":%s/tw/MO/g<enter>")
- -- using execute("undo") here will result in a "Press ENTER" prompt
+ -- feed_command("undo") here will result in a "Press ENTER" prompt
feed("u")
if case == "split" then
screen:expect([[
@@ -637,7 +638,7 @@ describe(":substitute, 'inccommand' preserves undo", function()
clear()
common_setup(screen, case, default_text)
- execute("set undolevels=-1")
+ feed_command("set undolevels=-1")
feed("1G")
feed("IL<esc>")
feed(":%s/tw/MO/g<esc>")
@@ -676,7 +677,7 @@ describe(":substitute, inccommand=split", function()
end)
it("preserves 'modified' buffer flag", function()
- execute("set nomodified")
+ feed_command("set nomodified")
feed(":%s/tw")
screen:expect([[
Inc substitution on |
@@ -804,7 +805,6 @@ describe(":substitute, inccommand=split", function()
it('does not show split window for :s/', function()
feed("2gg")
feed(":s/tw")
- wait()
screen:expect([[
Inc substitution on |
two lines |
@@ -825,7 +825,7 @@ describe(":substitute, inccommand=split", function()
end)
it("'hlsearch' is active, 'cursorline' is not", function()
- execute("set hlsearch cursorline")
+ feed_command("set hlsearch cursorline")
feed("gg")
-- Assert that 'cursorline' is active.
@@ -917,7 +917,7 @@ describe(":substitute, inccommand=split", function()
feed("gg")
feed("2yy")
feed("2000p")
- execute("1,1000s/tw/BB/g")
+ feed_command("1,1000s/tw/BB/g")
feed(":%s/tw/X")
screen:expect([[
@@ -983,9 +983,9 @@ describe(":substitute, inccommand=split", function()
-- Assert that 'inccommand' is ENABLED initially.
eq("split", eval("&inccommand"))
-- Set 'redrawtime' to minimal value, to ensure timeout is triggered.
- execute("set redrawtime=1 nowrap")
+ feed_command("set redrawtime=1 nowrap")
-- Load a big file.
- execute("silent edit! test/functional/fixtures/bigfile.txt")
+ feed_command("silent edit! test/functional/fixtures/bigfile.txt")
-- Start :substitute with a slow pattern.
feed([[:%s/B.*N/x]])
wait()
@@ -1018,7 +1018,7 @@ describe(":substitute, inccommand=split", function()
it("clears preview if non-previewable command is edited #5585", function()
-- Put a non-previewable command in history.
- execute("echo 'foo'")
+ feed_command("echo 'foo'")
-- Start an incomplete :substitute command.
feed(":1,2s/t/X")
@@ -1079,7 +1079,7 @@ describe("inccommand=nosplit", function()
end)
it("works with :smagic, :snomagic", function()
- execute("set hlsearch")
+ feed_command("set hlsearch")
insert("Line *.3.* here")
feed(":%smagic/3.*/X") -- start :smagic command
@@ -1114,7 +1114,7 @@ describe("inccommand=nosplit", function()
end)
it('never shows preview buffer', function()
- execute("set hlsearch")
+ feed_command("set hlsearch")
feed(":%s/tw")
screen:expect([[
@@ -1175,7 +1175,7 @@ describe("inccommand=nosplit", function()
it("clears preview if non-previewable command is edited", function()
-- Put a non-previewable command in history.
- execute("echo 'foo'")
+ feed_command("echo 'foo'")
-- Start an incomplete :substitute command.
feed(":1,2s/t/X")
@@ -1224,7 +1224,7 @@ describe(":substitute, 'inccommand' with a failing expression", function()
it('in the pattern does nothing', function()
for _, case in pairs(cases) do
refresh(case)
- execute("set inccommand=" .. case)
+ feed_command("set inccommand=" .. case)
feed(":silent! %s/tw\\(/LARD/<enter>")
expect(default_text)
end
@@ -1236,10 +1236,10 @@ describe(":substitute, 'inccommand' with a failing expression", function()
local replacements = { "\\='LARD", "\\=xx_novar__xx" }
for _, repl in pairs(replacements) do
- execute("set inccommand=" .. case)
+ feed_command("set inccommand=" .. case)
feed(":silent! %s/tw/" .. repl .. "/<enter>")
expect(default_text:gsub("tw", ""))
- execute("undo")
+ feed_command("undo")
end
end
end)
@@ -1291,14 +1291,14 @@ describe("'inccommand' and :cnoremap", function()
it('work with remapped characters', function()
for _, case in pairs(cases) do
refresh(case)
- local command = "%s/lines/LINES/g"
+ local cmd = "%s/lines/LINES/g"
- for i = 1, string.len(command) do
- local c = string.sub(command, i, i)
- execute("cnoremap ".. c .. " " .. c)
+ for i = 1, string.len(cmd) do
+ local c = string.sub(cmd, i, i)
+ feed_command("cnoremap ".. c .. " " .. c)
end
- execute(command)
+ feed_command(cmd)
expect([[
Inc substitution on
two LINES
@@ -1309,7 +1309,7 @@ describe("'inccommand' and :cnoremap", function()
it('work when mappings move the cursor', function()
for _, case in pairs(cases) do
refresh(case)
- execute("cnoremap ,S LINES/<left><left><left><left><left><left>")
+ feed_command("cnoremap ,S LINES/<left><left><left><left><left><left>")
feed(":%s/lines/,Sor three <enter>")
expect([[
@@ -1317,21 +1317,21 @@ describe("'inccommand' and :cnoremap", function()
two or three LINES
]])
- execute("cnoremap ;S /X/<left><left><left>")
+ feed_command("cnoremap ;S /X/<left><left><left>")
feed(":%s/;SI<enter>")
expect([[
Xnc substitution on
two or three LXNES
]])
- execute("cnoremap ,T //Y/<left><left><left>")
+ feed_command("cnoremap ,T //Y/<left><left><left>")
feed(":%s,TX<enter>")
expect([[
Ync substitution on
two or three LYNES
]])
- execute("cnoremap ;T s//Z/<left><left><left>")
+ feed_command("cnoremap ;T s//Z/<left><left><left>")
feed(":%;TY<enter>")
expect([[
Znc substitution on
@@ -1343,7 +1343,7 @@ describe("'inccommand' and :cnoremap", function()
it('does not work with a failing mapping', function()
for _, case in pairs(cases) do
refresh(case)
- execute("cnoremap <expr> x execute('bwipeout!')[-1].'x'")
+ feed_command("cnoremap <expr> x execute('bwipeout!')[-1].'x'")
feed(":%s/tw/tox<enter>")
@@ -1356,7 +1356,7 @@ describe("'inccommand' and :cnoremap", function()
it('work when temporarily moving the cursor', function()
for _, case in pairs(cases) do
refresh(case)
- execute("cnoremap <expr> x cursor(1, 1)[-1].'x'")
+ feed_command("cnoremap <expr> x cursor(1, 1)[-1].'x'")
feed(":%s/tw/tox/g<enter>")
expect(default_text:gsub("tw", "tox"))
@@ -1366,7 +1366,7 @@ describe("'inccommand' and :cnoremap", function()
it("work when a mapping disables 'inccommand'", function()
for _, case in pairs(cases) do
refresh(case)
- execute("cnoremap <expr> x execute('set inccommand=')[-1]")
+ feed_command("cnoremap <expr> x execute('set inccommand=')[-1]")
feed(":%s/tw/toxa/g<enter>")
expect(default_text:gsub("tw", "toa"))
@@ -1440,7 +1440,7 @@ describe("'inccommand' autocommands", function()
local function register_autocmd(event)
meths.set_var(event .. "_fired", {})
- execute("autocmd " .. event .. " * call add(g:" .. event .. "_fired, expand('<abuf>'))")
+ feed_command("autocmd " .. event .. " * call add(g:" .. event .. "_fired, expand('<abuf>'))")
end
it('are not fired when splitting', function()
@@ -1493,8 +1493,8 @@ describe("'inccommand' split windows", function()
refresh()
feed("gg")
- execute("vsplit")
- execute("split")
+ feed_command("vsplit")
+ feed_command("split")
feed(":%s/tw")
screen:expect([[
Inc substitution on {10:|}Inc substitution on|
@@ -1530,9 +1530,9 @@ describe("'inccommand' split windows", function()
]])
feed("<esc>")
- execute("only")
- execute("split")
- execute("vsplit")
+ feed_command("only")
+ feed_command("split")
+ feed_command("vsplit")
feed(":%s/tw")
screen:expect([[
@@ -1581,7 +1581,7 @@ describe("'inccommand' split windows", function()
it("are not affected by various settings", function()
for _, setting in pairs(settings) do
refresh()
- execute("set " .. setting)
+ feed_command("set " .. setting)
feed(":%s/tw")
diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua
index cec19250d2..29d974b709 100644
--- a/test/functional/ui/input_spec.lua
+++ b/test/functional/ui/input_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
+local clear, feed_command, nvim = helpers.clear, helpers.feed_command, helpers.nvim
local feed, next_message, eq = helpers.feed, helpers.next_message, helpers.eq
local expect = helpers.expect
local Screen = require('test.functional.ui.screen')
@@ -12,7 +12,7 @@ describe('mappings', function()
local add_mapping = function(mapping, send)
local cmd = "nnoremap "..mapping.." :call rpcnotify("..cid..", 'mapped', '"
..send:gsub('<', '<lt>').."')<cr>"
- execute(cmd)
+ feed_command(cmd)
end
local check_mapping = function(mapping, expected)
@@ -57,7 +57,7 @@ describe('feeding large chunks of input with <Paste>', function()
clear()
screen = Screen.new()
screen:attach()
- execute('set ruler')
+ feed_command('set ruler')
end)
it('ok', function()
diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua
new file mode 100644
index 0000000000..f0cedfeeb5
--- /dev/null
+++ b/test/functional/ui/mode_spec.lua
@@ -0,0 +1,227 @@
+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 command, eval = helpers.command, helpers.eval
+local eq = helpers.eq
+
+describe('ui mode_change event', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(25, 4)
+ screen:attach({rgb= true})
+ screen:set_default_attr_ids( {
+ [0] = {bold=true, foreground=255},
+ [1] = {bold=true, reverse=true},
+ [2] = {bold=true},
+ [3] = {reverse=true},
+ })
+ end)
+
+ it('works in normal mode', function()
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("normal", screen.mode)
+ end)
+
+ feed('d')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("operator", screen.mode)
+ end)
+
+ feed('<esc>')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("normal", screen.mode)
+ end)
+ end)
+
+ it('works in insert mode', function()
+ feed('i')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]],nil,nil,function ()
+ eq("insert", screen.mode)
+ end)
+
+ feed('word<esc>')
+ screen:expect([[
+ wor^d |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]], nil, nil, function ()
+ eq("normal", screen.mode)
+ end)
+
+ command("set showmatch")
+ eq(eval('&matchtime'), 5) -- tenths of seconds
+ feed('a(stuff')
+ screen:expect([[
+ word(stuff^ |
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]], nil, nil, function ()
+ eq("insert", screen.mode)
+ end)
+
+ feed(')')
+ screen:expect([[
+ word^(stuff) |
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]], nil, nil, function ()
+ eq("showmatch", screen.mode)
+ end)
+
+ screen:sleep(400)
+ screen:expect([[
+ word(stuff)^ |
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]], nil, nil, function ()
+ eq("insert", screen.mode)
+ end)
+ end)
+
+ it('works in replace mode', function()
+ feed('R')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {2:-- REPLACE --} |
+ ]], nil, nil, function ()
+ eq("replace", screen.mode)
+ end)
+
+ feed('word<esc>')
+ screen:expect([[
+ wor^d |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]], nil, nil, function ()
+ eq("normal", screen.mode)
+ end)
+ end)
+
+ it('works in cmdline mode', function()
+ feed(':')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ :^ |
+ ]],nil,nil,function ()
+ eq("cmdline_normal", screen.mode)
+ end)
+
+ feed('x<left>')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ :^x |
+ ]],nil,nil,function ()
+ eq("cmdline_insert", screen.mode)
+ end)
+
+ feed('<insert>')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ :^x |
+ ]],nil,nil,function ()
+ eq("cmdline_replace", screen.mode)
+ end)
+
+
+ feed('<right>')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ :x^ |
+ ]],nil,nil,function ()
+ eq("cmdline_normal", screen.mode)
+ end)
+
+ feed('<esc>')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("normal", screen.mode)
+ end)
+ end)
+
+ it('works in visal mode', function()
+ insert("text")
+ feed('v')
+ screen:expect([[
+ tex^t |
+ {0:~ }|
+ {0:~ }|
+ {2:-- VISUAL --} |
+ ]],nil,nil,function ()
+ eq("visual", screen.mode)
+ end)
+
+ feed('<esc>')
+ screen:expect([[
+ tex^t |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("normal", screen.mode)
+ end)
+
+ command('set selection=exclusive')
+ feed('v')
+ screen:expect([[
+ tex^t |
+ {0:~ }|
+ {0:~ }|
+ {2:-- VISUAL --} |
+ ]],nil,nil,function ()
+ eq("visual_select", screen.mode)
+ end)
+
+ feed('<esc>')
+ screen:expect([[
+ tex^t |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]],nil,nil,function ()
+ eq("normal", screen.mode)
+ end)
+ end)
+end)
+
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index b2fbedfb5e..35af34015d 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -1,12 +1,12 @@
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
+local insert, feed_command = helpers.insert, helpers.feed_command
local eq, funcs = helpers.eq, helpers.funcs
if helpers.pending_win32(pending) then return end
-describe('Mouse input', function()
+describe('ui/mouse/input', function()
local screen
before_each(function()
@@ -123,9 +123,9 @@ describe('Mouse input', function()
end)
it('in tabline on filler space moves tab to the end', function()
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -160,9 +160,9 @@ describe('Mouse input', function()
return
end
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -190,9 +190,9 @@ describe('Mouse input', function()
end)
it('in tabline to the right moves tab right', function()
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -220,9 +220,9 @@ describe('Mouse input', function()
end)
it('out of tabline under filler space moves tab to the end', function()
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -265,9 +265,9 @@ describe('Mouse input', function()
return
end
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -303,9 +303,9 @@ describe('Mouse input', function()
end)
it('out of tabline to the right moves tab right', function()
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -352,9 +352,9 @@ describe('Mouse input', function()
end)
it('left click in default tabline (position 4) switches to tab', function()
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -375,9 +375,9 @@ describe('Mouse input', function()
it('left click in default tabline (position 24) closes tab', function()
meths.set_option('hidden', true)
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -398,9 +398,9 @@ describe('Mouse input', function()
it('double click in default tabline (position 4) opens new tab', function()
meths.set_option('hidden', true)
- execute('%delete')
+ feed_command('%delete')
insert('this is foo')
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
screen:expect([[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
@@ -421,13 +421,13 @@ describe('Mouse input', function()
describe('%@ label', function()
before_each(function()
- execute([[
+ feed_command([[
function Test(...)
let g:reply = a:000
return copy(a:000) " Check for memory leaks: return should be freed
endfunction
]])
- execute([[
+ feed_command([[
function Test2(...)
return call('Test', a:000 + [2])
endfunction
@@ -533,9 +533,9 @@ describe('Mouse input', function()
fill = { reverse=true },
vis = { background=Screen.colors.LightGrey }
})
- execute('silent file foo | tabnew | file bar')
+ feed_command('silent file foo | tabnew | file bar')
insert('this is bar')
- execute('tabprevious') -- go to first tab
+ feed_command('tabprevious') -- go to first tab
screen:expect([[
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
mouse |
@@ -641,7 +641,7 @@ describe('Mouse input', function()
mouse scrolling
]])
screen:try_resize(53, 14)
- execute('sp', 'vsp')
+ feed_command('sp', 'vsp')
screen:expect([[
lines {4:|}lines |
to {4:|}to |
@@ -754,12 +754,12 @@ describe('Mouse input', function()
})
feed('ggdG')
- execute('set concealcursor=n')
- execute('set nowrap')
- execute('syntax match NonText "\\<amet\\>" conceal')
- execute('syntax match NonText "\\cs\\|g." conceal cchar=X')
- execute('syntax match NonText "\\%(lo\\|cl\\)." conceal')
- execute('syntax match NonText "Lo" conceal cchar=Y')
+ feed_command('set concealcursor=n')
+ feed_command('set nowrap')
+ feed_command('syntax match NonText "\\<amet\\>" conceal')
+ feed_command('syntax match NonText "\\cs\\|g." conceal cchar=X')
+ feed_command('syntax match NonText "\\%(lo\\|cl\\)." conceal')
+ feed_command('syntax match NonText "Lo" conceal cchar=Y')
insert([[
Lorem ipsum dolor sit amet, consetetur sadipscing elitr.
@@ -770,7 +770,7 @@ describe('Mouse input', function()
end)
it('(level 1) click on non-wrapped lines', function()
- execute('let &conceallevel=1', 'echo')
+ feed_command('let &conceallevel=1', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
@@ -818,7 +818,7 @@ describe('Mouse input', function()
end) -- level 1 - non wrapped
it('(level 1) click on wrapped lines', function()
- execute('let &conceallevel=1', 'let &wrap=1', 'echo')
+ feed_command('let &conceallevel=1', 'let &wrap=1', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
@@ -867,7 +867,7 @@ describe('Mouse input', function()
it('(level 2) click on non-wrapped lines', function()
- execute('let &conceallevel=2', 'echo')
+ feed_command('let &conceallevel=2', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
@@ -915,7 +915,7 @@ describe('Mouse input', function()
end) -- level 2 - non wrapped
it('(level 2) click on wrapped lines', function()
- execute('let &conceallevel=2', 'let &wrap=1', 'echo')
+ feed_command('let &conceallevel=2', 'let &wrap=1', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
@@ -964,7 +964,7 @@ describe('Mouse input', function()
it('(level 3) click on non-wrapped lines', function()
- execute('let &conceallevel=3', 'echo')
+ feed_command('let &conceallevel=3', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
@@ -1012,7 +1012,7 @@ describe('Mouse input', function()
end) -- level 3 - non wrapped
it('(level 3) click on wrapped lines', function()
- execute('let &conceallevel=3', 'let &wrap=1', 'echo')
+ feed_command('let &conceallevel=3', 'let &wrap=1', 'echo')
feed('<esc><LeftMouse><0,0>')
screen:expect([[
diff --git a/test/functional/ui/quickfix_spec.lua b/test/functional/ui/quickfix_spec.lua
index 29b28fe9f0..b0d89ee3b6 100644
--- a/test/functional/ui/quickfix_spec.lua
+++ b/test/functional/ui/quickfix_spec.lua
@@ -1,7 +1,7 @@
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
+local insert, command = helpers.insert, helpers.command
describe('quickfix selection highlight', function()
@@ -28,8 +28,8 @@ describe('quickfix selection highlight', function()
})
meths.set_option('errorformat', '%m %l')
- execute('syntax on')
- execute('highlight Search guibg=Green')
+ command('syntax on')
+ command('highlight Search guibg=Green')
insert([[
Line 1
@@ -39,7 +39,7 @@ describe('quickfix selection highlight', function()
Line 5
]])
- execute('cad')
+ command('cad')
feed('gg')
screen:expect([[
@@ -52,12 +52,12 @@ describe('quickfix selection highlight', function()
{1:~ }|
{1:~ }|
{1:~ }|
- :cad |
+ |
]])
end)
it('using default Search highlight group', function()
- execute('copen')
+ command('copen')
screen:expect([[
Line 1 |
@@ -69,10 +69,10 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
- execute('cnext')
+ command('cnext')
screen:expect([[
Line 1 |
@@ -84,14 +84,14 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :cnext |
+ |
]])
end)
it('using QuickFixLine highlight group', function()
- execute('highlight QuickFixLine guibg=Red')
+ command('highlight QuickFixLine guibg=Red')
- execute('copen')
+ command('copen')
screen:expect([[
Line 1 |
@@ -103,10 +103,10 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
- execute('cnext')
+ command('cnext')
screen:expect([[
Line 1 |
@@ -118,16 +118,16 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :cnext |
+ |
]])
end)
it('combines with CursorLine', function()
- execute('set cursorline')
- execute('highlight QuickFixLine guifg=Red')
- execute('highlight CursorLine guibg=Fuchsia')
+ command('set cursorline')
+ command('highlight QuickFixLine guifg=Red')
+ command('highlight CursorLine guibg=Fuchsia')
- execute('copen')
+ command('copen')
screen:expect([[
{9:Line 1 }|
@@ -139,7 +139,7 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
feed('j')
@@ -154,16 +154,16 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
end)
it('QuickFixLine background takes precedence over CursorLine', function()
- execute('set cursorline')
- execute('highlight QuickFixLine guibg=Red')
- execute('highlight CursorLine guibg=Fuchsia')
+ command('set cursorline')
+ command('highlight QuickFixLine guibg=Red')
+ command('highlight CursorLine guibg=Fuchsia')
- execute('copen')
+ command('copen')
screen:expect([[
{9:Line 1 }|
@@ -175,7 +175,7 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
feed('j')
@@ -190,7 +190,7 @@ describe('quickfix selection highlight', function()
|{3:5}| Line |
|| |
{4:[Quickfix List] }|
- :copen |
+ |
]])
end)
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 54f43387dc..7d9cd6c026 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -181,6 +181,7 @@ end
-- expected: Expected screen state (string). Each line represents a screen
-- row. Last character of each row (typically "|") is stripped.
-- Common indentation is stripped.
+-- Used as `condition` if NOT a string; must be the ONLY arg then.
-- attr_ids: Expected text attributes. Screen rows are transformed according
-- to this table, as follows: each substring S composed of
-- characters having the same attributes will be substituted by
@@ -191,18 +192,23 @@ end
-- any: true: Succeed if `expected` matches ANY screen line(s).
-- false (default): `expected` must match screen exactly.
function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
- -- remove the last line and dedent
- expected = dedent(expected:gsub('\n[ ]+$', ''))
local expected_rows = {}
- for row in expected:gmatch('[^\n]+') do
- -- the last character should be the screen delimiter
- row = row:sub(1, #row - 1)
- table.insert(expected_rows, row)
- end
- if not any then
- assert(self._height == #expected_rows,
- "Expected screen state's row count(" .. #expected_rows
- .. ') differs from configured height(' .. self._height .. ') of Screen.')
+ if type(expected) ~= "string" then
+ assert(not (attr_ids or attr_ignore or condition or any))
+ condition = expected
+ expected = nil
+ else
+ -- Remove the last line and dedent.
+ expected = dedent(expected:gsub('\n[ ]+$', ''))
+ for row in expected:gmatch('[^\n]+') do
+ row = row:sub(1, #row - 1) -- Last char must be the screen delimiter.
+ table.insert(expected_rows, row)
+ end
+ if not any then
+ assert(self._height == #expected_rows,
+ "Expected screen state's row count(" .. #expected_rows
+ .. ') differs from configured height(' .. self._height .. ') of Screen.')
+ end
end
local ids = attr_ids or self._default_attr_ids
local ignore = attr_ignore or self._default_attr_ignore
@@ -218,7 +224,9 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
actual_rows[i] = self:_row_repr(self._rows[i], ids, ignore)
end
- if any then
+ if expected == nil then
+ return
+ elseif any then
-- Search for `expected` anywhere in the screen lines.
local actual_screen_str = table.concat(actual_rows, '\n')
if nil == string.find(actual_screen_str, expected) then
@@ -276,18 +284,13 @@ function Screen:wait(check, timeout)
if failure_after_success then
print([[
-Warning: Screen changes have been received after the expected state was seen.
-This is probably due to an indeterminism in the test. Try adding
-`wait()` (or even a separate `screen:expect(...)`) at a point of possible
-indeterminism, typically in between a `feed()` or `execute()` which is non-
-synchronous, and a synchronous api call.
-
-Note that sometimes a `wait` can trigger redraws and consequently generate more
-indeterminism. If adding `wait` calls seems to increase the frequency of these
-messages, try removing every `wait` call in the test.
-
-If everything else fails, use Screen:redraw_debug to help investigate what is
- causing the problem.
+
+Warning: Screen changes were received after the expected state. This indicates
+indeterminism in the test. Try adding wait() (or screen:expect(...)) between
+asynchronous (feed(), nvim_input()) and synchronous API calls.
+ - Use Screen:redraw_debug() to investigate the problem.
+ - wait() can trigger redraws and consequently generate more indeterminism.
+ In that case try removing every wait().
]])
local tb = debug.traceback()
local index = string.find(tb, '\n%s*%[C]')
@@ -309,10 +312,13 @@ function Screen:_redraw(updates)
-- print(require('inspect')(update))
local method = update[1]
for i = 2, #update do
- local handler = self['_handle_'..method]
+ local handler_name = '_handle_'..method
+ local handler = self[handler_name]
if handler ~= nil then
handler(self, unpack(update[i]))
else
+ assert(self._on_event,
+ "Add Screen:"..handler_name.." or call Screen:set_on_event_handler")
self._on_event(method, update[i])
end
end
@@ -343,6 +349,11 @@ function Screen:_handle_resize(width, height)
}
end
+function Screen:_handle_mode_info_set(cursor_style_enabled, mode_info)
+ self._cursor_style_enabled = cursor_style_enabled
+ self._mode_info = mode_info
+end
+
function Screen:_handle_clear()
self:_clear_block(self._scroll_region.top, self._scroll_region.bot,
self._scroll_region.left, self._scroll_region.right)
@@ -374,9 +385,8 @@ function Screen:_handle_mouse_off()
self._mouse_enabled = false
end
-function Screen:_handle_mode_change(mode)
- assert(mode == 'insert' or mode == 'replace'
- or mode == 'normal' or mode == 'cmdline')
+function Screen:_handle_mode_change(mode, idx)
+ assert(mode == self._mode_info[idx+1].name)
self.mode = mode
end
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index e511234e5e..d9cb3d7b6f 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -1,7 +1,7 @@
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
+local feed, command = helpers.feed, helpers.command
local insert = helpers.insert
local eq = helpers.eq
local eval = helpers.eval
@@ -73,33 +73,29 @@ describe('Screen', function()
describe(':suspend', function()
it('is forwarded to the UI', function()
local function check()
- if not screen.suspended then
- return 'Screen was not suspended'
- end
+ eq(true, screen.suspended)
end
- execute('suspend')
- screen:wait(check)
+ command('suspend')
+ screen:expect(check)
screen.suspended = false
feed('<c-z>')
- screen:wait(check)
+ screen:expect(check)
end)
end)
describe('bell/visual bell', function()
it('is forwarded to the UI', function()
feed('<left>')
- screen:wait(function()
- if not screen.bell or screen.visual_bell then
- return 'Bell was not sent'
- end
+ screen:expect(function()
+ eq(true, screen.bell)
+ eq(false, screen.visual_bell)
end)
screen.bell = false
- execute('set visualbell')
+ command('set visualbell')
feed('<left>')
- screen:wait(function()
- if not screen.visual_bell or screen.bell then
- return 'Visual bell was not sent'
- end
+ screen:expect(function()
+ eq(true, screen.visual_bell)
+ eq(false, screen.bell)
end)
end)
end)
@@ -107,36 +103,27 @@ describe('Screen', function()
describe(':set title', function()
it('is forwarded to the UI', function()
local expected = 'test-title'
- execute('set titlestring='..expected)
- execute('set title')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ command('set titlestring='..expected)
+ command('set title')
+ screen:expect(function()
+ eq(expected, screen.title)
end)
end)
it('has correct default title with unnamed file', function()
local expected = '[No Name] - NVIM'
- execute('set title')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ command('set title')
+ screen:expect(function()
+ eq(expected, screen.title)
end)
end)
it('has correct default title with named file', function()
local expected = 'myfile (/mydir) - NVIM'
- execute('set title')
- execute('file /mydir/myfile')
- screen:wait(function()
- local actual = screen.title
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ command('set title')
+ command('file /mydir/myfile')
+ screen:expect(function()
+ eq(expected, screen.title)
end)
end)
end)
@@ -144,13 +131,10 @@ describe('Screen', function()
describe(':set icon', function()
it('is forwarded to the UI', function()
local expected = 'test-icon'
- execute('set iconstring='..expected)
- execute('set icon')
- screen:wait(function()
- local actual = screen.icon
- if actual ~= expected then
- return 'Expected title to be "'..expected..'" but was "'..actual..'"'
- end
+ command('set iconstring='..expected)
+ command('set icon')
+ screen:expect(function()
+ eq(expected, screen.icon)
end)
end)
end)
@@ -158,7 +142,7 @@ describe('Screen', function()
describe('window', function()
describe('split', function()
it('horizontal', function()
- execute('sp')
+ command('sp')
screen:expect([[
^ |
{0:~ }|
@@ -173,13 +157,13 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{3:[No Name] }|
- :sp |
+ |
]])
end)
it('horizontal and resize', function()
- execute('sp')
- execute('resize 8')
+ command('sp')
+ command('resize 8')
screen:expect([[
^ |
{0:~ }|
@@ -194,12 +178,14 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{3:[No Name] }|
- :resize 8 |
+ |
]])
end)
it('horizontal and vertical', function()
- execute('sp', 'vsp', 'vsp')
+ command('sp')
+ command('vsp')
+ command('vsp')
screen:expect([[
^ {3:|} {3:|} |
{0:~ }{3:|}{0:~ }{3:|}{0:~ }|
@@ -239,7 +225,9 @@ describe('Screen', function()
describe('tabnew', function()
it('creates a new buffer', function()
- execute('sp', 'vsp', 'vsp')
+ command('sp')
+ command('vsp')
+ command('vsp')
insert('hello')
screen:expect([[
hell^o {3:|}hello {3:|}hello |
@@ -257,7 +245,7 @@ describe('Screen', function()
{3:[No Name] [+] }|
|
]])
- execute('tabnew')
+ command('tabnew')
insert('hello2')
feed('h')
screen:expect([[
@@ -276,7 +264,7 @@ describe('Screen', function()
{0:~ }|
|
]])
- execute('tabprevious')
+ command('tabprevious')
screen:expect([[
{2: }{6:4}{2:+ [No Name] }{4: + [No Name] }{3: }{4:X}|
hell^o {3:|}hello {3:|}hello |
@@ -321,9 +309,9 @@ describe('Screen', function()
describe('normal mode', function()
-- https://code.google.com/p/vim/issues/detail?id=339
it("setting 'ruler' doesn't reset the preferred column", function()
- execute('set virtualedit=')
+ command('set virtualedit=')
feed('i0123456<cr>789<esc>kllj')
- execute('set ruler')
+ command('set ruler')
feed('k')
screen:expect([[
0123^456 |
@@ -339,7 +327,7 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :set ruler 1,5 All |
+ 1,5 All |
]])
end)
end)
@@ -404,7 +392,9 @@ describe('Screen', function()
split
windows
]])
- execute('sp', 'vsp', 'vsp')
+ command('sp')
+ command('vsp')
+ command('vsp')
screen:expect([[
and {3:|}and {3:|}and |
clearing {3:|}clearing {3:|}clearing |
@@ -576,119 +566,6 @@ describe('Screen', function()
end)
end)
- describe('mode change', function()
- before_each(function()
- screen:try_resize(25, 5)
- end)
-
- it('works in normal mode', function()
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]],nil,nil,function ()
- eq("normal", screen.mode)
- end)
- end)
-
- it('works in insert mode', function()
- feed('i')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {2:-- INSERT --} |
- ]],nil,nil,function ()
- eq("insert", screen.mode)
- end)
-
- feed('word<esc>')
- screen:expect([[
- wor^d |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]], nil, nil, function ()
- eq("normal", screen.mode)
- end)
- end)
-
- it('works in replace mode', function()
- feed('R')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {2:-- REPLACE --} |
- ]], nil, nil, function ()
- eq("replace", screen.mode)
- end)
-
- feed('word<esc>')
- screen:expect([[
- wor^d |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]], nil, nil, function ()
- eq("normal", screen.mode)
- end)
- end)
-
- it('works in cmdline mode', function()
- feed(':')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- :^ |
- ]],nil,nil,function ()
- eq("cmdline", screen.mode)
- end)
-
- feed('<esc>/')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- /^ |
- ]],nil,nil,function ()
- eq("cmdline", screen.mode)
- end)
-
-
- feed('<esc>?')
- screen:expect([[
- |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- ?^ |
- ]],nil,nil,function ()
- eq("cmdline", screen.mode)
- end)
-
- feed('<esc>')
- screen:expect([[
- ^ |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- |
- ]],nil,nil,function ()
- eq("normal", screen.mode)
- end)
- end)
- end)
-
it('nvim_ui_attach() handles very large width/height #2180', function()
screen:detach()
screen = Screen.new(999, 999)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index 3914648e8f..11b18d015f 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -1,7 +1,7 @@
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
+local feed_command = helpers.feed_command
if helpers.pending_win32(pending) then return end
@@ -22,7 +22,7 @@ describe('search highlighting', function()
end)
it('is disabled by ":set nohlsearch"', function()
- execute('set nohlsearch')
+ feed_command('set nohlsearch')
insert("some text\nmore text")
feed("gg/text<cr>")
screen:expect([[
@@ -79,7 +79,7 @@ describe('search highlighting', function()
/\<text\> |
]])
- execute("nohlsearch")
+ feed_command("nohlsearch")
screen:expect([[
some text |
more textstuff |
@@ -92,8 +92,8 @@ describe('search highlighting', function()
end)
it('works with incsearch', function()
- execute('set hlsearch')
- execute('set incsearch')
+ feed_command('set hlsearch')
+ feed_command('set incsearch')
insert([[
the first line
in a little file
@@ -156,8 +156,8 @@ describe('search highlighting', function()
end)
it('works with incsearch and offset', function()
- execute('set hlsearch')
- execute('set incsearch')
+ feed_command('set hlsearch')
+ feed_command('set incsearch')
insert([[
not the match you're looking for
the match is here]])
@@ -198,7 +198,7 @@ describe('search highlighting', function()
end)
it('works with multiline regexps', function()
- execute('set hlsearch')
+ feed_command('set hlsearch')
feed('4oa repeated line<esc>')
feed('/line\\na<cr>')
screen:expect([[
@@ -234,19 +234,19 @@ describe('search highlighting', function()
[6] = {italic = true, background = colors.Magenta},
[7] = {bold = true, background = colors.Yellow},
} )
- execute('set hlsearch')
+ feed_command('set hlsearch')
insert([[
very special text
]])
- execute("syntax on")
- execute("highlight MyGroup guibg=Green gui=bold")
- execute("highlight MyGroup2 guibg=Magenta gui=italic")
- execute("call matchadd('MyGroup', 'special')")
- execute("call matchadd('MyGroup2', 'text', 0)")
+ feed_command("syntax on")
+ feed_command("highlight MyGroup guibg=Green gui=bold")
+ feed_command("highlight MyGroup2 guibg=Magenta gui=italic")
+ feed_command("call matchadd('MyGroup', 'special')")
+ feed_command("call matchadd('MyGroup2', 'text', 0)")
-- searchhl and matchadd matches are exclusive, only the higest priority
-- is used (and matches with lower priorities are not combined)
- execute("/ial te")
+ feed_command("/ial te")
screen:expect([[
very {5:spec^ial}{2: te}{6:xt} |
|
@@ -257,7 +257,7 @@ describe('search highlighting', function()
{4:search hit BOTTOM, continuing at TOP} |
]])
- execute("call clearmatches()")
+ feed_command("call clearmatches()")
screen:expect([[
very spec{2:^ial te}xt |
|
@@ -270,7 +270,7 @@ describe('search highlighting', function()
-- searchhl has priority over syntax, but in this case
-- nonconflicting attributes are combined
- execute("syntax keyword MyGroup special")
+ feed_command("syntax keyword MyGroup special")
screen:expect([[
very {5:spec}{7:^ial}{2: te}xt |
|
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index d02fc83809..e5c96f2ec0 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -1,6 +1,6 @@
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 clear, feed, command = helpers.clear, helpers.feed, helpers.command
if helpers.pending_win32(pending) then return end
@@ -25,11 +25,11 @@ describe('Signs', function()
describe(':sign place', function()
it('shadows previously placed signs', function()
feed('ia<cr>b<cr>c<cr><esc>')
- execute('sign define piet text=>> texthl=Search')
- execute('sign define pietx text=>! texthl=Search')
- execute('sign place 1 line=1 name=piet buffer=1')
- execute('sign place 2 line=3 name=piet buffer=1')
- execute('sign place 3 line=1 name=pietx buffer=1')
+ command('sign define piet text=>> texthl=Search')
+ command('sign define pietx text=>! texthl=Search')
+ command('sign place 1 line=1 name=piet buffer=1')
+ command('sign place 2 line=3 name=piet buffer=1')
+ command('sign place 3 line=1 name=pietx buffer=1')
screen:expect([[
{1:>!}a |
{2: }b |
@@ -44,7 +44,7 @@ describe('Signs', function()
{2: }{0:~ }|
{2: }{0:~ }|
{2: }{0:~ }|
- :sign place 3 line=1 name=pietx buffer=1 |
+ |
]])
end)
end)
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua
index ee3e4fa32a..28a104360d 100644
--- a/test/functional/ui/syntax_conceal_spec.lua
+++ b/test/functional/ui/syntax_conceal_spec.lua
@@ -1,6 +1,6 @@
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 clear, feed, command = helpers.clear, helpers.feed, helpers.command
local insert = helpers.insert
if helpers.pending_win32(pending) then return end
@@ -25,7 +25,7 @@ describe('Screen', function()
describe("match and conceal", function()
before_each(function()
- execute("let &conceallevel=1")
+ command("let &conceallevel=1")
end)
describe("multiple", function()
@@ -38,7 +38,7 @@ describe('Screen', function()
&&
&&
]])
- execute("syn match dAmpersand '[&][&]' conceal cchar=∧")
+ command("syn match dAmpersand '[&][&]' conceal cchar=∧")
end)
it("double characters.", function()
@@ -52,7 +52,7 @@ describe('Screen', function()
^ |
{0:~ }|
{0:~ }|
- :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ |
]])
end)
@@ -68,7 +68,7 @@ describe('Screen', function()
|
{0:~ }|
{0:~ }|
- :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ |
]])
end)
@@ -84,7 +84,7 @@ describe('Screen', function()
|
{0:~ }|
{0:~ }|
- :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ |
]])
end)
@@ -100,7 +100,7 @@ describe('Screen', function()
|
{0:~ }|
{0:~ }|
- :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ |
]])
end)
@@ -116,15 +116,15 @@ describe('Screen', function()
^ |
{0:~ }|
{0:~ }|
- :syn match dAmpersand '[&][&]' conceal cchar=∧ |
+ |
]])
end)
end) -- multiple
it("keyword instances in initially in the document.", function()
feed("2ilambda<cr><ESC>")
- execute("let &conceallevel=1")
- execute("syn keyword kLambda lambda conceal cchar=λ")
+ command("let &conceallevel=1")
+ command("syn keyword kLambda lambda conceal cchar=λ")
screen:expect([[
{1:λ} |
{1:λ} |
@@ -135,7 +135,7 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :syn keyword kLambda lambda conceal cchar=λ |
+ |
]])
end) -- Keyword
@@ -144,11 +144,11 @@ describe('Screen', function()
before_each(function()
feed("2")
insert("<r> a region of text </r>\n")
- execute("let &conceallevel=1")
+ command("let &conceallevel=1")
end)
it('initially and conceal it.', function()
- execute("syn region rText start='<r>' end='</r>' conceal cchar=R")
+ command("syn region rText start='<r>' end='</r>' conceal cchar=R")
screen:expect([[
{1:R} |
{1:R} |
@@ -166,7 +166,7 @@ describe('Screen', function()
it('initially and conceal its start tag and end tag.', function()
-- concealends has a known bug (todo.txt) where the first match won't
-- be replaced with cchar.
- execute("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
+ command("syn region rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
screen:expect([[
{1: } a region of text {1:-} |
{1: } a region of text {1:-} |
@@ -182,7 +182,7 @@ describe('Screen', function()
end)
it('that are nested and conceal the nested region\'s start and end tags.', function()
- execute("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
+ command("syn region rText contains=rText matchgroup=rMatch start='<r>' end='</r>' concealends cchar=-")
insert("<r> A region with <r> a nested <r> nested region.</r> </r> </r>\n")
screen:expect([[
{1: } a region of text {1:-} |
@@ -201,10 +201,10 @@ describe('Screen', function()
describe("a region of text", function()
before_each(function()
- execute("syntax conceal on")
+ command("syntax conceal on")
feed("2")
insert("<r> a region of text </r>\n")
- execute("syn region rText start='<r>' end='</r>' cchar=-")
+ command("syn region rText start='<r>' end='</r>' cchar=-")
end)
it("and turn on implicit concealing", function()
@@ -218,15 +218,15 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :syn region rText start='<r>' end='</r>' cchar=- |
+ |
]])
end)
it("and then turn on, then off, and then back on implicit concealing.", function()
- execute("syntax conceal off")
+ command("syntax conceal off")
feed("2")
insert("<i> italian text </i>\n")
- execute("syn region iText start='<i>' end='</i>' cchar=*")
+ command("syn region iText start='<i>' end='</i>' cchar=*")
screen:expect([[
{1:-} |
{1:-} |
@@ -237,10 +237,10 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :syn region iText start='<i>' end='</i>' cchar=* |
+ |
]])
- execute("syntax conceal on")
- execute("syn region iText start='<i>' end='</i>' cchar=*")
+ command("syntax conceal on")
+ command("syn region iText start='<i>' end='</i>' cchar=*")
screen:expect([[
{1:-} |
{1:-} |
@@ -251,7 +251,7 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :syn region iText start='<i>' end='</i>' cchar=* |
+ |
]])
end)
end) -- a region of text (implicit concealing)
@@ -262,13 +262,13 @@ describe('Screen', function()
insert("// No Conceal\n")
insert('"Conceal without a cchar"\n')
insert("+ With cchar\n\n")
- execute("syn match noConceal '^//.*$'")
- execute("syn match concealNoCchar '\".\\{-}\"$' conceal")
- execute("syn match concealWCchar '^+.\\{-}$' conceal cchar=C")
+ command("syn match noConceal '^//.*$'")
+ command("syn match concealNoCchar '\".\\{-}\"$' conceal")
+ command("syn match concealWCchar '^+.\\{-}$' conceal cchar=C")
end)
it("0. No concealing.", function()
- execute("let &conceallevel=0")
+ command("let &conceallevel=0")
screen:expect([[
// No Conceal |
"Conceal without a cchar" |
@@ -279,12 +279,12 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :let &conceallevel=0 |
+ |
]])
end)
it("1. Conceal using cchar or reference listchars.", function()
- execute("let &conceallevel=1")
+ command("let &conceallevel=1")
screen:expect([[
// No Conceal |
{1: } |
@@ -295,12 +295,12 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :let &conceallevel=1 |
+ |
]])
end)
it("2. Hidden unless cchar is set.", function()
- execute("let &conceallevel=2")
+ command("let &conceallevel=2")
screen:expect([[
// No Conceal |
|
@@ -311,12 +311,12 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :let &conceallevel=2 |
+ |
]])
end)
it("3. Hide all concealed text.", function()
- execute("let &conceallevel=3")
+ command("let &conceallevel=3")
screen:expect([[
// No Conceal |
|
@@ -327,7 +327,7 @@ describe('Screen', function()
{0:~ }|
{0:~ }|
{0:~ }|
- :let &conceallevel=3 |
+ |
]])
end)
end) -- conceallevel
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 6a6dc99c3d..6639bf272d 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,6 +1,6 @@
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 clear, feed, command = helpers.clear, helpers.feed, helpers.command
local funcs = helpers.funcs
if helpers.pending_win32(pending) then return end
@@ -20,8 +20,8 @@ describe("'wildmode'", function()
describe("'wildmenu'", function()
it(':sign <tab> shows wildmenu completions', function()
- execute('set wildmode=full')
- execute('set wildmenu')
+ command('set wildmode=full')
+ command('set wildmenu')
feed(':sign <tab>')
screen:expect([[
|
@@ -50,10 +50,10 @@ describe('command line completion', function()
it('lists directories with empty PATH', function()
local tmp = funcs.tempname()
- execute('e '.. tmp)
- execute('cd %:h')
- execute("call mkdir('Xtest-functional-viml-compl-dir')")
- execute('let $PATH=""')
+ command('e '.. tmp)
+ command('cd %:h')
+ command("call mkdir('Xtest-functional-viml-compl-dir')")
+ command('let $PATH=""')
feed(':!<tab><bs>')
screen:expect([[
|
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 3c09d71eb7..b35e8d4f94 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -2,7 +2,7 @@ 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
-local execute, source, expect = helpers.execute, helpers.source, helpers.expect
+local feed_command, source, expect = helpers.feed_command, helpers.source, helpers.expect
local meths = helpers.meths
if helpers.pending_win32(pending) then return end
@@ -67,25 +67,25 @@ describe('completion', function()
it('is readonly', function()
screen:try_resize(80, 8)
feed('ifoo<ESC>o<C-x><C-n><ESC>')
- execute('let v:completed_item.word = "bar"')
+ feed_command('let v:completed_item.word = "bar"')
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
- execute('let v:errmsg = ""')
+ feed_command('let v:errmsg = ""')
- execute('let v:completed_item.abbr = "bar"')
+ feed_command('let v:completed_item.abbr = "bar"')
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
- execute('let v:errmsg = ""')
+ feed_command('let v:errmsg = ""')
- execute('let v:completed_item.menu = "bar"')
+ feed_command('let v:completed_item.menu = "bar"')
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
- execute('let v:errmsg = ""')
+ feed_command('let v:errmsg = ""')
- execute('let v:completed_item.info = "bar"')
+ feed_command('let v:completed_item.info = "bar"')
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
- execute('let v:errmsg = ""')
+ feed_command('let v:errmsg = ""')
- execute('let v:completed_item.kind = "bar"')
+ feed_command('let v:completed_item.kind = "bar"')
neq(nil, string.find(eval('v:errmsg'), '^E46: '))
- execute('let v:errmsg = ""')
+ feed_command('let v:errmsg = ""')
end)
it('returns expected dict in omni completion', function()
source([[
@@ -125,7 +125,7 @@ describe('completion', function()
end)
it('inserts the first candidate if default', function()
- execute('set completeopt+=menuone')
+ feed_command('set completeopt+=menuone')
feed('ifoo<ESC>o')
screen:expect([[
foo |
@@ -176,7 +176,7 @@ describe('completion', function()
eq('foo', eval('getline(3)'))
end)
it('selects the first candidate if noinsert', function()
- execute('set completeopt+=menuone,noinsert')
+ feed_command('set completeopt+=menuone,noinsert')
feed('ifoo<ESC>o<C-x><C-n>')
screen:expect([[
foo |
@@ -216,7 +216,7 @@ describe('completion', function()
eq('foo', eval('getline(3)'))
end)
it('does not insert the first candidate if noselect', function()
- execute('set completeopt+=menuone,noselect')
+ feed_command('set completeopt+=menuone,noselect')
feed('ifoo<ESC>o<C-x><C-n>')
screen:expect([[
foo |
@@ -256,7 +256,7 @@ describe('completion', function()
eq('bar', eval('getline(3)'))
end)
it('does not select/insert the first candidate if noselect and noinsert', function()
- execute('set completeopt+=menuone,noselect,noinsert')
+ feed_command('set completeopt+=menuone,noselect,noinsert')
feed('ifoo<ESC>o<C-x><C-n>')
screen:expect([[
foo |
@@ -305,14 +305,14 @@ describe('completion', function()
eq('', eval('getline(3)'))
end)
it('does not change modified state if noinsert', function()
- execute('set completeopt+=menuone,noinsert')
- execute('setlocal nomodified')
+ feed_command('set completeopt+=menuone,noinsert')
+ feed_command('setlocal nomodified')
feed('i<C-r>=TestComplete()<CR><ESC>')
eq(0, eval('&l:modified'))
end)
it('does not change modified state if noselect', function()
- execute('set completeopt+=menuone,noselect')
- execute('setlocal nomodified')
+ feed_command('set completeopt+=menuone,noselect')
+ feed_command('setlocal nomodified')
feed('i<C-r>=TestComplete()<CR><ESC>')
eq(0, eval('&l:modified'))
end)
@@ -326,8 +326,8 @@ describe('completion', function()
return ''
endfunction
]])
- execute('set completeopt+=noselect,noinsert')
- execute('inoremap <right> <c-r>=TestComplete()<cr>')
+ feed_command('set completeopt+=noselect,noinsert')
+ feed_command('inoremap <right> <c-r>=TestComplete()<cr>')
end)
local tests = {
@@ -541,7 +541,7 @@ describe('completion', function()
return ''
endfunction
]])
- execute("set completeopt=menuone,noselect")
+ feed_command("set completeopt=menuone,noselect")
end)
it("works", function()
@@ -707,7 +707,7 @@ describe('completion', function()
it('disables folding during completion', function ()
- execute("set foldmethod=indent")
+ feed_command("set foldmethod=indent")
feed('i<Tab>foo<CR><Tab>bar<Esc>gg')
screen:expect([[
^foo |
@@ -734,7 +734,7 @@ describe('completion', function()
end)
it('popupmenu is not interrupted by events', function ()
- execute("set complete=.")
+ feed_command("set complete=.")
feed('ifoobar fooegg<cr>f<c-p>')
screen:expect([[
@@ -850,6 +850,22 @@ describe('completion', function()
]])
end)
end)
+
+ it("'ignorecase' 'infercase' CTRL-X CTRL-N #6451", function()
+ feed_command('set ignorecase infercase')
+ feed_command('edit BACKERS.md')
+ feed('oX<C-X><C-N>')
+ screen:expect([[
+ # Bountysource Backers |
+ Xnull^ |
+ {2:Xnull }{6: } |
+ {1:Xoxomoon }{6: }ryone who backed our [Bountysource fundraise|
+ {1:Xu }{6: }ountysource.com/teams/neovim/fundraiser)! |
+ {1:Xpayn }{2: } |
+ {1:Xinity }{2: }d URL in BACKERS.md. |
+ {3:-- Keyword Local completion (^N^P) }{4:match 1 of 7} |
+ ]])
+ end)
end)
describe('External completion popupmenu', function()
diff --git a/test/functional/viml/lang_spec.lua b/test/functional/viml/lang_spec.lua
index a27e18f695..3ba9221aef 100644
--- a/test/functional/viml/lang_spec.lua
+++ b/test/functional/viml/lang_spec.lua
@@ -1,13 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq
-local execute, source = helpers.execute, helpers.source
+local exc_exec, source = helpers.exc_exec, helpers.source
describe('viml', function()
before_each(clear)
it('parses `<SID>` with turkish locale', function()
- execute('lang ctype tr_TR.UTF-8')
- if string.find(eval('v:errmsg'), '^E197: ') then
+ if exc_exec('lang ctype tr_TR.UTF-8') ~= 0 then
pending("Locale tr_TR.UTF-8 not supported")
return
end
diff --git a/test/helpers.lua b/test/helpers.lua
index 82451bc61d..d60d5ba242 100644
--- a/test/helpers.lua
+++ b/test/helpers.lua
@@ -17,18 +17,31 @@ local ok = function(res)
return assert.is_true(res)
end
+-- initial_path: directory to recurse into
+-- re: include pattern (string)
+-- exc_re: exclude pattern(s) (string or table)
local function glob(initial_path, re, exc_re)
+ exc_re = type(exc_re) == 'table' and exc_re or { exc_re }
local paths_to_check = {initial_path}
local ret = {}
local checked_files = {}
+ local function is_excluded(path)
+ for _, pat in pairs(exc_re) do
+ if path:match(pat) then return true end
+ end
+ return false
+ end
+
+ if is_excluded(initial_path) then
+ return ret
+ end
while #paths_to_check > 0 do
local cur_path = paths_to_check[#paths_to_check]
paths_to_check[#paths_to_check] = nil
for e in lfs.dir(cur_path) do
local full_path = cur_path .. '/' .. e
local checked_path = full_path:sub(#initial_path + 1)
- if ((not exc_re or not checked_path:match(exc_re))
- and e:sub(1, 1) ~= '.') then
+ if (not is_excluded(checked_path)) and e:sub(1, 1) ~= '.' then
local attrs = lfs.attributes(full_path)
if attrs then
local check_key = attrs.dev .. ':' .. tostring(attrs.ino)
@@ -106,13 +119,20 @@ local uname = (function()
end)
end)()
+local function tmpdir_get()
+ return os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
+end
+
+-- Is temp directory `dir` defined local to the project workspace?
+local function tmpdir_is_local(dir)
+ return not not (dir and string.find(dir, 'Xtest'))
+end
+
local tmpname = (function()
local seq = 0
- local tmpdir = os.getenv('TMPDIR') and os.getenv('TMPDIR') or os.getenv('TEMP')
- -- Is $TMPDIR defined local to the project workspace?
- local in_workspace = not not (tmpdir and string.find(tmpdir, 'Xtest'))
+ local tmpdir = tmpdir_get()
return (function()
- if in_workspace then
+ if tmpdir_is_local(tmpdir) then
-- Cannot control os.tmpname() dir, so hack our own tmpname() impl.
seq = seq + 1
local fname = tmpdir..'/nvim-test-lua-'..seq
@@ -162,33 +182,38 @@ end
local tests_skipped = 0
-local function check_cores(app)
+local function check_cores(app, force)
app = app or 'build/bin/nvim'
local initial_path, re, exc_re
local gdb_db_cmd = 'gdb -n -batch -ex "thread apply all bt full" "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"'
local lldb_db_cmd = 'lldb -Q -o "bt all" -f "$_NVIM_TEST_APP" -c "$_NVIM_TEST_CORE"'
local random_skip = false
+ -- Workspace-local $TMPDIR, scrubbed and pattern-escaped.
+ -- "./Xtest-tmpdir/" => "Xtest%-tmpdir"
+ local local_tmpdir = (tmpdir_is_local(tmpdir_get())
+ and tmpdir_get():gsub('^[ ./]+',''):gsub('%/+$',''):gsub('([^%w])', '%%%1')
+ or nil)
local db_cmd
if hasenv('NVIM_TEST_CORE_GLOB_DIRECTORY') then
initial_path = os.getenv('NVIM_TEST_CORE_GLOB_DIRECTORY')
re = os.getenv('NVIM_TEST_CORE_GLOB_RE')
- exc_re = os.getenv('NVIM_TEST_CORE_EXC_RE')
+ exc_re = { os.getenv('NVIM_TEST_CORE_EXC_RE'), local_tmpdir }
db_cmd = os.getenv('NVIM_TEST_CORE_DB_CMD') or gdb_db_cmd
random_skip = os.getenv('NVIM_TEST_CORE_RANDOM_SKIP')
elseif os.getenv('TRAVIS_OS_NAME') == 'osx' then
initial_path = '/cores'
re = nil
- exc_re = nil
+ exc_re = { local_tmpdir }
db_cmd = lldb_db_cmd
else
initial_path = '.'
re = '/core[^/]*$'
- exc_re = '^/%.deps$'
+ exc_re = { '^/%.deps$', local_tmpdir }
db_cmd = gdb_db_cmd
random_skip = true
end
-- Finding cores takes too much time on linux
- if random_skip and math.random() < 0.9 then
+ if not force and random_skip and math.random() < 0.9 then
tests_skipped = tests_skipped + 1
return
end
@@ -251,6 +276,28 @@ local function concat_tables(...)
return ret
end
+local function dedent(str)
+ -- find minimum common indent across lines
+ local indent = nil
+ for line in str:gmatch('[^\n]+') do
+ local line_indent = line:match('^%s+') or ''
+ if indent == nil or #line_indent < #indent then
+ indent = line_indent
+ end
+ end
+ if indent == nil or #indent == 0 then
+ -- no minimum common indent
+ return str
+ end
+ -- create a pattern for the indent
+ indent = indent:gsub('%s', '[ \t]')
+ -- strip it from the first line
+ str = str:gsub('^'..indent, '')
+ -- strip it from the remaining lines
+ str = str:gsub('[\n]'..indent, '\n')
+ return str
+end
+
return {
eq = eq,
neq = neq,
@@ -265,4 +312,5 @@ return {
hasenv = hasenv,
which = which,
concat_tables = concat_tables,
+ dedent = dedent,
}
diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua
index 0b2a423cd6..0c444b33f2 100644
--- a/test/unit/eval/decode_spec.lua
+++ b/test/unit/eval/decode_spec.lua
@@ -2,7 +2,6 @@ local helpers = require('test.unit.helpers')(after_each)
local itp = helpers.gen_itp(it)
local cimport = helpers.cimport
-local to_cstr = helpers.to_cstr
local eq = helpers.eq
local neq = helpers.neq
local ffi = helpers.ffi
@@ -72,7 +71,7 @@ describe('json_decode_string()', function()
end
itp('does not overflow in error messages', function()
- local saved_p_enc = decode.p_enc
+ collectgarbage('restart')
check_failure(']test', 1, 'E474: No container to close: ]')
check_failure('[}test', 2, 'E474: Closing list with curly bracket: }')
check_failure('{]test', 2,
@@ -105,10 +104,6 @@ describe('json_decode_string()', function()
check_failure('"\194"test', 3, 'E474: Only UTF-8 strings allowed: \194"')
check_failure('"\252\144\128\128\128\128"test', 8, 'E474: Only UTF-8 code points up to U+10FFFF are allowed to appear unescaped: \252\144\128\128\128\128"')
check_failure('"test', 1, 'E474: Expected string end: "')
- decode.p_enc = to_cstr('latin1')
- check_failure('"\\uABCD"test', 8,
- 'E474: Failed to convert string "ꯍ" from UTF-8')
- decode.p_enc = saved_p_enc
check_failure('-test', 1, 'E474: Missing number after minus sign: -')
check_failure('-1.test', 3, 'E474: Missing number after decimal dot: -1.')
check_failure('-1.0etest', 5, 'E474: Missing exponent: -1.0e')
diff --git a/test/unit/eval/helpers.lua b/test/unit/eval/helpers.lua
index fa76113756..5bc482216e 100644
--- a/test/unit/eval/helpers.lua
+++ b/test/unit/eval/helpers.lua
@@ -468,7 +468,7 @@ local function tbl2callback(tbl)
data={funcref=eval.xstrdup(tbl.fref)}}})
elseif tbl.type == 'pt' then
local pt = ffi.gc(ffi.cast('partial_T*',
- eval.xcalloc(1, ffi.sizeof('partial_T'))), eval.partial_unref)
+ eval.xcalloc(1, ffi.sizeof('partial_T'))), nil)
ret = ffi.new('Callback[1]', {{type=eval.kCallbackPartial,
data={partial=populate_partial(pt, tbl.pt, {})}}})
else
diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua
index 258b5c4c1f..6308ae7367 100644
--- a/test/unit/eval/typval_spec.lua
+++ b/test/unit/eval/typval_spec.lua
@@ -47,6 +47,15 @@ local lib = cimport('./src/nvim/eval/typval.h', './src/nvim/memory.h',
'./src/nvim/eval.h', './src/nvim/vim.h',
'./src/nvim/globals.h')
+local function vimconv_alloc()
+ return ffi.gc(
+ ffi.cast('vimconv_T*', lib.xcalloc(1, ffi.sizeof('vimconv_T'))),
+ function(vc)
+ lib.convert_setup(vc, nil, nil)
+ lib.xfree(vc)
+ end)
+end
+
local function list_watch_alloc(li)
return ffi.cast('listwatch_T*', ffi.new('listwatch_T[1]', {{lw_item=li}}))
end
@@ -237,24 +246,33 @@ describe('typval.c', function()
list_watch(l, lis[4]),
list_watch(l, lis[7]),
}
+ alloc_log:check({
+ a.list(l),
+ a.li(lis[1]),
+ a.li(lis[2]),
+ a.li(lis[3]),
+ a.li(lis[4]),
+ a.li(lis[5]),
+ a.li(lis[6]),
+ a.li(lis[7]),
+ })
lib.tv_list_item_remove(l, lis[4])
- ffi.gc(lis[4], lib.tv_list_item_free)
+ alloc_log:check({a.freed(lis[4])})
eq({lis[1], lis[5], lis[7]}, {lws[1].lw_item, lws[2].lw_item, lws[3].lw_item})
lib.tv_list_item_remove(l, lis[2])
- ffi.gc(lis[2], lib.tv_list_item_free)
+ alloc_log:check({a.freed(lis[2])})
eq({lis[1], lis[5], lis[7]}, {lws[1].lw_item, lws[2].lw_item, lws[3].lw_item})
lib.tv_list_item_remove(l, lis[7])
- ffi.gc(lis[7], lib.tv_list_item_free)
+ alloc_log:check({a.freed(lis[7])})
eq({lis[1], lis[5], nil}, {lws[1].lw_item, lws[2].lw_item, lws[3].lw_item == nil and nil})
lib.tv_list_item_remove(l, lis[1])
- ffi.gc(lis[1], lib.tv_list_item_free)
+ alloc_log:check({a.freed(lis[1])})
eq({lis[3], lis[5], nil}, {lws[1].lw_item, lws[2].lw_item, lws[3].lw_item == nil and nil})
- alloc_log:clear()
lib.tv_list_watch_remove(l, lws[2])
lib.tv_list_watch_remove(l, lws[3])
lib.tv_list_watch_remove(l, lws[1])
@@ -460,6 +478,10 @@ describe('typval.c', function()
eq(empty_list, typvalt2lua(l_tv))
eq({true, true, true}, {lws[1].lw_item == nil, lws[2].lw_item == nil, lws[3].lw_item == nil})
+ lib.tv_list_watch_remove(l, lws[1])
+ lib.tv_list_watch_remove(l, lws[2])
+ lib.tv_list_watch_remove(l, lws[3])
+
alloc_log:check({})
end)
end)
@@ -730,10 +752,8 @@ describe('typval.c', function()
collectgarbage()
end)
itp('copies list correctly and converts items', function()
- local vc = ffi.gc(ffi.new('vimconv_T[1]'), function(vc)
- lib.convert_setup(vc, nil, nil)
- end)
- -- UTF-8 ↔ latin1 conversions need no iconv
+ local vc = vimconv_alloc()
+ -- UTF-8 ↔ latin1 conversions needs no iconv
eq(OK, lib.convert_setup(vc, to_cstr('utf-8'), to_cstr('latin1')))
local v = {{['«']='»'}, {'„'}, 1, '“', null_string, null_list, null_dict}
@@ -1087,12 +1107,16 @@ describe('typval.c', function()
end)
end)
describe('join()', function()
- local function list_join(l, sep, ret)
+ local function list_join(l, sep, join_ret)
local ga = ga_alloc()
- eq(ret or OK, lib.tv_list_join(ga, l, sep))
- if ga.ga_data == nil then return ''
- else return ffi.string(ga.ga_data)
+ eq(join_ret or OK, lib.tv_list_join(ga, l, sep))
+ local ret = ''
+ if ga.ga_data ~= nil then
+ ret = ffi.string(ga.ga_data)
end
+ -- For some reason this is not working well in GC
+ lib.ga_clear(ffi.gc(ga, nil))
+ return ret
end
itp('works', function()
local l
@@ -1508,7 +1532,7 @@ describe('typval.c', function()
eq(s:sub(1, len), ffi.string(di.di_key))
alloc_log:check({a.di(di, len)})
if tv then
- di.di_tv = tv
+ di.di_tv = ffi.gc(tv, nil)
else
di.di_tv.v_type = lib.VAR_UNKNOWN
end
@@ -1539,7 +1563,7 @@ describe('typval.c', function()
alloc_log:check({a.dict(d)})
local di = ffi.gc(lib.tv_dict_item_alloc(''), nil)
local tv = lua2typvalt('test')
- di.di_tv = tv
+ di.di_tv = ffi.gc(tv, nil)
alloc_log:check({a.di(di, ''), a.str(tv.vval.v_string, 'test')})
eq(OK, lib.tv_dict_add(d, di))
alloc_log:check({})
@@ -2131,9 +2155,7 @@ describe('typval.c', function()
collectgarbage()
end)
itp('copies dict correctly and converts items', function()
- local vc = ffi.gc(ffi.new('vimconv_T[1]'), function(vc)
- lib.convert_setup(vc, nil, nil)
- end)
+ local vc = vimconv_alloc()
-- UTF-8 ↔ latin1 conversions need no iconv
eq(OK, lib.convert_setup(vc, to_cstr('utf-8'), to_cstr('latin1')))
@@ -2428,6 +2450,10 @@ describe('typval.c', function()
'E741: Value is locked: Unknown'))
eq(true, tv_check_lock(lib.VAR_FIXED, nil, 0,
'E742: Cannot change value of Unknown'))
+ eq(true, tv_check_lock(lib.VAR_LOCKED, nil, lib.kTVCstring,
+ 'E741: Value is locked: Unknown'))
+ eq(true, tv_check_lock(lib.VAR_FIXED, 'test', lib.kTVCstring,
+ 'E742: Cannot change value of test'))
end)
end)
describe('equal()', function()
@@ -2659,7 +2685,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 0},
{lib.VAR_UNKNOWN, nil, 'E685: Internal error: tv_get_number(UNKNOWN)', 0},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2687,7 +2714,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 0},
{lib.VAR_UNKNOWN, nil, 'E685: Internal error: tv_get_number(UNKNOWN)', 0},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = {v[4], not not emsg}
@@ -2721,7 +2749,8 @@ describe('typval.c', function()
{lib.VAR_UNKNOWN, nil, 'E685: Internal error: tv_get_number(UNKNOWN)', -1},
}) do
lib.curwin.w_cursor.lnum = 46
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2749,7 +2778,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, 'E907: Using a special value as a Float', 0},
{lib.VAR_UNKNOWN, nil, 'E685: Internal error: tv_get_float(UNKNOWN)', 0},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2780,7 +2810,9 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 'false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', ''},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr in place of Neovim allocated string, cannot
+ -- tv_clear() that.
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2821,7 +2853,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 'false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', nil},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2861,7 +2894,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 'false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', ''},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
@@ -2902,7 +2936,8 @@ describe('typval.c', function()
{lib.VAR_SPECIAL, {v_special=lib.kSpecialVarFalse}, nil, 'false'},
{lib.VAR_UNKNOWN, nil, 'E908: using an invalid value as a String', nil},
}) do
- local tv = typvalt(v[1], v[2])
+ -- Using to_cstr, cannot free with tv_clear
+ local tv = ffi.gc(typvalt(v[1], v[2]), nil)
alloc_log:check({})
local emsg = v[3]
local ret = v[4]
diff --git a/test/unit/fixtures/multiqueue.c b/test/unit/fixtures/multiqueue.c
index da63e55919..a8dca0a844 100644
--- a/test/unit/fixtures/multiqueue.c
+++ b/test/unit/fixtures/multiqueue.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <string.h>
#include <stdlib.h>
#include "nvim/event/multiqueue.h"
diff --git a/test/unit/fixtures/rbuffer.c b/test/unit/fixtures/rbuffer.c
index d587d6b054..3f4062fa18 100644
--- a/test/unit/fixtures/rbuffer.c
+++ b/test/unit/fixtures/rbuffer.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include "nvim/rbuffer.h"
#include "rbuffer.h"
diff --git a/test/unit/helpers.lua b/test/unit/helpers.lua
index 8aad3acd98..4b9f185156 100644
--- a/test/unit/helpers.lua
+++ b/test/unit/helpers.lua
@@ -11,6 +11,7 @@ local posix = nil
local syscall = nil
local check_cores = global_helpers.check_cores
+local dedent = global_helpers.dedent
local neq = global_helpers.neq
local map = global_helpers.map
local eq = global_helpers.eq
@@ -511,6 +512,212 @@ if os.getenv('NVIM_TEST_PRINT_SYSCALLS') == '1' then
end
end
+local function just_fail(_)
+ return false
+end
+say:set('assertion.just_fail.positive', '%s')
+say:set('assertion.just_fail.negative', '%s')
+assert:register('assertion', 'just_fail', just_fail,
+ 'assertion.just_fail.positive',
+ 'assertion.just_fail.negative')
+
+local hook_fnamelen = 30
+local hook_sfnamelen = 30
+local hook_numlen = 5
+local hook_msglen = 1 + 1 + 1 + (1 + hook_fnamelen) + (1 + hook_sfnamelen) + (1 + hook_numlen) + 1
+
+local tracehelp = dedent([[
+ ┌ Trace type: _r_eturn from function , function _c_all, _l_ine executed,
+ │ _t_ail return, _C_ount (should not actually appear),
+ │ _s_aved from previous run for reference.
+ │┏ Function type: _L_ua function, _C_ function, _m_ain part of chunk,
+ │┃ function that did _t_ail call.
+ │┃┌ Function name type: _g_lobal, _l_ocal, _m_ethod, _f_ield, _u_pvalue,
+ │┃│ space for unknown.
+ │┃│ ┏ Source file name ┌ Function name ┏ Line
+ │┃│ ┃ (trunc to 30 bytes, no .lua) │ (truncated to last 30 bytes) ┃ number
+ CWN SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:LLLLL\n
+]])
+
+local function child_sethook(wr)
+ local trace_level = os.getenv('NVIM_TEST_TRACE_LEVEL')
+ if not trace_level or trace_level == '' then
+ trace_level = 1
+ else
+ trace_level = tonumber(trace_level)
+ end
+ if trace_level <= 0 then
+ return
+ end
+ local trace_only_c = trace_level <= 1
+ local prev_info, prev_reason, prev_lnum
+ local function hook(reason, lnum, use_prev)
+ local info = nil
+ if use_prev then
+ info = prev_info
+ elseif reason ~= 'tail return' then -- tail return
+ info = debug.getinfo(2, 'nSl')
+ end
+
+ if trace_only_c and (not info or info.what ~= 'C') and not use_prev then
+ if info.source:sub(-9) == '_spec.lua' then
+ prev_info = info
+ prev_reason = 'saved'
+ prev_lnum = lnum
+ end
+ return
+ end
+ if trace_only_c and not use_prev and prev_reason then
+ hook(prev_reason, prev_lnum, true)
+ prev_reason = nil
+ end
+
+ local whatchar = ' '
+ local namewhatchar = ' '
+ local funcname = ''
+ local source = ''
+ local msgchar = reason:sub(1, 1)
+
+ if reason == 'count' then
+ msgchar = 'C'
+ end
+
+ if info then
+ funcname = (info.name or ''):sub(1, hook_fnamelen)
+ whatchar = info.what:sub(1, 1)
+ namewhatchar = info.namewhat:sub(1, 1)
+ if namewhatchar == '' then
+ namewhatchar = ' '
+ end
+ source = info.source
+ if source:sub(1, 1) == '@' then
+ if source:sub(-4, -1) == '.lua' then
+ source = source:sub(1, -5)
+ end
+ source = source:sub(-hook_sfnamelen, -1)
+ end
+ lnum = lnum or info.currentline
+ end
+
+ -- assert(-1 <= lnum and lnum <= 99999)
+ local lnum_s
+ if lnum == -1 then
+ lnum_s = 'nknwn'
+ else
+ lnum_s = ('%u'):format(lnum)
+ end
+ local msg = ( -- lua does not support %*
+ ''
+ .. msgchar
+ .. whatchar
+ .. namewhatchar
+ .. ' '
+ .. source .. (' '):rep(hook_sfnamelen - #source)
+ .. ':'
+ .. funcname .. (' '):rep(hook_fnamelen - #funcname)
+ .. ':'
+ .. ('0'):rep(hook_numlen - #lnum_s) .. lnum_s
+ .. '\n'
+ )
+ -- eq(hook_msglen, #msg)
+ sc.write(wr, msg)
+ end
+ debug.sethook(hook, 'crl')
+end
+
+local trace_end_msg = ('E%s\n'):format((' '):rep(hook_msglen - 2))
+
+local function itp_child(wr, func)
+ init()
+ collectgarbage('stop')
+ child_sethook(wr)
+ local err, emsg = pcall(func)
+ collectgarbage('restart')
+ collectgarbage()
+ debug.sethook()
+ emsg = tostring(emsg)
+ sc.write(wr, trace_end_msg)
+ if not err then
+ if #emsg > 99999 then
+ emsg = emsg:sub(1, 99999)
+ end
+ sc.write(wr, ('-\n%05u\n%s'):format(#emsg, emsg))
+ deinit()
+ sc.close(wr)
+ sc.exit(1)
+ else
+ sc.write(wr, '+\n')
+ deinit()
+ sc.close(wr)
+ sc.exit(0)
+ end
+end
+
+local function check_child_err(rd)
+ local trace = {}
+ local did_traceline = false
+ while true do
+ local traceline = sc.read(rd, hook_msglen)
+ if #traceline ~= hook_msglen then
+ if #traceline == 0 then
+ break
+ else
+ trace[#trace + 1] = 'Partial read: <' .. trace .. '>\n'
+ end
+ end
+ if traceline == trace_end_msg then
+ did_traceline = true
+ break
+ end
+ trace[#trace + 1] = traceline
+ end
+ local res = sc.read(rd, 2)
+ if #res ~= 2 then
+ local error
+ if #trace == 0 then
+ error = '\nTest crashed, no trace available\n'
+ else
+ error = '\nTest crashed, trace:\n' .. tracehelp
+ for i = 1, #trace do
+ error = error .. trace[i]
+ end
+ end
+ if not did_traceline then
+ error = error .. '\nNo end of trace occurred'
+ end
+ local cc_err, cc_emsg = pcall(check_cores, Paths.test_luajit_prg, true)
+ if not cc_err then
+ error = error .. '\ncheck_cores failed: ' .. cc_emsg
+ end
+ assert.just_fail(error)
+ end
+ if res == '+\n' then
+ return
+ end
+ eq('-\n', res)
+ local len_s = sc.read(rd, 5)
+ local len = tonumber(len_s)
+ neq(0, len)
+ local err = sc.read(rd, len + 1)
+ assert.just_fail(err)
+end
+
+local function itp_parent(rd, pid, allow_failure)
+ local err, emsg = pcall(check_child_err, rd)
+ sc.wait(pid)
+ sc.close(rd)
+ if not err then
+ if allow_failure then
+ io.stderr:write('Errorred out:\n' .. tostring(emsg) .. '\n')
+ os.execute([[
+ sh -c "source ci/common/test.sh
+ check_core_dumps --delete \"]] .. Paths.test_luajit_prg .. [[\""]])
+ else
+ error(emsg)
+ end
+ end
+end
+
local function gen_itp(it)
child_calls_mod = {}
child_calls_mod_once = {}
@@ -518,14 +725,6 @@ local function gen_itp(it)
preprocess_cache_mod = map(function(v) return v end, preprocess_cache_init)
previous_defines_mod = previous_defines_init
cdefs_mod = cdefs_init:copy()
- local function just_fail(_)
- return false
- end
- say:set('assertion.just_fail.positive', '%s')
- say:set('assertion.just_fail.negative', '%s')
- assert:register('assertion', 'just_fail', just_fail,
- 'assertion.just_fail.positive',
- 'assertion.just_fail.negative')
local function itp(name, func, allow_failure)
if allow_failure and os.getenv('NVIM_TEST_RUN_FAILING_TESTS') ~= '1' then
-- FIXME Fix tests with this true
@@ -535,50 +734,13 @@ local function gen_itp(it)
local rd, wr = sc.pipe()
child_pid = sc.fork()
if child_pid == 0 then
- init()
sc.close(rd)
- collectgarbage('stop')
- local err, emsg = pcall(func)
- collectgarbage('restart')
- emsg = tostring(emsg)
- if not err then
- sc.write(wr, ('-\n%05u\n%s'):format(#emsg, emsg))
- deinit()
- sc.close(wr)
- sc.exit(1)
- else
- sc.write(wr, '+\n')
- deinit()
- sc.close(wr)
- sc.exit(0)
- end
+ itp_child(wr, func)
else
sc.close(wr)
- sc.wait(child_pid)
+ local saved_child_pid = child_pid
child_pid = nil
- local function check()
- local res = sc.read(rd, 2)
- eq(2, #res)
- if res == '+\n' then
- return
- end
- eq('-\n', res)
- local len_s = sc.read(rd, 5)
- local len = tonumber(len_s)
- neq(0, len)
- local err = sc.read(rd, len + 1)
- assert.just_fail(err)
- end
- local err, emsg = pcall(check)
- sc.close(rd)
- if not err then
- if allow_failure then
- io.stderr:write('Errorred out:\n' .. tostring(emsg) .. '\n')
- os.execute([[sh -c "source .ci/common/test.sh ; check_core_dumps --delete \"]] .. Paths.test_luajit_prg .. [[\""]])
- else
- error(emsg)
- end
- end
+ itp_parent(rd, saved_child_pid, allow_failure)
end
end)
end
@@ -610,12 +772,8 @@ local module = {
only_separate = only_separate,
child_call_once = child_call_once,
child_cleanup_once = child_cleanup_once,
+ sc = sc,
}
-return function(after_each)
- if after_each then
- after_each(function()
- check_cores(Paths.test_luajit_prg)
- end)
- end
+return function()
return module
end
diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua
index 823b6d6a85..575787a25e 100644
--- a/test/unit/os/env_spec.lua
+++ b/test/unit/os/env_spec.lua
@@ -67,12 +67,37 @@ describe('env function', function()
end)
end)
+ describe('os_shell_is_cmdexe', function()
+ itp('returns true for expected names', function()
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('cmd.exe')))
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('cmd')))
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('CMD.EXE')))
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('CMD')))
+
+ os_setenv('COMSPEC', '/foo/bar/cmd.exe', 0)
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('$COMSPEC')))
+ os_setenv('COMSPEC', [[C:\system32\cmd.exe]], 0)
+ eq(true, cimp.os_shell_is_cmdexe(to_cstr('$COMSPEC')))
+ end)
+ itp('returns false for unexpected names', function()
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('')))
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('powershell')))
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr(' cmd.exe ')))
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('cm')))
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('md')))
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('cmd.ex')))
+
+ os_setenv('COMSPEC', '/foo/bar/cmd', 0)
+ eq(false, cimp.os_shell_is_cmdexe(to_cstr('$COMSPEC')))
+ end)
+ end)
+
describe('os_getenv', function()
itp('reads an env variable', function()
local name = 'NVIM_UNIT_TEST_GETENV_1N'
local value = 'NVIM_UNIT_TEST_GETENV_1V'
eq(NULL, os_getenv(name))
- -- need to use os_setenv, because lua dosn't have a setenv function
+ -- Use os_setenv because Lua dosen't have setenv.
os_setenv(name, value, 1)
eq(value, os_getenv(name))
end)
diff --git a/test/unit/os/fileio_spec.lua b/test/unit/os/fileio_spec.lua
index 7a738ce85c..e3c8e616ce 100644
--- a/test/unit/os/fileio_spec.lua
+++ b/test/unit/os/fileio_spec.lua
@@ -80,6 +80,10 @@ local function file_read(fp, size)
return ret1, ret2
end
+local function file_flush(fp)
+ return m.file_flush(fp)
+end
+
local function file_fsync(fp)
return m.file_fsync(fp)
end
@@ -94,7 +98,7 @@ describe('file_open', function()
eq(0, err)
local attrs = lfs.attributes(filec)
eq('rwx------', attrs.permissions)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can create a rw------- file with kFileCreate', function()
@@ -102,7 +106,7 @@ describe('file_open', function()
eq(0, err)
local attrs = lfs.attributes(filec)
eq('rw-------', attrs.permissions)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can create a rwx------ file with kFileCreateOnly', function()
@@ -110,7 +114,7 @@ describe('file_open', function()
eq(0, err)
local attrs = lfs.attributes(filec)
eq('rwx------', attrs.permissions)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can create a rw------- file with kFileCreateOnly', function()
@@ -118,7 +122,7 @@ describe('file_open', function()
eq(0, err)
local attrs = lfs.attributes(filec)
eq('rw-------', attrs.permissions)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('fails to open an existing file with kFileCreateOnly', function()
@@ -137,35 +141,35 @@ describe('file_open', function()
local err, fp = file_open(file1, m.kFileCreate, 384)
eq(0, err)
eq(true, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can open an existing file read-only with zero', function()
local err, fp = file_open(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can open an existing file read-only with kFileReadOnly', function()
local err, fp = file_open(file1, m.kFileReadOnly, 384)
eq(0, err)
eq(false, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can open an existing file read-only with kFileNoSymlink', function()
local err, fp = file_open(file1, m.kFileNoSymlink, 384)
eq(0, err)
eq(false, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can truncate an existing file with kFileTruncate', function()
local err, fp = file_open(file1, m.kFileTruncate, 384)
eq(0, err)
eq(true, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
local attrs = lfs.attributes(file1)
eq(0, attrs.size)
end)
@@ -174,7 +178,7 @@ describe('file_open', function()
local err, fp = file_open(file1, m.kFileWriteOnly, 384)
eq(0, err)
eq(true, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
local attrs = lfs.attributes(file1)
eq(4096, attrs.size)
end)
@@ -191,7 +195,7 @@ describe('file_open', function()
local err, fp = file_open(linkf, m.kFileTruncate, 384)
eq(0, err)
eq(true, fp.wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
local attrs = lfs.attributes(file1)
eq(0, attrs.size)
end)
@@ -217,7 +221,7 @@ describe('file_open_new', function()
local err, fp = file_open_new(file1, 0, 384)
eq(0, err)
eq(false, fp.wr)
- eq(0, m.file_free(fp))
+ eq(0, m.file_free(fp, false))
end)
itp('fails to open an existing file with kFileCreateOnly', function()
@@ -227,7 +231,29 @@ describe('file_open_new', function()
end)
end)
--- file_close is called above, so it is not tested directly
+describe('file_close', function()
+ itp('can flush writes to disk also with true argument', function()
+ local err, fp = file_open(filec, m.kFileCreateOnly, 384)
+ eq(0, err)
+ local wsize = file_write(fp, 'test')
+ eq(4, wsize)
+ eq(0, lfs.attributes(filec).size)
+ eq(0, m.file_close(fp, true))
+ eq(wsize, lfs.attributes(filec).size)
+ end)
+end)
+
+describe('file_free', function()
+ itp('can flush writes to disk also with true argument', function()
+ local err, fp = file_open_new(filec, m.kFileCreateOnly, 384)
+ eq(0, err)
+ local wsize = file_write(fp, 'test')
+ eq(4, wsize)
+ eq(0, lfs.attributes(filec).size)
+ eq(0, m.file_free(fp, true))
+ eq(wsize, lfs.attributes(filec).size)
+ end)
+end)
describe('file_fsync', function()
itp('can flush writes to disk', function()
@@ -240,7 +266,22 @@ describe('file_fsync', function()
eq(0, lfs.attributes(filec).size)
eq(0, file_fsync(fp))
eq(wsize, lfs.attributes(filec).size)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
+ end)
+end)
+
+describe('file_flush', function()
+ itp('can flush writes to disk', function()
+ local err, fp = file_open(filec, m.kFileCreateOnly, 384)
+ eq(0, file_flush(fp))
+ eq(0, err)
+ eq(0, lfs.attributes(filec).size)
+ local wsize = file_write(fp, 'test')
+ eq(4, wsize)
+ eq(0, lfs.attributes(filec).size)
+ eq(0, file_flush(fp))
+ eq(wsize, lfs.attributes(filec).size)
+ eq(0, m.file_close(fp, false))
end)
end)
@@ -262,7 +303,7 @@ describe('file_read', function()
eq({exp_err, exp_s}, {file_read(fp, size)})
shift = shift + size
end
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can read the whole file at once', function()
@@ -271,7 +312,7 @@ describe('file_read', function()
eq(false, fp.wr)
eq({#fcontents, fcontents}, {file_read(fp, #fcontents)})
eq({0, ('\0'):rep(#fcontents)}, {file_read(fp, #fcontents)})
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can read more then 1024 bytes after reading a small chunk', function()
@@ -281,7 +322,7 @@ describe('file_read', function()
eq({5, fcontents:sub(1, 5)}, {file_read(fp, 5)})
eq({#fcontents - 5, fcontents:sub(6) .. (('\0'):rep(5))},
{file_read(fp, #fcontents)})
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
itp('can read file by 768-byte-chunks', function()
@@ -301,7 +342,7 @@ describe('file_read', function()
eq({exp_err, exp_s}, {file_read(fp, size)})
shift = shift + size
end
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
end)
@@ -312,7 +353,7 @@ describe('file_write', function()
eq(true, fp.wr)
local wr = file_write(fp, fcontents)
eq(#fcontents, wr)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
eq(wr, lfs.attributes(filec).size)
eq(fcontents, io.open(filec):read('*a'))
end)
@@ -329,7 +370,7 @@ describe('file_write', function()
eq(wr, #s)
shift = shift + size
end
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
eq(#fcontents, lfs.attributes(filec).size)
eq(fcontents, io.open(filec):read('*a'))
end)
@@ -346,7 +387,7 @@ describe('file_write', function()
eq(wr, #s)
shift = shift + size
end
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
eq(#fcontents, lfs.attributes(filec).size)
eq(fcontents, io.open(filec):read('*a'))
end)
@@ -361,6 +402,6 @@ describe('file_skip', function()
local rd, s = file_read(fp, 3)
eq(3, rd)
eq(fcontents:sub(4, 6), s)
- eq(0, m.file_close(fp))
+ eq(0, m.file_close(fp, false))
end)
end)
diff --git a/test/unit/testtest_spec.lua b/test/unit/testtest_spec.lua
new file mode 100644
index 0000000000..d2f3632b6f
--- /dev/null
+++ b/test/unit/testtest_spec.lua
@@ -0,0 +1,19 @@
+local helpers = require('test.unit.helpers')(after_each)
+local assert = require('luassert')
+
+local itp = helpers.gen_itp(it)
+
+local sc = helpers.sc
+
+-- All of the below tests must fail. Check how exactly they fail.
+if os.getenv('NVIM_TEST_RUN_TESTTEST') ~= '1' then
+ return
+end
+describe('test code', function()
+ itp('does not hang when working with lengthy errors', function()
+ assert.just_fail(('x'):rep(65536))
+ end)
+ itp('shows trace after exiting abnormally', function()
+ sc.exit(0)
+ end)
+end)
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index a5fd766aa8..ea1039f459 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -90,8 +90,8 @@ include(ExternalProject)
set(LIBUV_URL https://github.com/libuv/libuv/archive/v1.9.1.tar.gz)
set(LIBUV_SHA256 a6ca9f0648973d1463f46b495ce546ddcbe7cce2f04b32e802a15539e46c57ad)
-set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/cpp-1.0.0.tar.gz)
-set(MSGPACK_SHA256 afda64ca445203bb7092372b822bae8b2539fdcebbfc3f753f393628c2bcfe7d)
+set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/cpp-2.1.1.tar.gz)
+set(MSGPACK_SHA256 d6bef12d959816a39c7a6972f3f16c0724e4c7ff0927eb59a35247dc8267b609)
set(LUAJIT_URL https://github.com/neovim/deps/raw/master/opt/LuaJIT-2.0.4.tar.gz)
set(LUAJIT_SHA256 620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d)
diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake
index 9ea96b7cc5..7312b6f91b 100644
--- a/third-party/cmake/BuildLuarocks.cmake
+++ b/third-party/cmake/BuildLuarocks.cmake
@@ -137,7 +137,7 @@ if(USE_BUNDLED_BUSTED)
endif()
add_custom_command(OUTPUT ${BUSTED_EXE}
COMMAND ${LUAROCKS_BINARY}
- ARGS build https://raw.githubusercontent.com/Olivine-Labs/busted/v2.0.rc11-0/busted-2.0.rc11-0.rockspec ${LUAROCKS_BUILDARGS}
+ ARGS build https://raw.githubusercontent.com/Olivine-Labs/busted/v2.0.rc12-1/busted-2.0.rc12-1.rockspec ${LUAROCKS_BUILDARGS}
DEPENDS penlight)
add_custom_target(busted
DEPENDS ${BUSTED_EXE})
diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake
index 6b38508b0b..779cb1ebfe 100644
--- a/third-party/cmake/BuildMsgpack.cmake
+++ b/third-party/cmake/BuildMsgpack.cmake
@@ -35,6 +35,7 @@ endfunction()
set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_ENABLE_CXX=OFF
-DMSGPACK_BUILD_TESTS=OFF
+ -DMSGPACK_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
@@ -49,6 +50,7 @@ if(MINGW AND CMAKE_CROSSCOMPILING)
set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_ENABLE_CXX=OFF
-DMSGPACK_BUILD_TESTS=OFF
+ -DMSGPACK_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
# Pass toolchain
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
@@ -60,6 +62,7 @@ elseif(MSVC)
set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack
-DMSGPACK_ENABLE_CXX=OFF
-DMSGPACK_BUILD_TESTS=OFF
+ -DMSGPACK_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1}"
diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake
index 24e431b5e5..2fc6e0415f 100644
--- a/third-party/cmake/DownloadAndExtractFile.cmake
+++ b/third-party/cmake/DownloadAndExtractFile.cmake
@@ -39,7 +39,7 @@ if(TIMEOUT)
set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds")
else()
- set(timeout_args "# no TIMEOUT")
+ set(timeout_args "")
set(timeout_msg "none")
endif()