diff options
-rw-r--r-- | runtime/doc/autocmd.txt | 2 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 17 | ||||
-rw-r--r-- | runtime/doc/job_control.txt | 10 | ||||
-rw-r--r-- | runtime/doc/msgpack_rpc.txt | 22 | ||||
-rw-r--r-- | runtime/doc/nvim_clipboard.txt | 4 | ||||
-rw-r--r-- | runtime/doc/nvim_intro.txt | 6 | ||||
-rw-r--r-- | runtime/doc/nvim_python.txt | 2 | ||||
-rw-r--r-- | runtime/plugin/python_setup.vim | 4 | ||||
-rw-r--r-- | src/nvim/buffer_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/eval.c | 29 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/nvim/globals.h | 1 | ||||
-rw-r--r-- | src/nvim/main.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test86.in | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | third-party/CMakeLists.txt | 9 | ||||
-rw-r--r-- | third-party/cmake/InstallMsgpack.cmake | 12 |
17 files changed, 87 insertions, 38 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 8f70279310..734202cd6c 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -303,7 +303,7 @@ Name triggered by ~ |InsertLeave| when leaving Insert mode |InsertCharPre| when a character was typed in Insert mode, before inserting it -|JobActivity| when something interesting happen with a job +|JobActivity| when something interesting happens with a job |TextChanged| after a change was made to the text in Normal mode |TextChangedI| after a change was made to the text in Insert mode diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bbd43f9b9a..ec2086e3eb 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4019,7 +4019,12 @@ jobsend({job}, {data}) {Nvim} *jobsend()* jobstart({name}, {prog}[, {argv}]) {Nvim} *jobstart()* Spawns {prog} as a job and associate it with the {name} string, which will be used to match the "filename pattern" in - |JobActivity| events. See |job-control| for more information. + |JobActivity| events. It returns: + - The job id on success, which is used by |jobsend()| and + |jobstop()| + - 0 when the job table is full or on invalid arguments + - -1 when {prog} is not executable + See |job-control| for more information. jobstop({job}) {Nvim} *jobstop()* Stop a job created with |jobstart| by sending a `SIGTERM` @@ -5083,10 +5088,12 @@ rpcrequest({channel}, {method}[, {args}...]) {Nvim} *rpcrequest()* rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()* Spawns {prog} as a job(optionally passing the {argv} list), - and open a |msgpack-rpc| channel with the spawned process - stdin/stdout. Returns the channel id, which is used by - |rpcrequest()|, |rpcnotify()| and |rpcstop()| - It expects the rpc channel id as argument. Example: > + and opens a |msgpack-rpc| channel with the spawned process + stdin/stdout. It returns: + - The channel id on success, which is used by |rpcrequest()|, + |rpcnotify()| and |rpcstop()| + - 0 on failure. + Example: > :let rpc_chan = rpcstart('prog', ['arg1', 'arg2']) rpcstop({channel}) {Nvim} *rpcstop()* diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index c76b4f460b..49ee3889bc 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -66,14 +66,14 @@ nvim instance: < Here's what is happening: -- Two bash instances are spawned |jobstart()| and their stdin/stdout/stderr +- Two bash instances are spawned by |jobstart()| and their stdin/stdout/stderr are connected to nvim. - The first shell is idle, waiting to read commands from it's stdin - The second shell is passed the -c option to execute a command and exit. In our case, the command is a for loop that will print numbers and exit after a while. - The JobHandler function is called by the JobActivity autocommand(notice how - it the shell* pattern matches the `shell1` and `shell2` names passed to + the shell* pattern matches the `shell1` and `shell2` names passed to |jobstart()|), and it takes care of displaying stdout/stderr received from the shells. - The v:job_data is an array set by the JobActivity event. It has the @@ -86,9 +86,9 @@ Here's what is happening: To send data to the job's stdin, one can use the |jobsend()| function, like this: > - :call jobsend(job1, 'ls\n')<cr> - :call jobsend(job1, 'invalid-command\n')<cr> - :call jobsend(job1, 'exit\n')<cr> + :call jobsend(job1, 'ls\n') + :call jobsend(job1, 'invalid-command\n') + :call jobsend(job1, 'exit\n') < A job may be killed at any time with the |jobstop()| function: > diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index 5e926b7318..eb15075d85 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -17,20 +17,20 @@ The Msgpack-RPC Interface to Nvim *msgpack-rpc* ============================================================================== 1. Introduction *msgpack-rpc-intro* -The primary means of controlling a running nvim instance is through +The primary means of controlling a running Nvim instance is through MessagePack-RPC, a messaging protocol that uses the MessagePack serialization format: https://github.com/msgpack/msgpack/blob/7498cf3/spec.md. From now on, we'll be referring to the protocol as msgpack-rpc. At this point, only plugins use msgpack-rpc, but eventually even user interaction will be achieved through the protocol, since user interfaces will -be separate programs that control a headless nvim instance. +be separate programs that control a headless Nvim instance. This is what can be achieved by connecting to the msgpack-rpc interface: -- Call any nvim API function -- Listen for nvim events -- Receive remote calls from nvim +- Call any Nvim API function +- Listen for Nvim events +- Receive remote calls from Nvim Nvim's msgpack-rpc interface can be seen as a more powerful version of Vim's `clientserver` feature. @@ -69,7 +69,7 @@ python and the pyyaml/msgpack-python pip packages): There are four ways to open msgpack-rpc streams to nvim: -1. Through nvim's stdin/stdout when started with the `--embed` option. This +1. Through nvim's stdin/stdout when started with the `--embed` option. This is how other programs can embed nvim. 2. Through stdin/stdout of a program spawned by the |rpcstart()| function. @@ -122,7 +122,7 @@ functions can be called interactively: Nvim is still alpha and there's no in-depth documentation explaining how to properly implement a client library. The python client(neovim pip package) will be always up-to-date with the latest API changes, so it's source code is -best documentation currently available. There are some guidelines however: +the best documentation currently available. There are some guidelines however: - Separate the transport layer from the rest of the library(See |msgpack-rpc-connecting| for details of how a client can connect to nvim). @@ -134,7 +134,7 @@ best documentation currently available. There are some guidelines however: - Use a fiber/coroutine library for the language you are implementing a client for. These greatly simplify concurrency and allow the library to expose a blocking API on top of a non-blocking event loop without the complexity - that comes with preemptive multi-tasking. + that comes with preemptive multitasking. - Don't assume anything about the order that responses to msgpack-rpc requests will arrive. - Clients should expect to receive msgpack-rpc requests, which need to be @@ -159,7 +159,7 @@ around C99 standard types). The types can be split into two groups: - Basic types that map natively to msgpack(and probably have a default representation in msgpack-supported programming languages) -- Special Nvim types that map to msgpack ext with custom type codes. +- Special Nvim types that map to msgpack EXT with custom type codes. Basic type mapping: @@ -171,7 +171,7 @@ String -> msgpack binary Array -> msgpack array Dictionary -> msgpack map -Special Nvim types that use msgpack ext: +Special Nvim types that use msgpack EXT: Buffer -> enum value kObjectTypeBuffer Window -> enum value kObjectTypeWindow @@ -231,7 +231,7 @@ Four functions related to msgpack-rpc are available to vimscript: - |rpcstart()|: Similarly to |jobstart()|, this will spawn a co-process with it's standard handles connected to Nvim, the difference is that it's not possible to process raw data to/from the process stdin/stdout/stderr(Since - the job's stdin/stdout combo are used as a msgpack channgel that is + the job's stdin/stdout combo are used as a msgpack channel that is processed directly by Nvim C code). - |rpcstop()|: Same as |jobstop()|, but operates on handles returned by |rpcstart().| diff --git a/runtime/doc/nvim_clipboard.txt b/runtime/doc/nvim_clipboard.txt index ab7a8c3423..3dd5fb5fcb 100644 --- a/runtime/doc/nvim_clipboard.txt +++ b/runtime/doc/nvim_clipboard.txt @@ -36,9 +36,9 @@ by Nvim): This should enable the '+' and '*' registers. As an optional step, set the 'unnamedclip' option to transparently access clipboard using the unnamed register. If you use the same |vimrc| for both Vim and Nvim, make sure you -only set the option when `has('neovim')` is true: +only set the option when `has('nvim')` is true: > - if has('neovim') + if has('nvim') set unnamedclip endif < diff --git a/runtime/doc/nvim_intro.txt b/runtime/doc/nvim_intro.txt index 8989f35a79..d3aa459ba2 100644 --- a/runtime/doc/nvim_intro.txt +++ b/runtime/doc/nvim_intro.txt @@ -6,9 +6,9 @@ Introduction to Nvim *nvim-intro* -This is an introduction new Nvim users. It is meant for experienced Vim users -that want to get started with Nvim. For a basic introduction to Vim, see -|help.txt|. +This is an introduction to Vim users that are just getting started with Nvim. +It is not meant for Vim beginners. For a basic introduction to Vim, +see |help.txt|. For now, it is just an index with the most relevant topics/features that differentiate Nvim from Vim: diff --git a/runtime/doc/nvim_python.txt b/runtime/doc/nvim_python.txt index bb644507f7..b618562900 100644 --- a/runtime/doc/nvim_python.txt +++ b/runtime/doc/nvim_python.txt @@ -30,7 +30,7 @@ simple step-by-step: - Add the following snippet to your `vimrc`, before any python plugins are loaded: > - if has('neovim') + if has('nvim') runtime! plugin/python_setup.vim endif < diff --git a/runtime/plugin/python_setup.vim b/runtime/plugin/python_setup.vim index 1f0f07b7fa..8f3cb08063 100644 --- a/runtime/plugin/python_setup.vim +++ b/runtime/plugin/python_setup.vim @@ -6,8 +6,8 @@ let did_python_setup = 1 let s:get_version = - \ ' -c "import sys; sys.stdout.write(str(sys.version_info.major) + '. - \ '\".\" + str(sys.version_info.minor))"' + \ ' -c "import sys; sys.stdout.write(str(sys.version_info[0]) + '. + \ '\".\" + str(sys.version_info[1]))"' let s:supported = ['2.6', '2.7'] diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index de1b0985bb..84d55fb730 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -255,6 +255,7 @@ struct wininfo_S { typedef struct arglist { garray_T al_ga; /* growarray with the array of file names */ int al_refcount; /* number of windows using this arglist */ + int id; ///< id of this arglist } alist_T; /* diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 284d5367fc..00033e3866 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6309,6 +6309,7 @@ static struct fst { {"append", 2, 2, f_append}, {"argc", 0, 0, f_argc}, {"argidx", 0, 0, f_argidx}, + {"arglistid", 0, 2, f_arglistid}, {"argv", 0, 1, f_argv}, {"asin", 1, 1, f_asin}, /* WJMc */ {"atan", 1, 1, f_atan}, @@ -7126,6 +7127,32 @@ static void f_argidx(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = curwin->w_arg_idx; } +/// "arglistid" function +static void f_arglistid(typval_T *argvars, typval_T *rettv) +{ + rettv->vval.v_number = -1; + if (argvars[0].v_type != VAR_UNKNOWN) { + tabpage_T *tp = NULL; + if (argvars[1].v_type != VAR_UNKNOWN) { + long n = get_tv_number(&argvars[1]); + if (n >= 0) { + tp = find_tabpage(n); + } + } else { + tp = curtab; + } + + if (tp != NULL) { + win_T *wp = find_win_by_nr(&argvars[0], tp); + if (wp != NULL) { + rettv->vval.v_number = wp->w_alist->id; + } + } + } else { + rettv->vval.v_number = curwin->w_alist->id; + } +} + /* * "argv(nr)" function */ @@ -9815,7 +9842,7 @@ static void f_has(typval_T *argvars, typval_T *rettv) "windows", "winaltkeys", "writebackup", - "neovim", + "nvim", NULL }; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index dacd0f9e31..1117b6fbcf 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5504,6 +5504,7 @@ void alist_new(void) { curwin->w_alist = xmalloc(sizeof(*curwin->w_alist)); curwin->w_alist->al_refcount = 1; + curwin->w_alist->id = ++max_alist_id; alist_init(curwin->w_alist); } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 49a4a2f604..674786ff08 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -568,6 +568,7 @@ EXTERN int mf_dont_release INIT(= FALSE); /* don't release blocks */ * to this when the window is using the global argument list. */ EXTERN alist_T global_alist; /* global argument list */ +EXTERN int max_alist_id INIT(= 0); ///< the previous argument list id EXTERN int arg_had_last INIT(= FALSE); /* accessed last file in global_alist */ diff --git a/src/nvim/main.c b/src/nvim/main.c index fc1826975a..7dc299e73b 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -192,6 +192,7 @@ int main(int argc, char **argv) init_yank(); /* init yank buffers */ alist_init(&global_alist); /* Init the argument list to empty. */ + global_alist.id = 0; /* * Set the default values for the options. diff --git a/src/nvim/testdir/test86.in b/src/nvim/testdir/test86.in index ecb06bafd3..11ff35cfd3 100644 --- a/src/nvim/testdir/test86.in +++ b/src/nvim/testdir/test86.in @@ -9,7 +9,7 @@ STARTTEST :so small.vim :set encoding=latin1 :set noswapfile -:if !has('python') || has('neovim') | e! test.ok | wq! test.out | endif +:if !has('python') || has('nvim') | e! test.ok | wq! test.out | endif :lang C :fun Test() :py import vim diff --git a/src/nvim/version.c b/src/nvim/version.c index db7f294a88..34dd04ee13 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -283,7 +283,7 @@ static int included_patches[] = { 315, 314, //313, - //312, + 312, //311, //310, 309, diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 2f7b4c9256..83a8a9c50a 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -99,11 +99,10 @@ if(USE_BUNDLED_MSGPACK) -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC" BUILD_COMMAND ${MAKE_PRG} - INSTALL_COMMAND ${MAKE_PRG} install && - rm ${DEPS_INSTALL_DIR}/lib/libmsgpack.so && - rm ${DEPS_INSTALL_DIR}/lib/libmsgpack.so.3 && - rm ${DEPS_INSTALL_DIR}/lib/libmsgpack.so.4.0.0 - ) + INSTALL_COMMAND ${CMAKE_COMMAND} + -DMAKE_PRG=${MAKE_PRG} + -DREMOVE_FILE_GLOB=${DEPS_INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}msgpack*${CMAKE_SHARED_LIBRARY_SUFFIX}* + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InstallMsgpack.cmake) list(APPEND THIRD_PARTY_DEPS msgpack) endif() diff --git a/third-party/cmake/InstallMsgpack.cmake b/third-party/cmake/InstallMsgpack.cmake new file mode 100644 index 0000000000..d5e5d7e816 --- /dev/null +++ b/third-party/cmake/InstallMsgpack.cmake @@ -0,0 +1,12 @@ +execute_process( + COMMAND ${MAKE_PRG} install + RESULT_VARIABLE res) + +if(NOT res EQUAL 0) + message(FATAL_ERROR "Installing msgpack failed.") +endif() + +file(GLOB FILES_TO_REMOVE ${REMOVE_FILE_GLOB}) +if(FILES_TO_REMOVE) + file(REMOVE ${FILES_TO_REMOVE}) +endif() |