diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/ex_cmds2.c | 76 | ||||
| -rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/Makefile | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test100.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test12.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test15.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test24.in | bin | 1301 -> 1265 bytes | |||
| -rw-r--r-- | src/nvim/testdir/test29.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test3.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test32.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test44.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test49.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test61.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test70.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test72.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test73.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test74.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test78.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test8.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test85.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test89.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test94.in | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test95.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test99.in | 2 | ||||
| -rw-r--r-- | src/nvim/testdir/test_breakindent.in | 2 | 
25 files changed, 90 insertions, 23 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index fa78047a46..072972d24e 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3291,3 +3291,79 @@ static void script_host_do_range(char *name, exarg_T *eap)    (void)eval_call_provider(name, "do_range", args);  } +/* + * ":drop" + * Opens the first argument in a window.  When there are two or more arguments + * the argument list is redefined. + */ +void ex_drop(exarg_T   *eap) +{ +    int                split = FALSE; +    buf_T      *buf; + +    /* +     * Check if the first argument is already being edited in a window.  If +     * so, jump to that window. +     * We would actually need to check all arguments, but that's complicated +     * and mostly only one file is dropped. +     * This also ignores wildcards, since it is very unlikely the user is +     * editing a file name with a wildcard character. +     */ +    do_arglist(eap->arg, AL_SET, 0); + +    /* +     * Expanding wildcards may result in an empty argument list.  E.g. when +     * editing "foo.pyc" and ".pyc" is in 'wildignore'.  Assume that we +     * already did an error message for this. +     */ +    if (ARGCOUNT == 0) +       return; + +    if (cmdmod.tab) +    { +       /* ":tab drop file ...": open a tab for each argument that isn't +        * edited in a window yet.  It's like ":tab all" but without closing +        * windows or tabs. */ +       ex_all(eap); +    } +    else +    { +       /* ":drop file ...": Edit the first argument.  Jump to an existing +        * window if possible, edit in current window if the current buffer +        * can be abandoned, otherwise open a new window. */ +       buf = buflist_findnr(ARGLIST[0].ae_fnum); + +       FOR_ALL_TAB_WINDOWS(tp, wp) +       { +           if (wp->w_buffer == buf) +           { +               goto_tabpage_win(tp, wp); +               curwin->w_arg_idx = 0; +               return; +           } +       } + +       /* +        * Check whether the current buffer is changed. If so, we will need +        * to split the current window or data could be lost. +        * Skip the check if the 'hidden' option is set, as in this case the +        * buffer won't be lost. +        */ +       if (!P_HID(curbuf)) +       { +           ++emsg_off; +           split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); +           --emsg_off; +       } + +       /* Fake a ":sfirst" or ":first" command edit the first argument. */ +       if (split) +       { +           eap->cmdidx = CMD_sfirst; +           eap->cmd[0] = 's'; +       } +       else +           eap->cmdidx = CMD_first; +       ex_rewind(eap); +    } +} diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 65a0017e20..8487761acb 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -135,7 +135,6 @@ struct dbg_stuff {  #endif  # define HAVE_EX_SCRIPT_NI -# define ex_drop                ex_ni  # define ex_gui                 ex_nogui  # define ex_tearoff             ex_ni  # define ex_popup               ex_ni diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 6bacef9778..fce0971d89 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -94,7 +94,7 @@ $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) test1.out  RM_ON_RUN   := test.out X* viminfo  RM_ON_START := tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok -RUN_VIM     := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in +RUN_VIM     := VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(TOOL) $(VIMPROG) -u unix.vim -U NONE -i viminfo --noplugin -s dotest.in  clean:  	-rm -rf *.out          \ diff --git a/src/nvim/testdir/test100.in b/src/nvim/testdir/test100.in index 2bf931fd4f..083b4324b2 100644 --- a/src/nvim/testdir/test100.in +++ b/src/nvim/testdir/test100.in @@ -2,7 +2,7 @@ Tests for 'undolevel' setting being global-local  STARTTEST  :so small.vim -:set nocompatible viminfo+=nviminfo ul=5 +:set ul=5  :fu! FillBuffer()    :for i in range(1,13)      :put=i diff --git a/src/nvim/testdir/test12.in b/src/nvim/testdir/test12.in index 46e9c45b80..be3169a625 100644 --- a/src/nvim/testdir/test12.in +++ b/src/nvim/testdir/test12.in @@ -5,7 +5,6 @@ Tests for 'directory' option.  STARTTEST  :so small.vim -:set nocompatible viminfo+=nviminfo  :set dir=.,~  :/start of testfile/,/end of testfile/w! Xtest1  :" do an ls of the current dir to find the swap file (should not be there) diff --git a/src/nvim/testdir/test15.in b/src/nvim/testdir/test15.in index 366529a550..60d8717278 100644 --- a/src/nvim/testdir/test15.in +++ b/src/nvim/testdir/test15.in @@ -12,7 +12,6 @@ STARTTEST  :set fo+=tcroql tw=72  /xxxxxxxx$  0gq6kk -:set nocp viminfo+=nviminfo  :" undo/redo here to make the next undo only work on the following changes  u  :map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq diff --git a/src/nvim/testdir/test24.in b/src/nvim/testdir/test24.in Binary files differindex 7dfc1afdc6..292f403048 100644 --- a/src/nvim/testdir/test24.in +++ b/src/nvim/testdir/test24.in diff --git a/src/nvim/testdir/test29.in b/src/nvim/testdir/test29.in index 83c6acdc1c..4cc2120814 100644 --- a/src/nvim/testdir/test29.in +++ b/src/nvim/testdir/test29.in @@ -5,7 +5,6 @@ Test for joining lines and marks in them  STARTTEST  :so small.vim -:set viminfo+=nviminfo  :set nojoinspaces  :set cpoptions-=j  /firstline/ diff --git a/src/nvim/testdir/test3.in b/src/nvim/testdir/test3.in index a7543945c4..46e5767062 100644 --- a/src/nvim/testdir/test3.in +++ b/src/nvim/testdir/test3.in @@ -4,7 +4,7 @@ Test for 'cindent'  STARTTEST  :so small.vim -:set nocompatible viminfo+=nviminfo modeline +:set modeline  :edit                " read modeline  /start of AUTO  =/end of AUTO diff --git a/src/nvim/testdir/test32.in b/src/nvim/testdir/test32.in index 6b399fa6c6..02a41141ab 100644 --- a/src/nvim/testdir/test32.in +++ b/src/nvim/testdir/test32.in @@ -22,7 +22,7 @@ Test for insert expansion  STARTTEST  :so small.vim -:se nocp viminfo+=nviminfo cpt=.,w ff=unix | $-2,$w!Xtestfile | set ff& +:se cpt=.,w ff=unix | $-2,$w!Xtestfile | set ff&  :se cot=  nO#include "Xtestfile"  ru diff --git a/src/nvim/testdir/test44.in b/src/nvim/testdir/test44.in index 87de1b95a4..65b08b08b8 100644 --- a/src/nvim/testdir/test44.in +++ b/src/nvim/testdir/test44.in @@ -4,7 +4,7 @@ See test99 for exactly the same test with re=2.  STARTTEST  :so mbyte.vim -:set nocompatible encoding=utf-8 termencoding=latin1 viminfo+=nviminfo +:set encoding=utf-8 termencoding=latin1  :set re=1  /^1  /a*b\{2}c\+/e diff --git a/src/nvim/testdir/test49.in b/src/nvim/testdir/test49.in index 5e1d6b461e..1ce57246ee 100644 --- a/src/nvim/testdir/test49.in +++ b/src/nvim/testdir/test49.in @@ -5,7 +5,7 @@ test49.failed, try to add one or more "G"s at the line ending in "test.out"  STARTTEST  :so small.vim -:se nocp nomore viminfo+=nviminfo +:se nomore  :lang mess C  :so test49.vim  GGGGGGGGGGGGGG"rp:.-,$w! test.out diff --git a/src/nvim/testdir/test61.in b/src/nvim/testdir/test61.in index dc24ab9804..87bb07a209 100644 --- a/src/nvim/testdir/test61.in +++ b/src/nvim/testdir/test61.in @@ -85,7 +85,6 @@ ggO---:0put b  ggO---:0put a  ggO---:w >>test.out  :so small.vim -:set nocp viminfo+=nviminfo  :enew!  oa  :set ul=100 diff --git a/src/nvim/testdir/test70.in b/src/nvim/testdir/test70.in index 9fbe818b3d..24d2e4c446 100644 --- a/src/nvim/testdir/test70.in +++ b/src/nvim/testdir/test70.in @@ -2,7 +2,6 @@ Smoke test for MzScheme interface and mzeval() function  STARTTEST  :so mzscheme.vim -:set nocompatible viminfo+=nviminfo  :function! MzRequire()  :redir => l:mzversion  :mz (version) diff --git a/src/nvim/testdir/test72.in b/src/nvim/testdir/test72.in index 4700d86981..20897f01a0 100644 --- a/src/nvim/testdir/test72.in +++ b/src/nvim/testdir/test72.in @@ -6,7 +6,7 @@ STARTTEST  :so small.vim  :"  :" Test 'undofile': first a simple one-line change. -:set nocompatible viminfo+=nviminfo visualbell +:set visualbell  :set ul=100 undofile nomore  :set ft=unix  :e! Xtestfile diff --git a/src/nvim/testdir/test73.in b/src/nvim/testdir/test73.in index 666e4d2e50..60cda2d970 100644 --- a/src/nvim/testdir/test73.in +++ b/src/nvim/testdir/test73.in @@ -7,7 +7,6 @@ STARTTEST  :"  :" This will cause a few errors, do it silently.  :set visualbell -:set nocp viminfo+=nviminfo  :"  :function! DeleteDirectory(dir)  : if has("win16") || has("win32") || has("win64") || has("dos16") || has("dos32") diff --git a/src/nvim/testdir/test74.in b/src/nvim/testdir/test74.in index 4fbe5e4d01..9fdbe771b3 100644 --- a/src/nvim/testdir/test74.in +++ b/src/nvim/testdir/test74.in @@ -7,7 +7,7 @@ STARTTEST  :"  :" This will cause a few errors, do it silently.  :set visualbell -:set nocp viminfo+=!,nviminfo +:set viminfo+=!  :let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}  :" store a really long list, so line wrapping will occur in viminfo file  :let MY_GLOBAL_LIST=range(1,100) diff --git a/src/nvim/testdir/test78.in b/src/nvim/testdir/test78.in index 1850bd9236..cb0e51edd5 100644 --- a/src/nvim/testdir/test78.in +++ b/src/nvim/testdir/test78.in @@ -6,7 +6,7 @@ blocks.  STARTTEST  :so small.vim -:set nocp fileformat=unix undolevels=-1 viminfo+=nviminfo +:set fileformat=unix undolevels=-1  :e! Xtest  ggdG  :let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789" diff --git a/src/nvim/testdir/test8.in b/src/nvim/testdir/test8.in index d9d00d97ae..0f27c813ec 100644 --- a/src/nvim/testdir/test8.in +++ b/src/nvim/testdir/test8.in @@ -32,7 +32,7 @@ endfunc    $put ='VimLeave done'    write  endfunc -:set viminfo='100,nviminfo +:set viminfo='100  :au BufUnload * call CloseAll()  :au VimLeave * call WriteToOut()  :e small.vim diff --git a/src/nvim/testdir/test85.in b/src/nvim/testdir/test85.in index c5ca873a49..f7112792e9 100644 --- a/src/nvim/testdir/test85.in +++ b/src/nvim/testdir/test85.in @@ -3,7 +3,6 @@ Test for Lua interface and luaeval() function  STARTTEST  :so small.vim  :so lua.vim -:set nocompatible viminfo+=nviminfo  :lua l = vim.list():add"item0":add"dictionary with list OK":add"item2"  :lua h = vim.dict(); h.list = l  :call garbagecollect() diff --git a/src/nvim/testdir/test89.in b/src/nvim/testdir/test89.in index 1968066198..f1f64fb41f 100644 --- a/src/nvim/testdir/test89.in +++ b/src/nvim/testdir/test89.in @@ -5,7 +5,7 @@  STARTTEST  :so small.vim -:set hidden nocp nu rnu viminfo+=nviminfo +:set hidden nu rnu  :redir @a | set nu? rnu? | redir END  :e! xx  :redir @b | set nu? rnu? | redir END diff --git a/src/nvim/testdir/test94.in b/src/nvim/testdir/test94.in index dfa91d8340..a8b46112d2 100644 --- a/src/nvim/testdir/test94.in +++ b/src/nvim/testdir/test94.in @@ -17,7 +17,6 @@ Test cases:  STARTTEST  :so small.vim -:set nocp viminfo+=nviminfo  :  :" User functions  :function MoveToCap() diff --git a/src/nvim/testdir/test95.in b/src/nvim/testdir/test95.in index b2b9de772e..221b550487 100644 --- a/src/nvim/testdir/test95.in +++ b/src/nvim/testdir/test95.in @@ -7,7 +7,7 @@ actually tried.  STARTTEST  :so small.vim  :so mbyte.vim -:set nocp encoding=utf-8 viminfo+=nviminfo nomore +:set encoding=utf-8 nomore  :" tl is a List of Lists with:  :"    2: test auto/old/new  0: test auto/old  1: test auto/new  :"    regexp pattern diff --git a/src/nvim/testdir/test99.in b/src/nvim/testdir/test99.in index 77828f4b68..32bc68cce4 100644 --- a/src/nvim/testdir/test99.in +++ b/src/nvim/testdir/test99.in @@ -4,7 +4,7 @@ See test44 for exactly the same test with re=1.  STARTTEST  :so mbyte.vim -:set nocompatible encoding=utf-8 termencoding=latin1 viminfo+=nviminfo +:set encoding=utf-8 termencoding=latin1  :set re=2  /^1  /a*b\{2}c\+/e diff --git a/src/nvim/testdir/test_breakindent.in b/src/nvim/testdir/test_breakindent.in index 0b00c95a85..ad12d0074d 100644 --- a/src/nvim/testdir/test_breakindent.in +++ b/src/nvim/testdir/test_breakindent.in @@ -81,7 +81,7 @@ STARTTEST  :" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ  :only  :vert 20new -:set all& nocp breakindent briopt=min:10 +:set all& breakindent briopt=min:10  :call setline(1, ["    a\tb\tc\td\te", "    z   y       x       w       v"])  :/^\s*a  fbgjyl:let line1 = @0  | 
